Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

RageMath.h

Go to the documentation of this file.
00001 /* 00002 * RageMath - vector/matrix math utilities 00003 * 00004 * Most of these prototypes match up with the D3DX math functions. Take a 00005 * function name, replace "Rage" with "D3DX" and look it up in the D3D SDK 00006 * docs for details. 00007 */ 00008 00009 #ifndef RAGE_MATH_H 00010 #define RAGE_MATH_H 00011 00012 #define PI (3.141592653589793f) 00013 #define DegreeToRadian( degree ) ((degree) * (PI / 180.0f)) 00014 #define RadianToDegree( radian ) ((radian) * (180.0f / PI)) 00015 00016 00017 struct RageVector2; 00018 struct RageVector3; 00019 struct RageVector4; 00020 struct RageMatrix; 00021 00022 void RageVec3ClearBounds( RageVector3 &mins, RageVector3 &maxs ); 00023 void RageVec3AddToBounds( const RageVector3 &p, RageVector3 &mins, RageVector3 &maxs ); 00024 00025 void RageVec2Normalize( RageVector2* pOut, const RageVector2* pV ); 00026 void RageVec3Normalize( RageVector3* pOut, const RageVector3* pV ); 00027 void RageVec3TransformCoord( RageVector3* pOut, const RageVector3* pV, const RageMatrix* pM ); 00028 void RageVec3TransformNormal( RageVector3* pOut, const RageVector3* pV, const RageMatrix* pM ); 00029 void RageVec4TransformCoord( RageVector4* pOut, const RageVector4* pV, const RageMatrix* pM ); 00030 void RageMatrixIdentity( RageMatrix* pOut ); 00031 RageMatrix RageMatrixIdentity(); 00032 void RageMatrixMultiply( RageMatrix* pOut, const RageMatrix* pA, const RageMatrix* pB ); 00033 void RageMatrixTranslation( RageMatrix* pOut, float x, float y, float z ); 00034 void RageMatrixScaling( RageMatrix* pOut, float x, float y, float z ); 00035 void RageMatrixRotationX( RageMatrix* pOut, float fTheta ); 00036 void RageMatrixRotationY( RageMatrix* pOut, float fTheta ); 00037 void RageMatrixRotationZ( RageMatrix* pOut, float fTheta ); 00038 RageMatrix RageMatrixRotationX( float fTheta ); 00039 RageMatrix RageMatrixRotationY( float fTheta ); 00040 RageMatrix RageMatrixRotationZ( float fTheta ); 00041 void RageMatrixCommand( CString sCommandString, RageMatrix &mat ); 00042 void RageQuatFromHPR(RageVector4* pOut, RageVector3 hpr ); 00043 void RageQuatFromPRH(RageVector4* pOut, RageVector3 prh ); 00044 void RageMatrixFromQuat( RageMatrix* pOut, const RageVector4 q ); 00045 void RageQuatSlerp(RageVector4 *pOut, const RageVector4 &from, const RageVector4 &to, float t); 00046 RageVector4 RageQuatFromH(float theta); 00047 RageVector4 RageQuatFromP(float theta); 00048 RageVector4 RageQuatFromR(float theta); 00049 void RageQuatMultiply( RageVector4* pOut, const RageVector4 &pA, const RageVector4 &pB ); 00050 RageMatrix RageLookAt( 00051 float eyex, float eyey, float eyez, 00052 float centerx, float centery, float centerz, 00053 float upx, float upy, float upz ); 00054 void RageMatrixAngles( RageMatrix* pOut, const RageVector3 &angles ); 00055 void RageMatrixTranspose( RageMatrix* pOut, const RageMatrix* pIn ); 00056 00057 #endif 00058 00059 /* 00060 * Copyright (c) 2001-2003 Chris Danford 00061 * All rights reserved. 00062 * 00063 * Permission is hereby granted, free of charge, to any person obtaining a 00064 * copy of this software and associated documentation files (the 00065 * "Software"), to deal in the Software without restriction, including 00066 * without limitation the rights to use, copy, modify, merge, publish, 00067 * distribute, and/or sell copies of the Software, and to permit persons to 00068 * whom the Software is furnished to do so, provided that the above 00069 * copyright notice(s) and this permission notice appear in all copies of 00070 * the Software and that both the above copyright notice(s) and this 00071 * permission notice appear in supporting documentation. 00072 * 00073 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00074 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00075 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00076 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00077 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00078 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00079 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00080 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00081 * PERFORMANCE OF THIS SOFTWARE. 00082 */

Generated on Thu Jan 27 20:57:28 2005 for StepMania by doxygen 1.3.7