28#ifndef INCLUDED_OOMATHS_h
29 #error Do not include OOQuaternion.h directly; include OOMaths.h.
33typedef struct Quaternion
61#if !OOMATHS_STANDALONE
99NSString *QuaternionDescription(Quaternion quaternion);
121OOINLINE bool quaternion_equal(Quaternion a, Quaternion b)
123 return a.w == b.w && a.x == b.x && a.y == b.y && a.z == b.z;
127OOINLINE Quaternion quaternion_negate(Quaternion q)
129 return make_quaternion(-q.w, -q.x, -q.y, -q.z);
133OOINLINE Quaternion quaternion_conjugate(Quaternion q)
135 return make_quaternion(q.w, -q.x, -q.y, -q.z);
139OOINLINE void quaternion_set_rotate_about_axis(Quaternion *quat, Vector axis,
OOScalar angle)
145 quat->x = axis.x * scale;
146 quat->y = axis.y * scale;
147 quat->z = axis.z * scale;
153 return q1.w*q2.w + q1.x*q2.x + q1.y*q2.y + q1.z*q2.z;
157OOINLINE void quaternion_normalize(Quaternion *quat)
173#if !OOMATHS_STANDALONE
174OOINLINE Quaternion OORandomQuaternion(
void)
#define ALWAYS_INLINE_FUNC
#define INLINE_CONST_FUNC
Vector vector_up_from_quaternion(Quaternion quat)
void quaternion_rotate_about_x(Quaternion *quat, OOScalar angle)
HPVector HPvector_forward_from_quaternion(Quaternion quat)
Vector vector_right_from_quaternion(Quaternion quat)
Vector vector_forward_from_quaternion(Quaternion quat)
void basis_vectors_from_quaternion(Quaternion quat, Vector *outRight, Vector *outUp, Vector *outForward)
void quaternion_rotate_about_z(Quaternion *quat, OOScalar angle)
HPVector quaternion_rotate_HPvector(Quaternion q, HPVector v)
void quaternion_set_random(Quaternion *quat)
Vector quaternion_rotate_vector(Quaternion q, Vector v)
const Quaternion kIdentityQuaternion
Quaternion quaternion_rotation_between(Vector v0, Vector v1)
void quaternion_rotate_about_y(Quaternion *quat, OOScalar angle)
Quaternion quaternion_limited_rotation_between(Vector v0, Vector v1, float maxArc)
const Quaternion kZeroQuaternion
Quaternion quaternion_rotation_betweenHP(HPVector v0, HPVector v1)
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle)
Quaternion quaternion_multiply(Quaternion q1, Quaternion q2)