App: Add methods to get base and direction of datum element

Add the methods DatumElement::getBasePoint() and DatumElement::getDirection() to hide implementation details and guarantee consistent behaviour.

Using the methods fixes several regressions in:
* Constraint::getDirection
* PolarPattern::getTransformations
This commit is contained in:
wmayer
2024-12-23 23:39:16 +01:00
parent 4892fcaaf1
commit d15fd988a4
7 changed files with 25 additions and 17 deletions

View File

@@ -87,6 +87,21 @@ bool DatumElement::isOriginFeature()
return lcs ? lcs->isOrigin() : false;
}
Base::Vector3d DatumElement::getBasePoint() const
{
Base::Placement plc = Placement.getValue();
return plc.getPosition();
}
Base::Vector3d DatumElement::getDirection() const
{
Base::Vector3d dir(0.0, 0.0, 1.0);
Base::Placement plc = Placement.getValue();
Base::Rotation rot = plc.getRotation();
rot.multVec(dir, dir);
return dir;
}
// ----------------------------------------------------------------------------
LocalCoordinateSystem::LocalCoordinateSystem()