Use longest edge in face for horizontal/vertical alignment (#20374)
* App: Add second direction to getCameraAlignmentDirection() * Part: Find longest face edge for horizontal/vertical alignment * Gui: Use longest face edge for horizontal/vertical alignment * App: Improve horizontal/vertical alignment for Datums and LCS
This commit is contained in:
@@ -58,10 +58,15 @@ DatumElement::DatumElement(bool hideRole)
|
||||
|
||||
DatumElement::~DatumElement() = default;
|
||||
|
||||
bool DatumElement::getCameraAlignmentDirection(Base::Vector3d& direction, const char* subname) const
|
||||
bool DatumElement::getCameraAlignmentDirection(Base::Vector3d& directionZ, Base::Vector3d& directionX, const char* subname) const
|
||||
{
|
||||
Q_UNUSED(subname);
|
||||
Placement.getValue().getRotation().multVec(baseDir, direction);
|
||||
|
||||
Placement.getValue().getRotation().multVec(baseDir, directionZ);
|
||||
|
||||
if (baseDir == Base::Vector3d::UnitZ) {
|
||||
Placement.getValue().getRotation().multVec(Base::Vector3d::UnitX, directionX);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -142,11 +147,14 @@ LocalCoordinateSystem::LocalCoordinateSystem()
|
||||
|
||||
LocalCoordinateSystem::~LocalCoordinateSystem() = default;
|
||||
|
||||
bool LocalCoordinateSystem::getCameraAlignmentDirection(Base::Vector3d& direction,
|
||||
bool LocalCoordinateSystem::getCameraAlignmentDirection(Base::Vector3d& directionZ,
|
||||
Base::Vector3d& directionX,
|
||||
const char* subname) const
|
||||
{
|
||||
Q_UNUSED(subname);
|
||||
Placement.getValue().getRotation().multVec(Base::Vector3d(0., 0., 1.), direction);
|
||||
|
||||
Placement.getValue().getRotation().multVec(Base::Vector3d::UnitZ, directionZ);
|
||||
Placement.getValue().getRotation().multVec(Base::Vector3d::UnitX, directionX);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user