rename Placement.isNull to Placement.isIdentity
implement Rotation.isNull and Rotation.isIdentity
This commit is contained in:
@@ -76,10 +76,10 @@ Placement(Base, Axis, Angle) -- define position and rotation
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isNull" Const="true">
|
||||
<Methode Name="isIdentity" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
isNull() -> Bool
|
||||
isIdentity() -> Bool
|
||||
returns True if the placement has no displacement and no rotation
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
|
||||
@@ -200,16 +200,14 @@ PyObject* PlacementPy::inverse(PyObject * args)
|
||||
return new PlacementPy(new Placement(p));
|
||||
}
|
||||
|
||||
PyObject* PlacementPy::isNull(PyObject *args)
|
||||
PyObject* PlacementPy::isIdentity(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
Base::Vector3d nullvec(0,0,0);
|
||||
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));
|
||||
bool null = (pos == nullvec) && (rot.isIdentity());
|
||||
return Py_BuildValue("O", (null ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
|
||||
@@ -658,6 +658,15 @@ void Rotation::getYawPitchRoll(double& y, double& p, double& r) const
|
||||
r = (r/D_PI)*180;
|
||||
}
|
||||
|
||||
bool Rotation::isIdentity() const
|
||||
{
|
||||
return ((this->quat[0] == 0 &&
|
||||
this->quat[1] == 0 &&
|
||||
this->quat[2] == 0) &&
|
||||
(this->quat[3] == 1 ||
|
||||
this->quat[3] == -1);
|
||||
}
|
||||
|
||||
bool Rotation::isNull() const
|
||||
{
|
||||
return (this->quat[0] == 0 &&
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
void setYawPitchRoll(double y, double p, double r);
|
||||
/// Euler angles in yaw,pitch,roll notation
|
||||
void getYawPitchRoll(double& y, double& p, double& r) const;
|
||||
bool isIdentity() const;
|
||||
bool isNull() const;
|
||||
//@}
|
||||
|
||||
|
||||
@@ -84,10 +84,18 @@
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
isNull() -> Bool
|
||||
returns True if the rotation equals the unity matrix
|
||||
returns True if all Q values are zero
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isIdentity" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
isIdentity() -> Bool
|
||||
returns True if the rotation equals the unity matrix
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Q" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The rotation elements (as quaternion)</UserDocu>
|
||||
|
||||
@@ -282,13 +282,19 @@ PyObject* RotationPy::isSame(PyObject *args)
|
||||
return Py_BuildValue("O", (same ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
PyObject* RotationPy::isIdentity(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
bool null = getRotationPtr()->isIdentity();
|
||||
return Py_BuildValue("O", (null ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
PyObject* RotationPy::isNull(PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
Base::Rotation rot = * getRotationPtr();
|
||||
Base::Rotation nullrot(0,0,0,1);
|
||||
bool null = rot.isSame(nullrot);
|
||||
bool null = getRotationPtr()->isNull();
|
||||
return Py_BuildValue("O", (null ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user