#include <quat.h>
Public Methods | |
QUAT (float sx=0, float sy=0, float sz=0, float sw=1) | |
~QUAT () | |
void | Reset () |
void | CopyQuat (QUAT q) |
void | Set (float sx, float sy, float sz, float sw) |
void | AxisAngleToQuat (VECTOR axis, float theta) |
void | EulerToQuat (float pitch, float yaw, float roll) |
void | NormaliseQuat () |
float | MagnitudeQuat () |
void | MultQuat (QUAT q) |
Public Attributes | |
float | x |
float | y |
float | z |
float | w |
|
Definition at line 5 of file quat.cpp.
|
|
Definition at line 14 of file quat.cpp.
00015 { 00016 } |
|
Definition at line 34 of file quat.cpp. References w, VECTOR::x, x, VECTOR::y, y, VECTOR::z, and z.
|
|
Definition at line 26 of file quat.cpp. Referenced by MultQuat().
|
|
Definition at line 45 of file quat.cpp. Referenced by OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::MoveX(), OBJECT::MoveY(), and OBJECT::Rotate().
00046 { 00047 float cr, cp, cy, sr, sp, sy, cpcy, spsy; // calculate trig identities 00048 cr = cos(roll/2); 00049 cp = cos(pitch/2); 00050 cy = cos(yaw/2); 00051 sr = sin(roll/2); 00052 sp = sin(pitch/2); 00053 sy = sin(yaw/2); 00054 cpcy = cp * cy; 00055 spsy = sp * sy; 00056 w = cr * cpcy + sr * spsy; 00057 x = sr * cpcy - cr * spsy; 00058 y = cr * sp * cy + sr * cp * sy; 00059 z = cr * cp * sy - sr * sp * cy; 00060 } |
|
Definition at line 62 of file quat.cpp. Referenced by NormaliseQuat().
|
|
Definition at line 77 of file quat.cpp. References CopyQuat(), VECTOR::CrossVector(), VECTOR::DotProduct(), w, x, VECTOR::x, y, VECTOR::y, z, and VECTOR::z. Referenced by OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::MoveX(), OBJECT::MoveY(), and OBJECT::Rotate().
00078 { 00079 QUAT q3; 00080 VECTOR vectorq1; 00081 VECTOR vectorq2; 00082 vectorq1.x = x; 00083 vectorq1.y = y; 00084 vectorq1.z = z; 00085 vectorq2.x = q.x; 00086 vectorq2.y = q.y; 00087 vectorq2.z = q.z; 00088 00089 VECTOR tempvec1; 00090 VECTOR tempvec2; 00091 VECTOR tempvec3; 00092 tempvec1 = vectorq1; 00093 q3.w = (w*q.w) - tempvec1.DotProduct(vectorq2); 00094 tempvec1.CrossVector(vectorq2); 00095 tempvec2.x = w * q.x; 00096 tempvec2.y = w * q.y; 00097 tempvec2.z = w * q.z; 00098 tempvec3.x = q.w * x; 00099 tempvec3.y = q.w * y; 00100 tempvec3.z = q.w * z; 00101 q3.x = tempvec1.x + tempvec2.x + tempvec3.x; 00102 q3.y = tempvec1.y + tempvec2.y + tempvec3.y; 00103 q3.z = tempvec1.z + tempvec2.z + tempvec3.z; 00104 CopyQuat(q3); 00105 } |
|
Definition at line 67 of file quat.cpp. References MagnitudeQuat(), w, x, y, and z.
|
|
Definition at line 18 of file quat.cpp. Referenced by OBJECT::Reset(), LIGHT::Reset(), and CAMERA::Reset().
|
|
Definition at line 16 of file quat.h.
|
|
Definition at line 26 of file quat.h. Referenced by AxisAngleToMatrix(), AxisAngleToQuat(), CopyQuat(), EulerToQuat(), EulerToQuat(), OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::GetZUnit(), MagnitudeQuat(), MagnitudeQuat(), MATRIX::MatrixFromAxisAngle(), OBJECT::MoveX(), OBJECT::MoveY(), OBJECT::MoveZ(), MultQuat(), MultQuat(), NormaliseQuat(), NormaliseQuat(), MATRIX::QuatToMatrix(), QuatToMatrix(), Reset(), and Set(). |
|
Definition at line 23 of file quat.h. Referenced by AxisAngleToMatrix(), AxisAngleToQuat(), CopyQuat(), EulerToQuat(), EulerToQuat(), OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::GetZUnit(), MagnitudeQuat(), MagnitudeQuat(), MATRIX::MatrixFromAxisAngle(), OBJECT::MoveX(), OBJECT::MoveY(), OBJECT::MoveZ(), MultQuat(), MultQuat(), NormaliseQuat(), NormaliseQuat(), MATRIX::QuatToMatrix(), QuatToMatrix(), Reset(), and Set(). |
|
Definition at line 24 of file quat.h. Referenced by AxisAngleToMatrix(), AxisAngleToQuat(), CopyQuat(), EulerToQuat(), EulerToQuat(), OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::GetZUnit(), MagnitudeQuat(), MagnitudeQuat(), MATRIX::MatrixFromAxisAngle(), OBJECT::MoveX(), OBJECT::MoveY(), OBJECT::MoveZ(), MultQuat(), MultQuat(), NormaliseQuat(), NormaliseQuat(), MATRIX::QuatToMatrix(), QuatToMatrix(), Reset(), and Set(). |
|
Definition at line 25 of file quat.h. Referenced by AxisAngleToMatrix(), AxisAngleToQuat(), CopyQuat(), EulerToQuat(), EulerToQuat(), OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::GetZUnit(), MagnitudeQuat(), MagnitudeQuat(), MATRIX::MatrixFromAxisAngle(), OBJECT::MoveX(), OBJECT::MoveY(), OBJECT::MoveZ(), MultQuat(), MultQuat(), NormaliseQuat(), NormaliseQuat(), MATRIX::QuatToMatrix(), QuatToMatrix(), Reset(), and Set(). |