Support for 3D spatial rotations using normalized quaternions. More...
Functions | |
template<class T > | |
constexpr vec< T, 3 > | qxdir (const vec< T, 4 > &q) |
efficient shorthand for qrot(q, {1,0,0}) | |
template<class T > | |
constexpr vec< T, 3 > | qydir (const vec< T, 4 > &q) |
efficient shorthand for qrot(q, {0,1,0}) | |
template<class T > | |
constexpr vec< T, 3 > | qzdir (const vec< T, 4 > &q) |
efficient shorthand for qrot(q, {0,0,1}) | |
template<class T > | |
constexpr mat< T, 3, 3 > | qmat (const vec< T, 4 > &q) |
Create an equivalent mat3 rotation matrix from the input quaternion. | |
template<class T > | |
constexpr vec< T, 3 > | qrot (const vec< T, 4 > &q, const vec< T, 3 > &v) |
Rotate a vector by a quaternion. | |
template<class T > | |
T | qangle (const vec< T, 4 > &q) |
Return the angle in radians of the axis-angle representation of the input normalized quaternion. | |
template<class T > | |
vec< T, 3 > | qaxis (const vec< T, 4 > &q) |
Return the normalized axis of the axis-angle representation of the input normalized quaternion. | |
template<class T > | |
vec< T, 4 > | qnlerp (const vec< T, 4 > &a, const vec< T, 4 > &b, T t) |
Linear interpolation that takes the shortest path - this is not geometrically sensible, consider qslerp instead. | |
template<class T > | |
vec< T, 4 > | qslerp (const vec< T, 4 > &a, const vec< T, 4 > &b, T t) |
Spherical linear interpolation that takes the shortest path. | |
template<class T > | |
vec< T, 4 > constexpr | rotation_quat (const vec< T, 3 > &axis, T angle) |
Returns a normalized quaternion representing a rotation by angle in radians about the provided axis. | |
template<class T > | |
vec< T, 4 > | rotation_quat (const vec< T, 3 > &orig, const vec< T, 3 > &dest) |
Returns a normalized quaternion representing the shortest rotation from orig vector to dest vector. | |
template<class T > | |
vec< T, 4 > | rotation_quat (const mat< T, 3, 3 > &m) |
Returns a normalized quaternion representing the input rotation matrix, which should be orthonormal. | |
Support for 3D spatial rotations using normalized quaternions.