![]() |
SH4ZAM! 0.1.0
Fast math library for the Sega Dreamcast's SH4 CPU
|
#include <shz_quat.hpp>


Public Member Functions | |
| quat | operator- () const noexcept |
| quat | operator+= (quat rhs) noexcept |
| quat | operator-= (quat rhs) noexcept |
| quat | operator*= (quat rhs) noexcept |
| quat | operator/= (quat rhs) noexcept |
| quat | operator*= (float rhs) noexcept |
| quat | operator/= (float rhs) noexcept |
Properties | |
Routines for accessing or extracting values. | |
| float | angle () const noexcept |
| vec3 | axis () const noexcept |
| float | angle_x () const noexcept |
| float | angle_y () const noexcept |
| float | angle_z () const noexcept |
| float | magnitude_sqr () const noexcept |
| float | magnitude () const noexcept |
| float | magnitude_inv () const noexcept |
Conversions | |
Routines for converting to other types. | |
| vec3 | to_angles_xyz () const noexcept |
| void | to_axis_angle (shz_vec3_t *axis, float *angle) const noexcept |
| auto | to_axis_angle () const noexcept -> std::pair< vec3, float > |
Modifiers | |
Routines for applying modifiers to an existing quaternion. | |
| quat | normalized () const noexcept |
| void | normalize () noexcept |
| quat | normalized_safe () const noexcept |
| void | normalize_safe () noexcept |
| quat | conjugated () const noexcept |
| void | conjugate () noexcept |
| quat | inverse () const noexcept |
| void | invert () noexcept |
| quat | negated () const noexcept |
| void | negate () noexcept |
Arithmetic | |
Routines performing calculations with quaternions. | |
| quat | add (quat rhs) const noexcept |
| quat | sub (quat rhs) const noexcept |
| quat | scaled (float s) const noexcept |
| void | scale (float s) noexcept |
| float | dot (quat other) const noexcept |
| vec2 | dot (quat q1, quat q2) const noexcept |
| vec3 | dot (quat q1, quat q2, quat q3) const noexcept |
| quat | mult (quat rhs) const noexcept |
| quat | div (quat rhs) const noexcept |
Miscellaneous | |
Other types of quaternion operations. | |
| float | angle_between (quat p) const noexcept |
| quat | rotate_towards (shz_quat_t to, float max_angle) const noexcept |
Transformations | |
Routines for applying quaternion transforms. | |
| vec3 | transform (vec3 in) const noexcept |
Static Public Attributes | |
| static constexpr float | slerp_phi_epsilon |
Friends | |
| bool | operator== (quat lhs, quat rhs) noexcept |
Initialization | |
Routines for creating and initializing quaternions. | |
| quat () noexcept=default | |
| quat (float w, float x, float y, float z) noexcept | |
| quat (shz_quat_t q) noexcept | |
| static quat | identity () noexcept |
| static quat | from_angles_xyz (float x, float y, float z) noexcept |
| static quat | from_axis_angle (vec3 axis, float angle) noexcept |
| static quat | from_look_axis (vec3 forward, vec3 up) noexcept |
| static quat | from_rotated_axis (vec3 start, vec3 end) noexcept |
| static quat | lerp (quat q, quat p, float t) noexcept |
| static quat | nlerp (quat q, quat p, float t) noexcept |
| static quat | slerp (quat q, quat p, float t) noexcept |
| static quat | squad (quat q1, quat q2, quat s1, quat s2, float t) noexcept |
Additional Inherited Members | ||
Data Fields inherited from shz_quat_t | ||
| union { | ||
| struct { | ||
| float w | ||
| union { | ||
| struct { | ||
| float x | ||
| float y | ||
| float z | ||
| } | ||
| shz_vec3_t axis | ||
| } | ||
| } | ||
| float e [4] | ||
| }; | ||
C++ structure representing a quaternion.
A quaternion represents a rotation about an arbitrary axis in 3D space.
Definition at line 38 of file shz_quat.hpp.
|
defaultnoexcept |
Default constructor: does nothing.
|
inlinenoexcept |
Value constructor: initializes a quaternion with the given values for each component.
Definition at line 51 of file shz_quat.hpp.
|
inlinenoexcept |
C Converting constructor: constructs a C++ shz::quat from a C shz_quat_t.
Definition at line 55 of file shz_quat.hpp.
|
inlinestaticnoexcept |
Returns an identity quaternion.
Definition at line 59 of file shz_quat.hpp.
|
inlinestaticnoexcept |
C++ convenience wrapper for shz_quat_from_angles_xyz().
Definition at line 64 of file shz_quat.hpp.
Initializes a quaternion which is a rotation in angle radians about the given axis.
Definition at line 69 of file shz_quat.hpp.
Creates a quaternion looking in the given direction with the given reference direction.
Definition at line 74 of file shz_quat.hpp.
Returns the quaternion representing the rotation from the start to the end axes.
Definition at line 79 of file shz_quat.hpp.
Returns the quaternion that is linearly interpolating q to p, by a t factor of 0.0f-1.0f.
Definition at line 84 of file shz_quat.hpp.
Equivalent to lerp(), except that the resulting quaternion is normalized.
Definition at line 89 of file shz_quat.hpp.
Returns the quaternion that is spherically linearly interpolating q to p, by a t factor of 0.0f-1.0f.
Definition at line 94 of file shz_quat.hpp.
Evaluates the smooth cubic spherical interpolation (SQUAD) at parameter t.
Definition at line 99 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the angle of rotation represented by the given quaternion.
Definition at line 158 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the axis of rotation represented by the given quaternion.
Definition at line 163 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the angle of rotation about the X axis represented by the given quaternion.
Definition at line 168 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the angle of rotation about the Y axis represented by the given quaternion.
Definition at line 173 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the angle of rotation about the Z axis represented by the given quaternion.
Definition at line 178 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the magnitude of the quaternion squared.
Definition at line 183 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the magnitude of the quaternion.
Definition at line 188 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the inverse of the magnitude of the quaternion.
Definition at line 193 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the tait-bryan rotation angles about the X, Y, then Z axes which are represented by the given quaternion.
Definition at line 205 of file shz_quat.hpp.
|
inlinenoexcept |
Returns both the axis and angle of rotation through the pointer arguments.
Definition at line 210 of file shz_quat.hpp.
|
inlinenoexcept |
Returns both the axis and angle of rotation as a std::pair.
Definition at line 215 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the given quaternion as a unit quaternion.
Definition at line 229 of file shz_quat.hpp.
|
inlinenoexcept |
Normalizes the given quaternion.
Definition at line 234 of file shz_quat.hpp.
|
inlinenoexcept |
Returns a safely normalized quaternion from the given quaternion, protecting against division-by-zero.
Definition at line 239 of file shz_quat.hpp.
|
inlinenoexcept |
Safely normalizes the given quaternion by protecting against division-by-zero.
Definition at line 244 of file shz_quat.hpp.
|
inlinenoexcept |
Returns a quaternion that is the conjugate of the given quaternion.
Definition at line 249 of file shz_quat.hpp.
|
inlinenoexcept |
Conjugates the given quaternion.
Definition at line 254 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the inverse of the given quaternion.
Definition at line 259 of file shz_quat.hpp.
|
inlinenoexcept |
Inverts the given quaternion.
Definition at line 264 of file shz_quat.hpp.
|
inlinenoexcept |
Returns a new quaternion whose components are the negated values of the given quaternion.
Definition at line 269 of file shz_quat.hpp.
|
inlinenoexcept |
Negates the components of the given quaternion.
Definition at line 274 of file shz_quat.hpp.
Returns a new quaternion from adding the given quaterion to rhs.
Definition at line 286 of file shz_quat.hpp.
Returns a new quaternion from adding rhs from the given quaternion.
Definition at line 291 of file shz_quat.hpp.
|
inlinenoexcept |
Returns a new quaternion from scaling the given quaterion by s.
Definition at line 296 of file shz_quat.hpp.
|
inlinenoexcept |
Multiplies each component of the given quaternion by s.
Definition at line 301 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the dot product between the given quaternion and another.
Definition at line 306 of file shz_quat.hpp.
Returns the dot product of the given quaternion against two others.
Definition at line 311 of file shz_quat.hpp.
Returns the dot product of the given quaternion against three others.
Definition at line 316 of file shz_quat.hpp.
Returns a new quaterion from multiplying the given quaternion by another.
Definition at line 321 of file shz_quat.hpp.
Returns a new quaterion from dividing the given quaternion by another (or multiplying the given quaternion by the inverse of another).
Definition at line 326 of file shz_quat.hpp.
|
inlinenoexcept |
Returns the angle in radians between the rotations represented by quaternions q and p.
Definition at line 338 of file shz_quat.hpp.
|
inlinenoexcept |
Rotates quaternion from towards quaternion to by at most max_angle radians.
Definition at line 343 of file shz_quat.hpp.
Returns a new shz::vec3 from transforming in by the given quaternion.
Definition at line 355 of file shz_quat.hpp.
|
inlinenoexcept |
Overloaded unary negation operator, returns the negation of the given quaternion.
Definition at line 362 of file shz_quat.hpp.
Adds and accumulates rhs onto the given quaternion.
Definition at line 367 of file shz_quat.hpp.
Subtracts rhs from the given quaternion.
Definition at line 372 of file shz_quat.hpp.
Multiplies and accumulates rhs into the given quaternion.
Definition at line 377 of file shz_quat.hpp.
Divides the given quaternion by rhs.
Definition at line 382 of file shz_quat.hpp.
|
inlinenoexcept |
Multiplies and accumulates each component of the given quaternion by rhs.
Definition at line 387 of file shz_quat.hpp.
|
inlinenoexcept |
Divides each component of the given quaternion by rhs.
Definition at line 393 of file shz_quat.hpp.
Overloaded comparison operator, checks for quaternion equality.
Definition at line 146 of file shz_quat.hpp.
|
staticconstexpr |
Minimum epsilon for bothering to interpolate in shz::quat::slerp().
Definition at line 40 of file shz_quat.hpp.