fix implementation of Rotation::isSame(const Rotation& q, double tol) and extend Python bindings

This commit is contained in:
wmayer
2019-09-10 12:49:18 +02:00
parent fd0f4f5654
commit 9b15d01b29
3 changed files with 17 additions and 7 deletions

View File

@@ -273,11 +273,12 @@ PyObject* RotationPy::toEuler(PyObject * args)
PyObject* RotationPy::isSame(PyObject *args)
{
PyObject *rot;
if (!PyArg_ParseTuple(args, "O!", &(RotationPy::Type), &rot))
double tol = 0.0;
if (!PyArg_ParseTuple(args, "O!|d", &(RotationPy::Type), &rot, &tol))
return NULL;
Base::Rotation rot1 = * getRotationPtr();
Base::Rotation rot2 = * static_cast<RotationPy*>(rot)->getRotationPtr();
bool same = rot1.isSame(rot2);
bool same = tol > 0.0 ? rot1.isSame(rot2, tol) : rot1.isSame(rot2);
return Py_BuildValue("O", (same ? Py_True : Py_False));
}