49 SkelQuat(SkelVec3 vec);
50 SkelQuat(SkelMat3 mat3);
51 SkelQuat(SkelMat4 mat4);
52 SkelQuat(
float x,
float y,
float z,
float w);
53 SkelQuat(
float *quat);
54 SkelQuat(
const float *quat);
55 SkelQuat(
float w,
const SkelVec3 *vec);
57 float& operator[](
int index);
58 float operator[](
int index)
const;
61 operator float *()
const;
63 void Set(
float x,
float y,
float z,
float w);
64 void Set(SkelVec4 vec4);
65 void Set(
float *quat);
66 void SetAngle(
float a);
67 void SetAxis(SkelVec3 vec);
71 float LengthSquared()
const;
74 void GetMat3(SkelMat3& mat3)
const;
75 void GetMat4(SkelMat4& mat4)
const;
76 void GetEulerAngles(
float *angles)
const;
83inline SkelQuat::SkelQuat()
88inline SkelQuat::SkelQuat(
SkelVec3 vec)
90 EulerToQuat(vec.val, val);
93inline SkelQuat::SkelQuat(
SkelMat3 mat3)
95 MatToQuat(mat3.val, val);
98inline SkelQuat::SkelQuat(
SkelMat4 mat4)
100 MatToQuat(mat4.val, val);
103inline SkelQuat::SkelQuat(
float x,
float y,
float z,
float w)
108inline SkelQuat::SkelQuat(
float *quat)
116inline SkelQuat::SkelQuat(
const float *quat)
124inline SkelQuat::SkelQuat(
float w,
const SkelVec3 *vec)
132inline void SkelQuat::Set(
float x,
float y,
float z,
float w)
140inline void SkelQuat::Set(
SkelVec4 vec4)
142 val[0] = vec4.val[0];
143 val[1] = vec4.val[1];
144 val[2] = vec4.val[2];
145 val[3] = vec4.val[3];
148inline void SkelQuat::Set(
float *quat)
156inline void SkelQuat::SetAngle(
float a)
160 EulerToQuat(vec.val, val);
163inline void SkelQuat::SetAxis(
SkelVec3 vec)
165 EulerToQuat(vec.val, val);
168inline void SkelQuat::Invert()
173inline float SkelQuat::Length()
const
175 return (
float)sqrt(val[0] * val[0] + val[1] * val[1] + val[2] * val[2] + val[3] * val[3]);
178inline float SkelQuat::LengthSquared()
const
180 return val[0] * val[0] + val[1] * val[1] + val[2] * val[2] + val[3] * val[3];
183inline void SkelQuat::Normalize()
185 VectorNormalize(val);
188inline void SkelQuat::GetMat3(
SkelMat3& mat3)
const
190 QuatToMat(val, mat3.val);
193inline void SkelQuat::GetMat4(
SkelMat4& mat4)
const
195 QuatToMat(val, mat4.val);
198inline void SkelQuat::GetEulerAngles(
float *angles)
const
200 QuatToAngles(val, angles);
203inline bool SkelQuat::IsUnit()
const
209inline void SkelQuat::MakeIdentity()
217inline bool SkelQuat::IsIdentity()
219 return (x == 0.0f) && (y == 0.0f) && (z == 0.0f) && (w == 1.0f);
222inline bool SkelQuat::IsValid()
const
230 static_assert(
sizeof(float) ==
sizeof(int),
"Float must be the same size as Int");
234 f = from.x * to.x + from.y * to.y + from.z * to.z + from.w * to.w;
238 *(
int *)&f = (*(
int *)&f & 0x80000000) ^ *(
int *)&f2;
240 out->x = to.x * t + from.x * f;
241 out->y = to.y * t + from.y * f;
242 out->z = to.z * t + from.z * f;
243 out->w = to.w * t + from.w * f;
245 f = 1.0 / out->Length();
252inline SkelQuat::operator
float *()
257inline SkelQuat::operator
float *()
const
262inline float& SkelQuat::operator[](
int index)
267inline float SkelQuat::operator[](
int index)
const
Definition SkelMat3.h:192
Definition SkelMat4.h:355
Definition SkelQuat.h:274
Definition SkelVec3.h:197