#include <quat.h>
Public Methods | |
| QUAT (float sx=0, float sy=0, float sz=0, float sw=1) | |
| ~QUAT () | |
| void | Set () |
| 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 7 of file quat.cpp.
|
|
|
Definition at line 16 of file quat.cpp.
00017 {
00018 }
|
|
||||||||||||
|
Definition at line 36 of file quat.cpp. References w, VECTOR::x, x, VECTOR::y, y, VECTOR::z, and z.
|
|
|
Definition at line 28 of file quat.cpp. Referenced by MultQuat().
|
|
||||||||||||||||
|
Definition at line 47 of file quat.cpp. Referenced by OBJECT::GetXUnit(), OBJECT::GetYUnit(), OBJECT::MoveX(), OBJECT::MoveY(), and OBJECT::Rotate().
00048 {
00049 float cr, cp, cy, sr, sp, sy, cpcy, spsy; // calculate trig identities
00050 cr = cos(roll/2);
00051 cp = cos(pitch/2);
00052 cy = cos(yaw/2);
00053 sr = sin(roll/2);
00054 sp = sin(pitch/2);
00055 sy = sin(yaw/2);
00056 cpcy = cp * cy;
00057 spsy = sp * sy;
00058 w = cr * cpcy + sr * spsy;
00059 x = sr * cpcy - cr * spsy;
00060 y = cr * sp * cy + sr * cp * sy;
00061 z = cr * cp * sy - sr * sp * cy;
00062 }
|
|
|
Definition at line 64 of file quat.cpp. Referenced by NormaliseQuat().
|
|
|
Definition at line 79 of file quat.cpp. References CopyQuat(), VECTOR::CrossProduct(), 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().
00080 {
00081 QUAT q3;
00082 VECTOR vectorq1;
00083 VECTOR vectorq2;
00084 vectorq1.x = x;
00085 vectorq1.y = y;
00086 vectorq1.z = z;
00087 vectorq2.x = q.x;
00088 vectorq2.y = q.y;
00089 vectorq2.z = q.z;
00090
00091 VECTOR tempvec1;
00092 VECTOR tempvec2;
00093 VECTOR tempvec3;
00094 tempvec1 = vectorq1;
00095 q3.w = (w*q.w) - tempvec1.DotProduct(vectorq2);
00096 tempvec1.CrossProduct(vectorq2);
00097 tempvec2.x = w * q.x;
00098 tempvec2.y = w * q.y;
00099 tempvec2.z = w * q.z;
00100 tempvec3.x = q.w * x;
00101 tempvec3.y = q.w * y;
00102 tempvec3.z = q.w * z;
00103 q3.x = tempvec1.x + tempvec2.x + tempvec3.x;
00104 q3.y = tempvec1.y + tempvec2.y + tempvec3.y;
00105 q3.z = tempvec1.z + tempvec2.z + tempvec3.z;
00106 CopyQuat(q3);
00107 }
|
|
|
Definition at line 69 of file quat.cpp. References MagnitudeQuat(), w, x, y, and z.
|
|
||||||||||||||||||||
|
Definition at line 17 of file quat.h.
|
|
|
Definition at line 20 of file quat.cpp. Referenced by OBJECT::Set(), and CAMERA::Set().
|
|
|
Definition at line 27 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(), 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(), 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(), and Set(). |
|
|
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(), and Set(). |
1.2.15