Part: Add midpoint attachement mode

This adds midpoint attachement mode to Attacher. It works just like
method for finding placement of JCS in Assembly.
This commit is contained in:
Kacper Donat
2024-11-11 17:59:07 +01:00
parent 49ff7b8bf0
commit 88141d6dce
6 changed files with 155 additions and 11 deletions

View File

@@ -81,6 +81,12 @@ Rotation::Rotation(const Vector3d& rotateFrom, const Vector3d& rotateTo)
this->setValue(rotateFrom, rotateTo);
}
Rotation Rotation::fromNormalVector(const Vector3d& normal)
{
// We rotate Z axis to be aligned with the supplied normal vector
return Rotation(Vector3d(0, 0, 1), normal);
}
const double* Rotation::getValue() const
{
return &this->quat[0];

View File

@@ -49,6 +49,9 @@ public:
Rotation(const Rotation& rot) = default;
Rotation(Rotation&& rot) = default;
~Rotation() = default;
/// Utility function to create Rotation based on direction / normal vector
static Rotation fromNormalVector(const Vector3d& normal);
//@}
/** Methods to get or set rotations. */