29 #include "../precompiled.h"
47 for ( i = 0; i < 3; i++ ) {
48 if ( ( (*
this)[i] >= 360.0
f ) || ( (*
this)[i] < 0.0
f ) ) {
49 (*this)[
i] -= floor( (*
this)[i] / 360.0
f ) * 360.0f;
51 if ( (*
this)[i] >= 360.0
f ) {
54 if ( (*
this)[i] < 0.0
f ) {
81 if (
roll > 180.0
f ) {
93 float sr,
sp, sy, cr, cp, cy;
100 forward->
Set( cp * cy, cp * sy, -sp );
104 right->
Set( -sr * sp * cy + cr * sy, -sr * sp * sy + -cr * cy, -sr * cp );
108 up->
Set( cr * sp * cy + -sr * -sy, cr * sp * sy + -sr * cy, cr * cp );
118 float sp, sy, cp, cy;
123 return idVec3( cp * cy, cp * sy, -sp );
132 float sx, cx, sy, cy, sz, cz;
133 float sxcy, cxcy, sxsy, cxsy;
144 return idQuat( cxsy*sz - sxcy*cz, -cxsy*cz - sxcy*sz, sxsy*cz - cxcy*sz, cxcy*cz + sxsy*sz );
155 float sx, cx, sy, cy, sz, cz;
156 float sxcy, cxcy, sxsy, cxsy;
162 if (
roll == 0.0
f ) {
165 }
else if (
yaw == 0.0
f &&
roll == 0.0
f ) {
178 vec.
x = cxsy * sz - sxcy * cz;
179 vec.
y = -cxsy * cz - sxcy * sz;
180 vec.
z = sxsy * cz - cxcy * sz;
181 w = cxcy * cz + sxsy * sz;
183 if ( angle == 0.0f ) {
184 vec.
Set( 0.0f, 0.0f, 1.0f );
201 float sr,
sp, sy, cr, cp, cy;
207 mat[ 0 ].Set( cp * cy, cp * sy, -sp );
208 mat[ 1 ].Set( sr * sp * cy + cr * -sy, sr * sp * sy + cr * cy, sr * cp );
209 mat[ 2 ].Set( cr * sp * cy + -sr * -sy, cr * sp * sy + -sr * cy, cr * cp );
idAngles & Normalize360(void)
const char * ToString(int precision=2) const
void Set(const float x, const float y, const float z)
idMat4 ToMat4(void) const
static const char * FloatArrayToString(const float *array, const int length, const int precision)
idAngles ang_zero(0.0f, 0.0f, 0.0f)
idAngles & Normalize180(void)
static void SinCos(float a, float &s, float &c)
static const float M_RAD2DEG
float GetAngle(void) const
GLubyte GLubyte GLubyte GLubyte w
int GetDimension(void) const
idVec3 ToForward(void) const
idVec3 vec3_origin(0.0f, 0.0f, 0.0f)
idQuat ToQuat(void) const
bool FixDegenerateNormal(void)
const idVec3 & GetVec(void) const
idMat3 ToMat3(void) const
const float * ToFloatPtr(void) const
idVec3 ToAngularVelocity(void) const
static float ACos(float a)
void ToVectors(idVec3 *forward, idVec3 *right=NULL, idVec3 *up=NULL) const
idMat4 ToMat4(void) const
idRotation ToRotation(void) const