Exposed vector negative to python

This commit is contained in:
Yorik van Havre 2013-07-30 12:17:06 -03:00
parent cb789a25d8
commit a81c16c391
2 changed files with 17 additions and 0 deletions

View File

@ -32,6 +32,13 @@
</UserDocu>
</Documentation>
</Methode>
<Methode Name="negative" Const="true">
<Documentation>
<UserDocu>negative()
returns the negative (opposite) of this vector
</UserDocu>
</Documentation>
</Methode>
<Methode Name="scale">
<Documentation>
<UserDocu>scale(Float,Float,Float)

View File

@ -215,6 +215,16 @@ PyObject* VectorPy::sub(PyObject *args)
return new VectorPy(v);
}
PyObject* VectorPy::negative(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return 0;
VectorPy::PointerType this_ptr = reinterpret_cast<VectorPy::PointerType>(_pcTwinPointer);
Base::Vector3d v = -(*this_ptr);
return new VectorPy(v);
}
PyObject* VectorPy::richCompare(PyObject *v, PyObject *w, int op)
{
if (PyObject_TypeCheck(v, &(VectorPy::Type)) &&