add method Placement::isIdentity
This commit is contained in:
@@ -79,6 +79,13 @@ void Placement::fromMatrix(const Base::Matrix4D& matrix)
|
||||
this->_pos.z = matrix[2][3];
|
||||
}
|
||||
|
||||
bool Placement::isIdentity() const
|
||||
{
|
||||
Base::Vector3d nullvec(0,0,0);
|
||||
bool none = (this->_pos == nullvec) && (this->_rot.isIdentity());
|
||||
return none;
|
||||
}
|
||||
|
||||
void Placement::invert()
|
||||
{
|
||||
this->_rot = this->_rot.inverse();
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
void setPosition(const Vector3d& Pos){_pos=Pos;}
|
||||
void setRotation(const Rotation& Rot) {_rot = Rot;}
|
||||
|
||||
bool isIdentity() const;
|
||||
void invert();
|
||||
Placement inverse() const;
|
||||
void move(const Vector3d& MovVec);
|
||||
|
||||
@@ -204,11 +204,8 @@ 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();
|
||||
bool null = (pos == nullvec) && (rot.isIdentity());
|
||||
return Py_BuildValue("O", (null ? Py_True : Py_False));
|
||||
bool none = getPlacementPtr()->isIdentity();
|
||||
return Py_BuildValue("O", (none ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
Py::Object PlacementPy::getBase(void) const
|
||||
|
||||
Reference in New Issue
Block a user