#include <Quat.h>

Static Public Attributes | |
| static constexpr Size | static_size = 4 |
| static constexpr Size | total_size = 4 |
| Compile-time constant specifying the number of scalars within this vector (equivalent to the size() method) More... | |
| static constexpr Size | spatial_dimensions = 3 |
| Compile-time constant specifying the number of dimensions of space (NOT equivalent to total_size for quaternions) More... | |
Public Member Functions | |
| constexpr | Quat () |
| constexpr | Quat (qNoInit) |
| Fast constructor: no initialization. More... | |
| ~Quat ()=default | |
| constexpr | Quat (Real x, Real y, Real z, Real w) |
| template<class Real2 > | |
| constexpr | Quat (const Real2 q[]) |
| template<class Real2 > | |
| constexpr | Quat (const Quat< Real2 > &q) |
| Quat (const Vec3 &axis, Real angle) | |
| Quat (const Vec3 &vFrom, const Vec3 &vTo) | |
| void | set (Real x, Real y, Real z, Real w) |
| const Real * | ptr () const |
| Cast into a standard C array of elements. More... | |
| Real * | ptr () |
| Cast into a standard C array of elements. More... | |
| bool | isNormalized () |
| Returns true if norm of Quaternion is one, false otherwise. More... | |
| void | normalize () |
| Normalize a quaternion. More... | |
| void | clear () |
| void | fromFrame (const Vec3 &x, const Vec3 &y, const Vec3 &z) |
| Convert the reference frame orientation into an orientation quaternion. More... | |
| void | fromMatrix (const Mat3x3 &m) |
| Convert a rotation matrix into an orientation quaternion. More... | |
| void | toMatrix (Mat3x3 &m) const |
| Convert the quaternion into an orientation matrix. More... | |
| constexpr void | toHomogeneousMatrix (Mat4x4 &m) const |
| constexpr auto | rotate (const Vec3 &v) const -> Vec3 |
| Apply the rotation to a given vector. More... | |
| constexpr auto | inverseRotate (const Vec3 &v) const -> Vec3 |
| Apply the inverse rotation to a given vector. More... | |
| auto | operator+ (const Quat &q1) const -> Quat |
| constexpr auto | operator* (const Quat &q1) const -> Quat |
| constexpr auto | operator* (const Real &r) const -> Quat |
| auto | operator/ (const Real &r) const -> Quat |
| void | operator*= (const Real &r) |
| void | operator/= (const Real &r) |
| constexpr auto | quatVectMult (const Vec3 &vect) const -> Quat |
| Given two Quats, multiply them together to get a third quaternion. More... | |
| constexpr auto | vectQuatMult (const Vec3 &vect) const -> Quat |
| constexpr Real & | operator[] (Size index) |
| constexpr const Real & | operator[] (Size index) const |
| template<std::size_t I> | |
| constexpr Real & | get () &noexcept requires(I< 4) |
| template<std::size_t I> | |
| constexpr const Real & | get () const &noexcept requires(I< 4) |
| template<std::size_t I> | |
| constexpr Real && | get () &&noexcept requires(I< 4) |
| template<std::size_t I> | |
| constexpr const Real && | get () const &&noexcept requires(I< 4) |
| auto | inverse () const -> Quat |
| auto | quatToRotationVector () const -> Vec3 |
| Given a quaternion, compute rotation vector (axis times angle) More... | |
| auto | toEulerVector () const -> Vec3 |
| void | slerp (const Quat &a, const Quat &b, Real t, bool allowFlip=true) |
Returns the slerp interpolation of Quaternions a and b, at time t. More... | |
| constexpr void | buildRotationMatrix (Real m[4][4]) const |
| constexpr void | writeOpenGlMatrix (double *m) const |
| constexpr void | writeOpenGlMatrix (float *m) const |
| auto | axisToQuat (Vec3 a, Real phi) -> Quat |
| Given an axis and angle, compute quaternion. More... | |
| void | quatToAxis (Vec3 &a, Real &phi) const |
| Given a quaternion, compute an axis and angle. More... | |
| void | setFromUnitVectors (const Vec3 &vFrom, const Vec3 &vTo) |
| Sets this quaternion to the rotation required to rotate direction vector vFrom to direction vector vTo. vFrom and vTo are assumed to be normalized. More... | |
| auto | slerp (const Quat &q1, Real t) const -> Quat |
| auto | slerp2 (const Quat &q1, Real t) const -> Quat |
| void | operator+= (const Quat &q2) |
| constexpr void | operator*= (const Quat &q1) |
| bool | operator== (const Quat &q) const |
| bool | operator!= (const Quat &q) const |
Static Public Member Functions | |
| static Quat | identity () |
| static auto | createQuaterFromFrame (const Vec3 &lox, const Vec3 &loy, const Vec3 &loz) -> Quat |
| static auto | createFromRotationVector (const Vec3 &a) -> Quat |
| Create using rotation vector (axis*angle) given in parent coordinates. More... | |
| static auto | createQuaterFromEuler (const Vec3 &v, EulerOrder order=EulerOrder::ZYX) -> Quat |
| static auto | fromEuler (Real alpha, Real beta, Real gamma, EulerOrder order=EulerOrder::ZYX) -> Quat |
| Create a quaternion from Euler angles. More... | |
| static auto | createFromRotationVector (Real a0, Real a1, Real a2) -> Quat |
| Create using the entries of a rotation vector (axis*angle) given in parent coordinates. More... | |
| static auto | set (const Vec3 &a) |
| Create using rotation vector (axis*angle) given in parent coordinates. More... | |
| static auto | set (Real a0, Real a1, Real a2) |
| Create using using the entries of a rotation vector (axis*angle) given in parent coordinates. More... | |
| static auto | quatDiff (Quat a, const Quat &b) -> Quat |
| Return the quaternion resulting of the movement between 2 quaternions. More... | |
| static auto | angularDisplacement (const Quat &a, const Quat &b) -> Vec3 |
| Return the eulerian vector resulting of the movement between 2 quaternions. More... | |
| static Size | size () |
|
staticconstexpr |
Compile-time constant specifying the number of dimensions of space (NOT equivalent to total_size for quaternions)
|
staticconstexpr |
|
staticconstexpr |
Compile-time constant specifying the number of scalars within this vector (equivalent to the size() method)
|
inlineconstexpr |
|
inlineexplicitconstexpr |
Fast constructor: no initialization.
|
default |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
| sofa::type::Quat< Real >::Quat | ( | const Vec3 & | axis, |
| Real | angle | ||
| ) |
| sofa::type::Quat< Real >::Quat | ( | const Vec3 & | vFrom, |
| const Vec3 & | vTo | ||
| ) |
Sets this quaternion to the rotation required to rotate direction vector vFrom to direction vector vTo.
vFrom and vTo are assumed to be normalized.
|
static |
Return the eulerian vector resulting of the movement between 2 quaternions.
| auto sofa::type::Quat< Real >::axisToQuat | ( | Vec3 | a, |
| Real | phi | ||
| ) | -> Quat |
Given an axis and angle, compute quaternion.
This function computes a quaternion based on an axis (defined by the given vector) and an angle about which to rotate. The angle is expressed in radians.
|
inlineconstexpr |
A useful function, builds a rotation matrix in Matrix based on given quaternion.
|
inline |
|
static |
Create using rotation vector (axis*angle) given in parent coordinates.
|
static |
Create using the entries of a rotation vector (axis*angle) given in parent coordinates.
|
static |
|
static |
|
static |
Create a quaternion from Euler angles.
| void sofa::type::Quat< Real >::fromFrame | ( | const Vec3 & | x, |
| const Vec3 & | y, | ||
| const Vec3 & | z | ||
| ) |
Convert the reference frame orientation into an orientation quaternion.
| void sofa::type::Quat< Real >::fromMatrix | ( | const Mat3x3 & | m | ) |
Convert a rotation matrix into an orientation quaternion.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinestatic |
| auto sofa::type::Quat< Real >::inverse |
|
inlineconstexpr |
Apply the inverse rotation to a given vector.
| bool sofa::type::Quat< Real >::isNormalized |
Returns true if norm of Quaternion is one, false otherwise.
Returns true if norm of Quatnion is one, false otherwise.
| void sofa::type::Quat< Real >::normalize |
Normalize a quaternion.
Quat<Real>s always obey: a^2 + b^2 + c^2 + d^2 = 1.0 If they don't add up to 1.0, dividing by their magnitude will renormalize them.
| bool sofa::type::Quat< Real >::operator!= | ( | const Quat< Real > & | q | ) | const |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
| auto sofa::type::Quat< Real >::operator+ | ( | const Quat< Real > & | q1 | ) | const -> Quat |
Given two quaternions, add them together to get a third quaternion. Adding quaternions to get a compound rotation is analogous to adding translations to get a compound translation.
Given two rotations, e1 and e2, expressed as quaternion rotations, figure out the equivalent single rotation and stuff it into dest. NOTE: This routine is written so that q1 or q2 may be the same as dest (or each other).
| void sofa::type::Quat< Real >::operator+= | ( | const Quat< Real > & | q2 | ) |
|
inline |
|
inline |
| bool sofa::type::Quat< Real >::operator== | ( | const Quat< Real > & | q | ) | const |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
Cast into a standard C array of elements.
|
inline |
Cast into a standard C array of elements.
|
static |
Return the quaternion resulting of the movement between 2 quaternions.
| void sofa::type::Quat< Real >::quatToAxis | ( | Vec3 & | a, |
| Real & | phi | ||
| ) | const |
Given a quaternion, compute an axis and angle.
| auto sofa::type::Quat< Real >::quatToRotationVector |
Given a quaternion, compute rotation vector (axis times angle)
|
inlineconstexpr |
Given two Quats, multiply them together to get a third quaternion.
|
inlineconstexpr |
Apply the rotation to a given vector.
|
inlinestatic |
Create using rotation vector (axis*angle) given in parent coordinates.
|
inlinestatic |
Create using using the entries of a rotation vector (axis*angle) given in parent coordinates.
|
inline |
| void sofa::type::Quat< Real >::setFromUnitVectors | ( | const Vec3 & | vFrom, |
| const Vec3 & | vTo | ||
| ) |
Sets this quaternion to the rotation required to rotate direction vector vFrom to direction vector vTo. vFrom and vTo are assumed to be normalized.
|
inlinestatic |
| void sofa::type::Quat< Real >::slerp | ( | const Quat< Real > & | a, |
| const Quat< Real > & | b, | ||
| Real | t, | ||
| bool | allowFlip = true |
||
| ) |
Returns the slerp interpolation of Quaternions a and b, at time t.
t should range in [0,1]. Result is a when t=0 and b when t=1. When allowFlip is true (default) the slerp interpolation will always use the "shortest path" between the Quaternions' orientations, by "flipping" the source Quaternion if needed (see negate()).
t should range in [0,1]. Result is a when t=0 and b when t=1.
When allowFlip is true (default) the slerp interpolation will always use the "shortest path" between the Quaternions' orientations, by "flipping" the source Quatnion if needed (see negate()).
| auto sofa::type::Quat< Real >::slerp | ( | const Quat< Real > & | q1, |
| Real | t | ||
| ) | const -> Quat |
| auto sofa::type::Quat< Real >::slerp2 | ( | const Quat< Real > & | q1, |
| Real | t | ||
| ) | const -> Quat |
| auto sofa::type::Quat< Real >::toEulerVector |
Compute the Euler angles: Roll: rotation about the X-axis Pitch: rotation about the Y-axis Yaw: rotation about the Z-axis
|
inlineconstexpr |
Convert the quaternion into an orientation homogeneous matrix The homogeneous part is set to 0,0,0,1
|
inline |
Convert the quaternion into an orientation matrix.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
strong |
Create a quaternion from Euler angles Thanks to https://github.com/mrdoob/three.js/blob/dev/src/math/Quaternion.js#L199
| Enumerator | |
|---|---|
| XYZ | |
| YXZ | |
| ZXY | |
| ZYX | |
| YZX | |
| XZY | |