![]() |
SH4ZAM! 0.1.0
Fast math library for the Sega Dreamcast's SH4 CPU
|


Go to the source code of this file.
Data Structures | |
| struct | shz_quat_t |
Macros | |
| #define | SHZ_QUAT_SLERP_PHI_EPSILON |
Typedefs | |
| typedef shz_quat_t | shz_quat |
Functions | |
| shz_vec3_t | shz_quat_transform_vec3 (shz_quat_t q, shz_vec3_t v) SHZ_NOEXCEPT |
Initialization | |
Routines for creating and initializing quaternions. | |
| shz_quat_t | shz_quat_init (float w, float x, float y, float z) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_identity (void) SHZ_NOEXCEPT |
| bool | shz_quat_equal (shz_quat_t a, shz_quat_t b) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_from_angles_xyz (float xangle, float yangle, float zangle) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_from_axis_angle (shz_vec3_t axis, float angle) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_from_look_axis (shz_vec3_t forward, shz_vec3_t up) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_from_rotated_axis (shz_vec3_t v1, shz_vec3_t v2) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_lerp (shz_quat_t a, shz_quat_t b, float t) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_nlerp (shz_quat_t a, shz_quat_t b, float t) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_slerp (shz_quat_t q, shz_quat_t p, float t) SHZ_NOEXCEPT |
Properties | |
Routines returning derived values from a quaternion. | |
| float | shz_quat_angle (shz_quat_t q) SHZ_NOEXCEPT |
| shz_vec3_t | shz_quat_axis (shz_quat_t q) SHZ_NOEXCEPT |
| float | shz_quat_angle_x (shz_quat_t q) SHZ_NOEXCEPT |
| float | shz_quat_angle_y (shz_quat_t q) SHZ_NOEXCEPT |
| float | shz_quat_angle_z (shz_quat_t q) SHZ_NOEXCEPT |
| void | shz_quat_to_axis_angle (shz_quat_t q, shz_vec3_t *vec, float *angle) SHZ_NOEXCEPT |
| shz_vec3_t | shz_quat_to_angles_xyz (shz_quat_t q) SHZ_NOEXCEPT |
| float | shz_quat_magnitude_sqr (shz_quat_t quat) SHZ_NOEXCEPT |
| float | shz_quat_magnitude (shz_quat_t quat) SHZ_NOEXCEPT |
| float | shz_quat_magnitude_inv (shz_quat_t quat) SHZ_NOEXCEPT |
Modifiers | |
Routines for returning new quaternions derived from existing ones. | |
| shz_quat_t | shz_quat_normalize (shz_quat_t quat) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_normalize_safe (shz_quat_t quat) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_conjugate (shz_quat_t quat) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_inv (shz_quat_t quat) SHZ_NOEXCEPT |
Arithmetic | |
Routines performing calculations with quaternions. | |
| shz_quat_t | shz_quat_add (shz_quat_t q, shz_quat_t p) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_scale (shz_quat_t q, float f) SHZ_NOEXCEPT |
| shz_quat_t | shz_quat_mult (shz_quat_t q1, shz_quat_t q2) SHZ_NOEXCEPT |
| float | shz_quat_dot (shz_quat_t q1, shz_quat_t q2) SHZ_NOEXCEPT |
| shz_vec2_t | shz_quat_dot2 (shz_quat_t l, shz_quat_t r1, shz_quat_t r2) SHZ_NOEXCEPT |
| shz_vec3_t | shz_quat_dot3 (shz_quat_t l, shz_quat_t r1, shz_quat_t r2, shz_quat_t r3) SHZ_NOEXCEPT |
Routines for operating upon quaternions.
This file contains the public type(s) and interface providing the quaternion math API.
Definition in file shz_quat.h.
| #define SHZ_QUAT_SLERP_PHI_EPSILON |
Minimum epsilon below which shz_quat_slerp() performs no interpolation.
Definition at line 30 of file shz_quat.h.
| typedef shz_quat_t shz_quat |
Alternate shz_quat_t C typedef for those who hate POSIX style.
Definition at line 57 of file shz_quat.h.
| shz_quat_t shz_quat_init | ( | float | w, |
| float | x, | ||
| float | y, | ||
| float | z ) |
Initializes and returns a new quaternion with the given components, in WXYZ order.
| shz_quat_t shz_quat_identity | ( | void | ) |
Initializes and returns an identity quaternion.
| bool shz_quat_equal | ( | shz_quat_t | a, |
| shz_quat_t | b ) |
Returns true if the two given quaternions are considered equal based on either absolute or relative tolerance.
| shz_quat_t shz_quat_from_angles_xyz | ( | float | xangle, |
| float | yangle, | ||
| float | zangle ) |
Initializes and returns a quaternion with the given X-Y-Z rotations in radians.
The rotation is applied first around the X-axis, then the Y-, then the Z-axis.
| shz_quat_t shz_quat_from_axis_angle | ( | shz_vec3_t | axis, |
| float | angle ) |
Initializes and returns a quaternion representing a rotation of angle radians about the given axis.
| shz_quat_t shz_quat_from_look_axis | ( | shz_vec3_t | forward, |
| shz_vec3_t | up ) |
Creates a quaternion looking in the given direction with the given reference direction.
| shz_quat_t shz_quat_from_rotated_axis | ( | shz_vec3_t | v1, |
| shz_vec3_t | v2 ) |
Returns the quaternion representing the rotation from axis v1 to v2.
| shz_quat_t shz_quat_lerp | ( | shz_quat_t | a, |
| shz_quat_t | b, | ||
| float | t ) |
Returns the quaternion that is linearly interpolating a to b, by a t factor of 0.0f-1.0f.
| shz_quat_t shz_quat_nlerp | ( | shz_quat_t | a, |
| shz_quat_t | b, | ||
| float | t ) |
Equivalent to shz_quat_lerp(), except that the resulting quaternion is normalized.
| shz_quat_t shz_quat_slerp | ( | shz_quat_t | q, |
| shz_quat_t | p, | ||
| float | t ) |
Returns the quaternion that is spherically linearly interpolating a to b, by a t factor of 0.0f-1.0f.
| float shz_quat_angle | ( | shz_quat_t | q | ) |
Returns the angle of rotation from the given quaternion.
| shz_vec3_t shz_quat_axis | ( | shz_quat_t | q | ) |
Returns the axis of rotation from the given quaternion.
| void shz_quat_to_axis_angle | ( | shz_quat_t | q, |
| shz_vec3_t * | vec, | ||
| float * | angle ) |
Returns both the axis and angle of rotation simultaneously (faster if both are needed) from the given quaternion.
| shz_vec3_t shz_quat_to_angles_xyz | ( | shz_quat_t | q | ) |
Returns the roll, pitch, and yaw angles of rotation represented by the given quaternion.
| float shz_quat_magnitude_sqr | ( | shz_quat_t | quat | ) |
Returns the squared magnitude of the given quaternion.
| float shz_quat_magnitude | ( | shz_quat_t | quat | ) |
Returns the magnitude of the given quaternion.
| float shz_quat_magnitude_inv | ( | shz_quat_t | quat | ) |
Returns the inverse magnitude of the given quaternion.
| shz_quat_t shz_quat_normalize | ( | shz_quat_t | quat | ) |
Returns the normalized form of the given quaternion.
| shz_quat_t shz_quat_normalize_safe | ( | shz_quat_t | quat | ) |
SAFELY returns the normalized form of the given quaternion.
Returns the identity quaternion when magnitude is 0.0f.
| shz_quat_t shz_quat_conjugate | ( | shz_quat_t | quat | ) |
Returns the conjugate of the given quaternion.
| shz_quat_t shz_quat_inv | ( | shz_quat_t | quat | ) |
Returns the inverse of the given quaternion.
| shz_quat_t shz_quat_add | ( | shz_quat_t | q, |
| shz_quat_t | p ) |
Returns the quaternion produced from adding each component of the given quaternions.
| shz_quat_t shz_quat_scale | ( | shz_quat_t | q, |
| float | f ) |
Scales the components of the given quaternion by the given factor.
| shz_quat_t shz_quat_mult | ( | shz_quat_t | q1, |
| shz_quat_t | q2 ) |
Multiplies the two quaternions, returning the result as a new quaternion.
| float shz_quat_dot | ( | shz_quat_t | q1, |
| shz_quat_t | q2 ) |
Returns the dot product of the two quaternions.
| shz_vec2_t shz_quat_dot2 | ( | shz_quat_t | l, |
| shz_quat_t | r1, | ||
| shz_quat_t | r2 ) |
Returns the two dot products taken between the l quaternion and the r1 and r2 quaternions.
| shz_vec3_t shz_quat_dot3 | ( | shz_quat_t | l, |
| shz_quat_t | r1, | ||
| shz_quat_t | r2, | ||
| shz_quat_t | r3 ) |
Returns the two dot products taken between the l quaternion and the r1, r2, and r3 quaternions.
| shz_vec3_t shz_quat_transform_vec3 | ( | shz_quat_t | q, |
| shz_vec3_t | v ) |
Rotates a vector by the given quaternion.