Added 0000650 - Placement.isNull() function
This commit is contained in:
@@ -83,9 +83,9 @@ int PlacementPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
PyObject* d;
|
||||
double angle;
|
||||
if (PyArg_ParseTuple(args, "O!O!d", &(Base::VectorPy::Type), &o,
|
||||
&(Base::VectorPy::Type), &d, &angle)) {
|
||||
// NOTE: The first parameter defines the translation, the second the rotation axis
|
||||
// and the last parameter defines the rotation angle in degree.
|
||||
&(Base::VectorPy::Type), &d, &angle)) {
|
||||
// NOTE: The first parameter defines the translation, the second the rotation axis
|
||||
// and the last parameter defines the rotation angle in degree.
|
||||
Base::Rotation rot(static_cast<Base::VectorPy*>(d)->value(), angle/180.0*D_PI);
|
||||
*getPlacementPtr() = Base::Placement(static_cast<Base::VectorPy*>(o)->value(),rot);
|
||||
return 0;
|
||||
@@ -145,13 +145,13 @@ PyObject* PlacementPy::multVec(PyObject * args)
|
||||
getPlacementPtr()->multVec(pnt, pnt);
|
||||
return new VectorPy(new Vector3d(pnt));
|
||||
}
|
||||
|
||||
PyObject* PlacementPy::copy(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return new PlacementPy(new Placement(*getPlacementPtr()));
|
||||
}
|
||||
|
||||
PyObject* PlacementPy::copy(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return new PlacementPy(new Placement(*getPlacementPtr()));
|
||||
}
|
||||
|
||||
PyObject* PlacementPy::toMatrix(PyObject * args)
|
||||
{
|
||||
@@ -169,6 +169,19 @@ PyObject* PlacementPy::inverse(PyObject * args)
|
||||
return new PlacementPy(new Placement(p));
|
||||
}
|
||||
|
||||
PyObject* PlacementPy::isNull(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
Base::Vector3d pos = getPlacementPtr()->getPosition();
|
||||
Base::Rotation rot = getPlacementPtr()->getRotation();
|
||||
Base::Vector3d nullvec(0,0,0);
|
||||
Base::Rotation nullrot(0,0,0,1);
|
||||
Base::Rotation nullrotinv(0,0,0,-1);
|
||||
bool null = (pos == nullvec) & ((rot == nullrot) | (rot == nullrotinv));
|
||||
return Py_BuildValue("O", (null ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
Py::Object PlacementPy::getBase(void) const
|
||||
{
|
||||
return Py::Vector(getPlacementPtr()->getPosition());
|
||||
|
||||
Reference in New Issue
Block a user