From a81c16c391cd01d70b0eecc4e077c067fd863cc1 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 30 Jul 2013 12:17:06 -0300 Subject: [PATCH] Exposed vector negative to python --- src/Base/VectorPy.xml | 7 +++++++ src/Base/VectorPyImp.cpp | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/Base/VectorPy.xml b/src/Base/VectorPy.xml index 81cd9b005..2549c5bfb 100644 --- a/src/Base/VectorPy.xml +++ b/src/Base/VectorPy.xml @@ -32,6 +32,13 @@ + + + negative() + returns the negative (opposite) of this vector + + + scale(Float,Float,Float) diff --git a/src/Base/VectorPyImp.cpp b/src/Base/VectorPyImp.cpp index 830ec386e..c86902c68 100644 --- a/src/Base/VectorPyImp.cpp +++ b/src/Base/VectorPyImp.cpp @@ -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(_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)) &&