Base: extend Placement/Rotation API
* Add Placement::isSame() and expose to Python * Add Placement::multRight/Placement::multLeft * Fix PlacementPy::rotate * Add Rotation::multRight/Rotation::multLeft * Add a test feature FeatureTestPlacement for uni tests * Add unit tests
This commit is contained in:
@@ -351,7 +351,31 @@ Rotation Rotation::inverse() const
|
||||
return rot;
|
||||
}
|
||||
|
||||
/*!
|
||||
Let this rotation be right-multiplied by \a q. Returns reference to
|
||||
self.
|
||||
|
||||
\sa multRight()
|
||||
*/
|
||||
Rotation & Rotation::operator*=(const Rotation & q)
|
||||
{
|
||||
return multRight(q);
|
||||
}
|
||||
|
||||
Rotation Rotation::operator*(const Rotation & q) const
|
||||
{
|
||||
Rotation quat(*this);
|
||||
quat *= q;
|
||||
return quat;
|
||||
}
|
||||
|
||||
/*!
|
||||
Let this rotation be right-multiplied by \a q. Returns reference to
|
||||
self.
|
||||
|
||||
\sa multLeft()
|
||||
*/
|
||||
Rotation& Rotation::multRight(const Base::Rotation& q)
|
||||
{
|
||||
// Taken from <http://de.wikipedia.org/wiki/Quaternionen>
|
||||
double x0, y0, z0, w0;
|
||||
@@ -366,11 +390,25 @@ Rotation & Rotation::operator*=(const Rotation & q)
|
||||
return *this;
|
||||
}
|
||||
|
||||
Rotation Rotation::operator*(const Rotation & q) const
|
||||
/*!
|
||||
Let this rotation be left-multiplied by \a q. Returns reference to
|
||||
self.
|
||||
|
||||
\sa multRight()
|
||||
*/
|
||||
Rotation& Rotation::multLeft(const Base::Rotation& q)
|
||||
{
|
||||
Rotation quat(*this);
|
||||
quat *= q;
|
||||
return quat;
|
||||
// Taken from <http://de.wikipedia.org/wiki/Quaternionen>
|
||||
double x0, y0, z0, w0;
|
||||
q.getValue(x0, y0, z0, w0);
|
||||
double x1, y1, z1, w1;
|
||||
this->getValue(x1, y1, z1, w1);
|
||||
|
||||
this->setValue(w0*x1 + x0*w1 + y0*z1 - z0*y1,
|
||||
w0*y1 - x0*z1 + y0*w1 + z0*x1,
|
||||
w0*z1 + x0*y1 - y0*x1 + z0*w1,
|
||||
w0*w1 - x0*x1 - y0*y1 - z0*z1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Rotation::operator==(const Rotation & q) const
|
||||
|
||||
Reference in New Issue
Block a user