Quaternion class used to perform rotations in 3D space. More...

Public Types | |
| enum | eulerOrder : unsigned char { XZX, XYX, YXY, YZY, ZYZ, ZXZ, XZY, XYZ, YXZ, YZX, ZYX, ZXY, ROLL_PITCH_YAW = XYZ, YAW_PITCH_ROLL = ZYX } |
| Euler-angle rotation order. More... | |
| typedef scalar | cmptType |
| Component type. More... | |
| typedef scalar | magType |
| Magnitude type. More... | |
Public Member Functions | |
| quaternion ()=default | |
| Default construct. More... | |
| quaternion (const quaternion &)=default | |
| Copy construct. More... | |
| quaternion & | operator= (const quaternion &)=default |
| Copy assignment. More... | |
| quaternion (const Foam::zero) | |
| Construct initialized to zero. More... | |
| quaternion (const scalar w, const vector &v) | |
| Construct given scalar and vector parts. More... | |
| quaternion (const vector &d, const scalar theta) | |
| Construct rotation quaternion given direction d and angle theta. More... | |
| quaternion (const vector &d, const scalar cosTheta, const bool isNormalised) | |
| Construct a rotation quaternion given direction d and cosine angle cosTheta and flag if d is normalised. More... | |
| quaternion (const scalar w) | |
| Construct a real quaternion from the given scalar part, the vector part = zero. More... | |
| quaternion (const vector &v) | |
| Construct a pure imaginary quaternion given the vector part, the scalar part = 0. More... | |
| quaternion (const eulerOrder order, const vector &angles) | |
| Construct from three Euler rotation angles. More... | |
| quaternion (const tensor &rotationTensor) | |
| Construct from a rotation tensor. More... | |
| quaternion (Istream &is) | |
| Construct from Istream. More... | |
| scalar | w () const noexcept |
| Scalar part of the quaternion ( = cos(theta/2) for rotation) More... | |
| const vector & | v () const noexcept |
| Vector part of the quaternion ( = axis of rotation) More... | |
| tensor | R () const |
| The rotation tensor corresponding to the quaternion. More... | |
| vector | eulerAngles (const eulerOrder order) const |
| Return the Euler rotation angles corresponding to the specified rotation order. More... | |
| scalar & | w () noexcept |
| Scalar part of the quaternion ( = cos(theta/2) for rotation) More... | |
| vector & | v () noexcept |
| Vector part of the quaternion ( = axis of rotation) More... | |
| quaternion & | normalise () |
| Inplace normalise the quaternion by its magnitude. More... | |
| vector | transform (const vector &v) const |
| Rotate the given vector. More... | |
| vector | invTransform (const vector &v) const |
| Rotate the given vector anti-clockwise. More... | |
| quaternion | transform (const quaternion &q) const |
| Rotate the given quaternion (and normalise) More... | |
| quaternion | invTransform (const quaternion &q) const |
| Rotate the given quaternion anti-clockwise (and normalise) More... | |
| void | operator+= (const quaternion &q) |
| void | operator-= (const quaternion &q) |
| void | operator*= (const quaternion &q) |
| void | operator/= (const quaternion &q) |
| void | operator= (const scalar s) |
| Change scalar portion only. More... | |
| void | operator= (const vector &v) |
| Change vector portion only. More... | |
| void | operator= (const Foam::zero) |
| Assign scalar and vector to zero. More... | |
| void | operator*= (const scalar s) |
| void | operator/= (const scalar s) |
| void | normalize () |
| Inplace normalise the quaternion by its magnitude. More... | |
| quaternion | normalized () const |
| Return the quaternion normalised by its magnitude. More... | |
Static Public Member Functions | |
| static quaternion | unit (const vector &v) |
| Return the unit quaternion (versor) from the given vector (w = sqrt(1 - |sqr(v)|)) More... | |
Static Public Attributes | |
| static const Enum< eulerOrder > | eulerOrderNames |
| The names for Euler-angle and Tait-Bryan angles, including "rollPitchYaw" and "yawPitchRoll" aliases. More... | |
| static constexpr direction | rank = 1 |
| Rank of quaternion is 1. More... | |
| static constexpr const char *const | typeName = "quaternion" |
| static const quaternion | zero |
| static const quaternion | I |
Quaternion class used to perform rotations in 3D space.
Definition at line 53 of file quaternion.H.
| typedef scalar cmptType |
Component type.
Definition at line 105 of file quaternion.H.
| typedef scalar magType |
Magnitude type.
Definition at line 110 of file quaternion.H.
| enum eulerOrder : unsigned char |
Euler-angle rotation order.
| Enumerator | |
|---|---|
| XZX | |
| XYX | |
| YXY | |
| YZY | |
| ZYZ | |
| ZXZ | |
| XZY | |
| XYZ | |
| YXZ | |
| YZX | |
| ZYX | |
| ZXY | |
| ROLL_PITCH_YAW | |
| YAW_PITCH_ROLL | |
Definition at line 115 of file quaternion.H.
|
default |
Default construct.
|
default |
Copy construct.
|
inline |
Construct initialized to zero.
Definition at line 24 of file quaternionI.H.
|
inline |
Construct given scalar and vector parts.
Definition at line 31 of file quaternionI.H.
|
inline |
Construct rotation quaternion given direction d and angle theta.
Definition at line 38 of file quaternionI.H.
|
inline |
Construct a rotation quaternion given direction d and cosine angle cosTheta and flag if d is normalised.
Definition at line 46 of file quaternionI.H.
References Foam::normalised(), and Foam::sqrt().

|
inlineexplicit |
Construct a real quaternion from the given scalar part, the vector part = zero.
Definition at line 66 of file quaternionI.H.
|
inlineexplicit |
Construct a pure imaginary quaternion given the vector part, the scalar part = 0.
Definition at line 73 of file quaternionI.H.
|
inline |
Construct from three Euler rotation angles.
Definition at line 87 of file quaternionI.H.
References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

|
inlineexplicit |
Construct from a rotation tensor.
Definition at line 200 of file quaternionI.H.
References Foam::rotationTensor(), s, and Foam::sqrt().

|
explicit |
Construct from Istream.
Definition at line 58 of file quaternion.C.
|
default |
Copy assignment.
|
inlinestatic |
Return the unit quaternion (versor) from the given vector (w = sqrt(1 - |sqr(v)|))
Definition at line 80 of file quaternionI.H.
References Foam::magSqr(), and Foam::sqrt().
Referenced by joint::unitQuaternion().


|
inlinenoexcept |
Scalar part of the quaternion ( = cos(theta/2) for rotation)
Definition at line 278 of file quaternionI.H.
Referenced by Foam::conjugate(), Foam::exp(), Foam::inv(), Foam::magSqr(), Foam::name(), Foam::operator*(), quaternion::operator*=(), Foam::operator+(), Foam::operator-(), Foam::operator/(), Foam::operator<<(), Foam::operator==(), Foam::operator>>(), and Foam::pow().

|
inlinenoexcept |
Vector part of the quaternion ( = axis of rotation)
Definition at line 284 of file quaternionI.H.
Referenced by Foam::conjugate(), Foam::exp(), Foam::inv(), Foam::magSqr(), Foam::name(), Foam::operator*(), quaternion::operator*=(), Foam::operator+(), Foam::operator-(), Foam::operator/(), Foam::operator<<(), Foam::operator==(), Foam::operator>>(), Foam::pow(), and joint::unitQuaternion().

|
inline |
The rotation tensor corresponding to the quaternion.
Definition at line 351 of file quaternionI.H.
References Foam::sqr(), w2, x, and y.
Referenced by axisAngle::rotation(), Foam::transform(), and triad::triad().


|
inline |
Return the Euler rotation angles corresponding to the specified rotation order.
Definition at line 401 of file quaternionI.H.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::sqr(), w2, x, y, and Foam::Zero.

|
inlinenoexcept |
Scalar part of the quaternion ( = cos(theta/2) for rotation)
Definition at line 290 of file quaternionI.H.
|
inlinenoexcept |
Vector part of the quaternion ( = axis of rotation)
Definition at line 296 of file quaternionI.H.
|
inline |
Inplace normalise the quaternion by its magnitude.
For small magnitudes (less than ROOTVSMALL) set to zero.
Definition at line 302 of file quaternionI.H.
References Foam::mag(), s, and Foam::Zero.
Referenced by Foam::average(), rigidBodySolver::correctQuaternionJoints(), quaternion::normalize(), and quaternion::normalized().


|
inline |
Rotate the given vector.
Definition at line 324 of file quaternionI.H.
References Foam::conjugate().
Referenced by searchableExtrudedCircle::findParametricNearest(), polyline::operator()(), Foam::operator*(), Foam::operator/(), and septernion::operator/=().


|
inline |
Rotate the given vector anti-clockwise.
Definition at line 330 of file quaternionI.H.
References Foam::conjugate().
Referenced by Foam::operator*(), and septernion::operator*=().


|
inline |
Rotate the given quaternion (and normalise)
Definition at line 336 of file quaternionI.H.
References Foam::normalised().

|
inline |
Rotate the given quaternion anti-clockwise (and normalise)
Definition at line 343 of file quaternionI.H.
References Foam::conjugate(), and Foam::normalised().

|
inline |
Definition at line 581 of file quaternionI.H.
|
inline |
Definition at line 587 of file quaternionI.H.
|
inline |
Definition at line 593 of file quaternionI.H.
References quaternion::v(), quaternion::w(), and w0.

|
inline |
Definition at line 600 of file quaternionI.H.
References Foam::inv().

|
inline |
|
inline |
Change vector portion only.
Definition at line 612 of file quaternionI.H.
|
inline |
Assign scalar and vector to zero.
Definition at line 618 of file quaternionI.H.
References Foam::Zero.
|
inline |
Definition at line 625 of file quaternionI.H.
References s.
|
inline |
Definition at line 631 of file quaternionI.H.
References s.
|
inline |
Inplace normalise the quaternion by its magnitude.
Definition at line 332 of file quaternion.H.
References quaternion::normalise().

|
inline |
Return the quaternion normalised by its magnitude.
Definition at line 338 of file quaternion.H.
References quaternion::normalise().

|
static |
The names for Euler-angle and Tait-Bryan angles, including "rollPitchYaw" and "yawPitchRoll" aliases.
Definition at line 132 of file quaternion.H.
Referenced by lumpedPointMovement::readDict(), lumpedPointState::writeDict(), and euler::writeEntry().
|
static |
Rank of quaternion is 1.
Definition at line 140 of file quaternion.H.
|
static |
Definition at line 145 of file quaternion.H.
|
static |
Definition at line 147 of file quaternion.H.
|
static |
Definition at line 148 of file quaternion.H.
Referenced by septernion::operator=().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.