add isNull() method to Rotation

This commit is contained in:
Sebastian Hoogen
2012-05-15 18:01:15 +02:00
parent 57403910b0
commit e63eaf9075
2 changed files with 19 additions and 0 deletions

View File

@@ -144,6 +144,17 @@ PyObject* RotationPy::toEuler(PyObject * args)
return Py::new_reference_to(tuple);
}
PyObject* RotationPy::isNull(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Base::Rotation rot = * getRotationPtr();
Base::Rotation nullrot(0,0,0,1);
Base::Rotation nullrotinv(0,0,0,-1);
bool null = (rot == nullrot) | (rot == nullrotinv);
return Py_BuildValue("O", (null ? Py_True : Py_False));
}
Py::Tuple RotationPy::getQ(void) const
{
double q0, q1, q2, q3;