Represents operation of rotation in 3d space as quaternion and implements operations with rotations basing on quaternion mathematics.
More...
|
| constexpr | gp_Quaternion () noexcept |
| | Creates an identity quaternion.
|
| |
| constexpr | gp_Quaternion (const double theX, const double theY, const double theZ, const double theW) noexcept |
| | Creates quaternion directly from component values.
|
| |
| | gp_Quaternion (const gp_Vec &theVecFrom, const gp_Vec &theVecTo) |
| | Creates quaternion representing shortest-arc rotation operator producing vector theVecTo from vector theVecFrom.
|
| |
| | gp_Quaternion (const gp_Vec &theVecFrom, const gp_Vec &theVecTo, const gp_Vec &theHelpCrossVec) |
| | Creates quaternion representing shortest-arc rotation operator producing vector theVecTo from vector theVecFrom. Additional vector theHelpCrossVec defines preferred direction for rotation and is used when theVecTo and theVecFrom are directed oppositely.
|
| |
| | gp_Quaternion (const gp_Vec &theAxis, const double theAngle) |
| | Creates quaternion representing rotation on angle theAngle around vector theAxis.
|
| |
| | gp_Quaternion (const gp_Mat &theMat) |
| | Creates quaternion from rotation matrix 3*3 (which should be orthonormal skew-symmetric matrix)
|
| |
| bool | IsEqual (const gp_Quaternion &theOther) const |
| | Simple equal test without precision.
|
| |
| void | SetRotation (const gp_Vec &theVecFrom, const gp_Vec &theVecTo) |
| | Sets quaternion to shortest-arc rotation producing vector theVecTo from vector theVecFrom. If vectors theVecFrom and theVecTo are opposite then rotation axis is computed as theVecFrom ^ (1,0,0) or theVecFrom ^ (0,0,1).
|
| |
| void | SetRotation (const gp_Vec &theVecFrom, const gp_Vec &theVecTo, const gp_Vec &theHelpCrossVec) |
| | Sets quaternion to shortest-arc rotation producing vector theVecTo from vector theVecFrom. If vectors theVecFrom and theVecTo are opposite then rotation axis is computed as theVecFrom ^ theHelpCrossVec.
|
| |
| void | SetVectorAndAngle (const gp_Vec &theAxis, const double theAngle) |
| | Create a unit quaternion from Axis+Angle representation.
|
| |
| void | GetVectorAndAngle (gp_Vec &theAxis, double &theAngle) const |
| | Convert a quaternion to Axis+Angle representation, preserve the axis direction and angle from -PI to +PI.
|
| |
| void | SetMatrix (const gp_Mat &theMat) |
| | Create a unit quaternion by rotation matrix matrix must contain only rotation (not scale or shear)
|
| |
| gp_Mat | GetMatrix () const |
| | Returns rotation operation as 3*3 matrix.
|
| |
| void | SetEulerAngles (const gp_EulerSequence theOrder, const double theAlpha, const double theBeta, const double theGamma) |
| | Create a unit quaternion representing rotation defined by generalized Euler angles.
|
| |
| void | GetEulerAngles (const gp_EulerSequence theOrder, double &theAlpha, double &theBeta, double &theGamma) const |
| | Returns Euler angles describing current rotation.
|
| |
| constexpr void | Set (const double theX, const double theY, const double theZ, const double theW) noexcept |
| |
| constexpr void | Set (const gp_Quaternion &theQuaternion) noexcept |
| |
| constexpr double | X () const noexcept |
| |
| constexpr double | Y () const noexcept |
| |
| constexpr double | Z () const noexcept |
| |
| constexpr double | W () const noexcept |
| |
| constexpr void | SetIdent () noexcept |
| | Make identity quaternion (zero-rotation)
|
| |
| constexpr void | Reverse () noexcept |
| | Reverse direction of rotation (conjugate quaternion)
|
| |
| constexpr gp_Quaternion | Reversed () const noexcept |
| | Return rotation with reversed direction (conjugated quaternion)
|
| |
| constexpr void | Invert () |
| | Inverts quaternion (both rotation direction and norm)
|
| |
| constexpr gp_Quaternion | Inverted () const |
| | Return inversed quaternion q^-1.
|
| |
| constexpr double | SquareNorm () const noexcept |
| | Returns square norm of quaternion.
|
| |
| double | Norm () const |
| | Returns norm of quaternion.
|
| |
| constexpr void | Scale (const double theScale) noexcept |
| | Scale all components by quaternion by theScale; note that rotation is not changed by this operation (except 0-scaling)
|
| |
| void | operator*= (const double theScale) |
| |
| constexpr gp_Quaternion | Scaled (const double theScale) const noexcept |
| | Returns scaled quaternion.
|
| |
| constexpr gp_Quaternion | operator* (const double theScale) const noexcept |
| |
| void | StabilizeLength () |
| | Stabilize quaternion length within 1 - 1/4. This operation is a lot faster than normalization and preserve length goes to 0 or infinity.
|
| |
| void | Normalize () |
| | Scale quaternion that its norm goes to 1. The appearing of 0 magnitude or near is a error, so we can be sure that can divide by magnitude.
|
| |
| gp_Quaternion | Normalized () const |
| | Returns quaternion scaled so that its norm goes to 1.
|
| |
| constexpr gp_Quaternion | Negated () const noexcept |
| | Returns quaternion with all components negated. Note that this operation does not affect neither rotation operator defined by quaternion nor its norm.
|
| |
| constexpr gp_Quaternion | operator- () const noexcept |
| |
| constexpr gp_Quaternion | Added (const gp_Quaternion &theOther) const noexcept |
| | Makes sum of quaternion components; result is "rotations mix".
|
| |
| constexpr gp_Quaternion | operator+ (const gp_Quaternion &theOther) const noexcept |
| |
| constexpr gp_Quaternion | Subtracted (const gp_Quaternion &theOther) const noexcept |
| | Makes difference of quaternion components; result is "rotations mix".
|
| |
| constexpr gp_Quaternion | operator- (const gp_Quaternion &theOther) const noexcept |
| |
| constexpr gp_Quaternion | Multiplied (const gp_Quaternion &theOther) const noexcept |
| | Multiply function - work the same as Matrices multiplying.
|
| |
| constexpr gp_Quaternion | operator* (const gp_Quaternion &theOther) const noexcept |
| |
| constexpr void | Add (const gp_Quaternion &theOther) noexcept |
| | Adds components of other quaternion; result is "rotations mix".
|
| |
| void | operator+= (const gp_Quaternion &theOther) |
| |
| constexpr void | Subtract (const gp_Quaternion &theOther) noexcept |
| | Subtracts components of other quaternion; result is "rotations mix".
|
| |
| void | operator-= (const gp_Quaternion &theOther) |
| |
| void | Multiply (const gp_Quaternion &theOther) |
| | Adds rotation by multiplication.
|
| |
| void | operator*= (const gp_Quaternion &theOther) |
| |
| constexpr double | Dot (const gp_Quaternion &theOther) const noexcept |
| | Computes inner product / scalar product / Dot.
|
| |
| double | GetRotationAngle () const |
| | Return rotation angle from -PI to PI.
|
| |
| gp_Vec | Multiply (const gp_Vec &theVec) const |
| | Rotates vector by quaternion as rotation operator.
|
| |
| gp_Vec | operator* (const gp_Vec &theVec) const |
| |
Represents operation of rotation in 3d space as quaternion and implements operations with rotations basing on quaternion mathematics.
In addition, provides methods for conversion to and from other representations of rotation (3*3 matrix, vector and angle, Euler angles)