template<typename VecType = SimFloat>
TQuat struct

Unit quaternion parameterized on a scalar type.

Template parameters
VecType Scalar element type — defaults to SimFloat.

Stored as (x, y, z, w) with the scalar part in w. Hamilton product convention.

Public static functions

static auto Identity() -> TQuat

Constructors, destructors, conversion operators

TQuat()
TQuat(VecType x_, VecType y_, VecType z_, VecType w_)

Public functions

auto Conjugate() const -> TQuat
auto LengthSqr() const -> VecType
auto Normalized() const -> TQuat
auto operator*(const TQuat& o) const -> TQuat
Hamilton product: this * o.
auto Rotate(const TVector3<VecType>& v) const -> TVector3<VecType>
Rotate vector v by this unit quaternion: v + 2w(q×v) + 2(q×(q×v)).
template<typename Dst>
auto CastTo() const -> TQuat<Dst>
Explicit per-component type conversion.
auto ToFloat() const -> TQuat<float>
Convert to float components.
auto ToSim() const -> TQuat<SimFloat>
Convert to SimFloat components.

Public variables

VecType x
VecType y
VecType z
VecType w