33#ifndef DVD_QUATERNION_H_
34#define DVD_QUATERNION_H_
53 template<
typename U = T>
requires std::is_same_v<U, F32>
71 void set(T x, T y, T z, T w)
noexcept;
98 vec3<T> operator*(const
vec3<T>& vec) const noexcept;
129 void fromEuler(Angle::DEGREES<T> pitch, Angle::DEGREES<T> yaw, Angle::DEGREES<T> roll) noexcept;
152 [[nodiscard]]
vec3<T>
xAxis() const noexcept;
153 [[nodiscard]]
vec3<T>
yAxis() const noexcept;
154 [[nodiscard]]
vec3<T>
zAxis() const noexcept;
156 [[nodiscard]] T
X() const noexcept;
157 [[nodiscard]] T
Y() const noexcept;
158 [[nodiscard]] T
Z() const noexcept;
159 [[nodiscard]] T
W() const noexcept;
161 [[nodiscard]]
vec3<T>
XYZ() const noexcept;
164 void X(U x) noexcept;
166 void Y(U y) noexcept;
168 void Z(U z) noexcept;
170 void W(U w) noexcept;
174 [[nodiscard]] const
vec4<T>&
asVec4() const noexcept;
bool compare(const Quaternion &rq, Angle::DEGREES< T > tolerance=1e-3f) const
void fromMatrix(const mat3< T > &rotationMatrix) noexcept
T dot(const Quaternion &rq) const noexcept
Quaternion getConjugate() const
We need to get the inverse of a quaternion to properly apply a.
vec3< T > xAxis() const noexcept
void fromAxisAngle(const vec3< T > &v, Angle::DEGREES< T > angle) noexcept
Convert from Axis Angle.
void set(const vec4< T > &values) noexcept
void fromAxes(const vec3< T > *axis)
X/Y/Z Axis get/set a la Ogre: OgreQuaternion.cpp.
void getAxisAngle(vec3< T > &axis, Angle::DEGREES< T > &angle) const
Convert to Axis/Angles.
void getMatrix(mat3< T > &outMatrix) const noexcept
Convert to Matrix.
Quaternion(__m128 reg) noexcept
void toAxes(vec3< T > *axis) const
const vec4< T > & asVec4() const noexcept
void lookRotation(vec3< T > forward, vec3< T > up)
void normalize() noexcept
normalizing a quaternion works similar to a vector. This method will not
void slerp(const Quaternion &q, F32 t) noexcept
vec3< T > XYZ() const noexcept
vec3< T > yAxis() const noexcept
vec3< T > zAxis() const noexcept
Quaternion inverse() const
vec3< Angle::RADIANS< T > > getEuler() const noexcept
void fromEuler(const vec3< Angle::DEGREES< T > > &v) noexcept
Quaternion & operator=(const Quaternion &q) noexcept
Handle console commands that start with a forward slash.
Quaternion< T > Slerp(const Quaternion< T > &q0, const Quaternion< T > &q1, F32 t) noexcept
Quaternion< T > RotationFromVToU(const vec3< T > &v, const vec3< T > &u, const vec3< T > &fallbackAxis=VECTOR3_ZERO) noexcept
get the shortest arc quaternion to rotate vector 'v' to the target vector 'u'(from Ogre3D!...
vec3< Angle::RADIANS< T > > GetEuler(const Quaternion< T > &q)
vec3< T > DirectionFromAxis(const Quaternion< T > &q, const vec3< T > &AXIS) noexcept
vec3< T > DirectionFromEuler(vec3< Angle::DEGREES< T > > const &euler, const vec3< T > &FORWARD_DIRECTION)
mat3< T > GetMatrix(const Quaternion< T > &q) noexcept
static const vec3< F32 > VECTOR3_ZERO
static const vec3< F32 > WORLD_Y_AXIS
vec3< T > Rotate(vec3< T > const &v, Quaternion< T > const &q) noexcept