|
| constexpr | Quat () noexcept |
| | Construct identity quaternion.
|
| constexpr | Quat (T ix, T jy, T kz, T _w) noexcept |
| | Construct from explicit components.
|
| constexpr | Quat (const Vector< T, 3 > &v, T real) noexcept |
| | Construct from a 3D vector (imaginary part) and a real scalar.
|
| constexpr | Quat (const T comps[4]) noexcept |
| | Construct from a plain C-style array of 4 scalars.
|
| constexpr Vector< T, 3 > | imag () const noexcept |
| | Return the imaginary (vector) part as Vector<T,3>.
|
| constexpr T | real () const noexcept |
| | Return the real (scalar) component.
|
| constexpr T & | operator[] (size_t idx) noexcept |
| | Mutable indexed access to components.
|
| constexpr const T & | operator[] (size_t idx) const noexcept |
| | Const indexed access to components.
|
| constexpr Quat | operator- () const noexcept |
| | Return the negated quaternion.
|
| constexpr Quat | operator* (T s) const noexcept |
| | Multiply quaternion components by a scalar.
|
| constexpr Quat | operator+ (const Quat &o) const noexcept |
| | Component-wise addition.
|
| constexpr Quat | operator- (const Quat &o) const noexcept |
| | Component-wise subtraction.
|
| constexpr Quat & | set (T ix, T iy, T iz, T iw) noexcept |
| | Set components directly.
|
| constexpr Quat & | setImag (const Vector< T, 3 > &v) noexcept |
| | Set imaginary part from a Vector<T,3>.
|
template<typename T>
struct Crux::Quat< T >
Templated quaternion representation.
- Template Parameters
-
| T | Scalar numeric type (f32, double, etc.) |
- Storage layout
- The components are stored as:
- x, y, z; the vector (imaginary) part
- w; the scalar (real) part
This layout matches common engine conventions where a quaternion is represented as (x, y, z, w) and is compatible with copy/memcpy semantics.
- Default Value
- Default construction yields the identity quaternion (no rotation): {0, 0, 0, 1}.
- Notes on usage
- Prefer normalized quaternions for rotation semantics. Many operations in this assume or recommend normalization (unit-length) for numerical stability.