quat Class Template
Quaternion with scalar part w and vector part v. More...
Declaration
Public Constructors Index
template <typename T> | |
| constexpr | quat (const vec3< T > v, const T w) noexcept |
|
Constructs a quaternion from vector and scalar parts. More... | |
Public Operators Index
template <typename T> | |
| auto | operator* (const quat< T > &other) const noexcept -> constexpr quat< T > |
|
Multiplies this quaternion by another quaternion. More... | |
Public Member Functions Index
template <typename T> | |
| auto | conjugate () const noexcept -> constexpr quat< T > |
|
Returns the quaternion conjugate. More... | |
template <typename T> | |
| constexpr T | w () const noexcept |
|
Returns the scalar part. More... | |
template <typename T> | |
| auto | v () const noexcept -> constexpr vec3< T > |
|
Returns the vector part. More... | |
template <typename T> | |
| constexpr T | length () const noexcept |
|
Returns the Euclidean norm of the quaternion. More... | |
template <typename T> | |
| auto | normalized () const noexcept -> constexpr quat< T > |
|
Returns a normalized copy of the quaternion. More... | |
template <typename T> | |
| auto | rotationMatrix () const noexcept -> constexpr mat4< T > |
|
Converts the (normalized) quaternion to a 4x4 rotation matrix. More... | |
template <typename T> | |
| auto | rotate (const vec3< T > v) const noexcept -> constexpr vec3< T > |
|
Rotates a vector by this (normalized) quaternion. More... | |
Private Member Attributes Index
template <typename T> | |
| T | w_ |
template <typename T> | |
| vec3< T > | v_ |
Public Static Functions Index
template <typename TFrameRelation> | |
| static auto | fromEulerAngles (const T xAngle, const T yAngle, const T zAngle) noexcept -> constexpr quat< T > |
|
Creates a quaternion from Euler angles. More... | |
template <typename T> | |
| static auto | identity () noexcept -> constexpr quat< T > |
|
Returns the identity quaternion. More... | |
template <typename T> | |
| static auto | fromAxisAngle (const helios::math::vec3< T > v, const T angle) noexcept -> constexpr quat< T > |
|
Creates a quaternion from axis-angle representation. More... | |
Description
Quaternion with scalar part w and vector part v.
- Template Parameters
-
T Floating-point scalar type.
Definition at line 36 of file quat.ixx.
Public Constructors
quat()
| inline explicit constexpr noexcept |
Public Operators
operator*()
| inline constexpr noexcept |
Multiplies this quaternion by another quaternion.
- Parameters
-
other Right-hand quaternion operand.
- Returns
Product quaternion.
Definition at line 113 of file quat.ixx.
References helios::math::vec3< T >::cross, helios::math::dot, helios::math::quat< T >::v and helios::math::quat< T >::w.
Public Member Functions
conjugate()
| inline constexpr noexcept |
length()
| inline constexpr noexcept |
Returns the Euclidean norm of the quaternion.
- Returns
Quaternion length.
Definition at line 155 of file quat.ixx.
Referenced by helios::math::quat< T >::normalized.
normalized()
| inline constexpr noexcept |
Returns a normalized copy of the quaternion.
- Returns
Unit-length quaternion.
Definition at line 166 of file quat.ixx.
Reference helios::math::quat< T >::length.
Referenced by helios::math::quat< T >::fromEulerAngles, helios::math::quat< T >::rotate and helios::math::quat< T >::rotationMatrix.
rotate()
| inline constexpr noexcept |
Rotates a vector by this (normalized) quaternion.
- Parameters
-
v Vector to rotate.
- Returns
Rotated vector.
Definition at line 222 of file quat.ixx.
References helios::math::quat< T >::normalized and helios::math::quat< T >::v.
rotationMatrix()
| inline constexpr noexcept |
Converts the (normalized) quaternion to a 4x4 rotation matrix.
- Returns
Rotation matrix derived from the normalized quaternion.
Definition at line 176 of file quat.ixx.
References helios::math::quat< T >::normalized, helios::math::quat< T >::v and helios::math::quat< T >::w.
v()
| inline constexpr noexcept |
Returns the vector part.
- Returns
Vector component v.
Definition at line 146 of file quat.ixx.
Referenced by helios::math::quat< T >::fromAxisAngle, helios::math::quat< T >::operator*, helios::math::quat< T >::rotate and helios::math::quat< T >::rotationMatrix.
w()
| inline constexpr noexcept |
Returns the scalar part.
- Returns
Scalar component w.
Definition at line 137 of file quat.ixx.
Referenced by helios::math::quat< T >::operator* and helios::math::quat< T >::rotationMatrix.
Public Static Functions
fromAxisAngle()
| inline constexpr noexcept static |
Creates a quaternion from axis-angle representation.
- Parameters
-
v Rotation axis (normalized internally).
angle Rotation angle in radians.
- Returns
Quaternion representing the axis-angle rotation.
Definition at line 86 of file quat.ixx.
Reference helios::math::quat< T >::v.
Referenced by helios::math::quat< T >::fromEulerAngles.
fromEulerAngles()
| inline constexpr noexcept static |
Creates a quaternion from Euler angles.
- Parameters
-
xAngle Rotation angle around the x-axis in radians.
yAngle Rotation angle around the y-axis in radians.
zAngle Rotation angle around the z-axis in radians.
- Returns
Quaternion representing the composed rotation.
Definition at line 56 of file quat.ixx.
References helios::math::quat< T >::fromAxisAngle and helios::math::quat< T >::normalized.
identity()
| inline constexpr noexcept static |
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.