Base: misc patches
Convenience macros/function (in Interpreter.h) * FC_PY_GetObject/Callable(), look for callables in a python object, which will be used in future patch to improve performance in various python observer/features. * pyCall(WithKeywords)(), helper function to invoke the callable Matrix4D: * hasScale(), check if there is any scale in the transformation. If so, further check if the scale is uniform or not. This will be used in future patch for Part::TopoShape to decide which type of transform to apply. Placement: * translate/rotate(), new convenience API Rotation: * isSame/multiVec(), new convenience API Polygon2d: * Intersect(), GetCenter(), new convenience API. FlagToggler: * New class for exception safe flag toggling, similar to StateLocker but with template (actually, FlagToggler is added earlier by me). BitsetLocker: * New class for exception manipulation of a std::bitset variable.
This commit is contained in:
@@ -396,6 +396,18 @@ bool Rotation::isSame(const Rotation& q) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Rotation::isSame(const Rotation& q, double tol) const
|
||||
{
|
||||
Vector3d v(0,0,1);
|
||||
return std::fabs(multVec(v).GetAngle(q.multVec(v))) < tol;
|
||||
}
|
||||
|
||||
Vector3d Rotation::multVec(const Vector3d & src) const {
|
||||
Vector3d dst;
|
||||
multVec(src,dst);
|
||||
return dst;
|
||||
}
|
||||
|
||||
void Rotation::multVec(const Vector3d & src, Vector3d & dst) const
|
||||
{
|
||||
double x = this->quat[0];
|
||||
|
||||
Reference in New Issue
Block a user