2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
26
27
35
36
37
38
60
61
62
65SHZ_FORCE_INLINE shz_quat_t
shz_quat_init(
float w,
float x,
float y,
float z) SHZ_NOEXCEPT;
71SHZ_FORCE_INLINE
bool shz_quat_equal(shz_quat_t a, shz_quat_t b) SHZ_NOEXCEPT;
74
75
76
77
78
79
80
93SHZ_INLINE shz_quat_t
shz_quat_lerp(shz_quat_t a, shz_quat_t b,
float t) SHZ_NOEXCEPT;
96SHZ_FORCE_INLINE shz_quat_t
shz_quat_nlerp(shz_quat_t a, shz_quat_t b,
float t) SHZ_NOEXCEPT;
99
100
101
102
103SHZ_INLINE shz_quat_t
shz_quat_slerp(shz_quat_t q, shz_quat_t p,
float t) SHZ_NOEXCEPT;
108
109
110
119SHZ_INLINE
float shz_quat_angle_x(shz_quat_t q) SHZ_NOEXCEPT;
122SHZ_INLINE
float shz_quat_angle_y(shz_quat_t q) SHZ_NOEXCEPT;
125SHZ_INLINE
float shz_quat_angle_z(shz_quat_t q) SHZ_NOEXCEPT;
145
146
147
153
154
155
167
168
169
172SHZ_FORCE_INLINE shz_quat_t
shz_quat_add(shz_quat_t q, shz_quat_t p) SHZ_NOEXCEPT;
178SHZ_INLINE shz_quat_t
shz_quat_mult(shz_quat_t q1, shz_quat_t q2) SHZ_NOEXCEPT;
181SHZ_FORCE_INLINE
float shz_quat_dot(shz_quat_t q1, shz_quat_t q2) SHZ_NOEXCEPT;
184SHZ_FORCE_INLINE shz_vec2_t
shz_quat_dot2(shz_quat_t l, shz_quat_t r1, shz_quat_t r2) SHZ_NOEXCEPT;
187SHZ_FORCE_INLINE shz_vec3_t
shz_quat_dot3(shz_quat_t l, shz_quat_t r1, shz_quat_t r2, shz_quat_t r3) SHZ_NOEXCEPT;
192
193
194
195
196
197
198
199
202#include "inline/shz_quat.inl.h"
float shz_quat_magnitude_sqr(shz_quat_t quat) SHZ_NOEXCEPT
Returns the squared magnitude of the given quaternion.
float shz_quat_magnitude(shz_quat_t quat) SHZ_NOEXCEPT
Returns the magnitude of the given quaternion.
shz_vec3_t shz_quat_axis(shz_quat_t q) SHZ_NOEXCEPT
Returns the axis of rotation from the given quaternion.
shz_quat_t shz_quat_inv(shz_quat_t quat) SHZ_NOEXCEPT
Returns the inverse of the given quaternion.
shz_quat_t shz_quat
Alternate shz_quat_t C typedef for those who hate POSIX style.
shz_quat_t shz_quat_nlerp(shz_quat_t a, shz_quat_t b, float t) SHZ_NOEXCEPT
Equivalent to shz_quat_lerp(), except that the resulting quaternion is normalized.
shz_quat_t shz_quat_from_axis_angle(shz_vec3_t axis, float angle) SHZ_NOEXCEPT
Initializes and returns a quaternion representing a rotation of angle radians about the given axis.
shz_quat_t shz_quat_scale(shz_quat_t q, float f) SHZ_NOEXCEPT
Scales the components of the given quaternion by the given factor.
bool shz_quat_equal(shz_quat_t a, shz_quat_t b) SHZ_NOEXCEPT
Returns true if the two given quaternions are considered equal based on either absolute or relative t...
shz_quat_t shz_quat_from_look_axis(shz_vec3_t forward, shz_vec3_t up) SHZ_NOEXCEPT
Creates a quaternion looking in the given direction with the given reference direction.
shz_vec3_t shz_quat_transform_vec3(shz_quat_t q, shz_vec3_t v) SHZ_NOEXCEPT
Rotates a vector by the given quaternion.
shz_quat_t shz_quat_add(shz_quat_t q, shz_quat_t p) SHZ_NOEXCEPT
Returns the quaternion produced from adding each component of the given quaternions.
float shz_quat_magnitude_inv(shz_quat_t quat) SHZ_NOEXCEPT
Returns the inverse magnitude of the given quaternion.
shz_quat_t shz_quat_from_rotated_axis(shz_vec3_t v1, shz_vec3_t v2) SHZ_NOEXCEPT
Returns the quaternion representing the rotation from axis v1 to v2.
float shz_quat_angle(shz_quat_t q) SHZ_NOEXCEPT
Returns the angle of rotation from the given quaternion.
shz_quat_t shz_quat_slerp(shz_quat_t q, shz_quat_t p, float t) SHZ_NOEXCEPT
Returns the quaternion that is spherically linearly interpolating a to b, by a t factor of 0....
shz_quat_t shz_quat_normalize_safe(shz_quat_t quat) SHZ_NOEXCEPT
SAFELY returns the normalized form of the given quaternion.
shz_quat_t shz_quat_lerp(shz_quat_t a, shz_quat_t b, float t) SHZ_NOEXCEPT
Returns the quaternion that is linearly interpolating a to b, by a t factor of 0.0f-1....
shz_vec3_t shz_quat_to_angles_xyz(shz_quat_t q) SHZ_NOEXCEPT
Returns the roll, pitch, and yaw angles of rotation represented by the given quaternion.
shz_vec2_t shz_quat_dot2(shz_quat_t l, shz_quat_t r1, shz_quat_t r2) SHZ_NOEXCEPT
Returns the two dot products taken between the l quaternion and the r1 and r2 quaternions.
shz_quat_t shz_quat_normalize(shz_quat_t quat) SHZ_NOEXCEPT
Returns the normalized form of the given quaternion.
float shz_quat_dot(shz_quat_t q1, shz_quat_t q2) SHZ_NOEXCEPT
Returns the dot product of the two quaternions.
shz_quat_t shz_quat_identity(void) SHZ_NOEXCEPT
Initializes and returns an identity quaternion.
void shz_quat_to_axis_angle(shz_quat_t q, shz_vec3_t *vec, float *angle) SHZ_NOEXCEPT
Returns both the axis and angle of rotation simultaneously (faster if both are needed) from the given...
shz_quat_t shz_quat_init(float w, float x, float y, float z) SHZ_NOEXCEPT
Initializes and returns a new quaternion with the given components, in WXYZ order.
shz_vec3_t shz_quat_dot3(shz_quat_t l, shz_quat_t r1, shz_quat_t r2, shz_quat_t r3) SHZ_NOEXCEPT
Returns the two dot products taken between the l quaternion and the r1, r2, and r3 quaternions.
shz_quat_t shz_quat_from_angles_xyz(float xangle, float yangle, float zangle) SHZ_NOEXCEPT
Initializes and returns a quaternion with the given X-Y-Z rotations in radians.
shz_quat_t shz_quat_conjugate(shz_quat_t quat) SHZ_NOEXCEPT
Returns the conjugate of the given quaternion.
shz_quat_t shz_quat_mult(shz_quat_t q1, shz_quat_t q2) SHZ_NOEXCEPT
Multiplies the two quaternions, returning the result as a new quaternion.
#define SHZ_FLT_EPSILON
Floating-point epsilon used with inexact FP-based comparisons.
Represents a 3D quaternion.
float e[4]
Array-indexed components.
float z
Z component of axis of rotation (imaginary)
float w
< Anonymous structure with named components.
float y
Y component of axis of rotation (imaginary)
shz_vec3_t axis
3D vector representing axis of rotation
float x
X component of axis of rotation (imaginary)