From: <axl...@us...> - 2009-05-31 04:26:39
|
Revision: 288 http://hgengine.svn.sourceforge.net/hgengine/?rev=288&view=rev Author: axlecrusher Date: 2009-05-31 04:26:04 +0000 (Sun, 31 May 2009) Log Message: ----------- make CreatFromAngleAxis static Modified Paths: -------------- Mercury2/src/MQuaternion.cpp Mercury2/src/MQuaternion.h Modified: Mercury2/src/MQuaternion.cpp =================================================================== --- Mercury2/src/MQuaternion.cpp 2009-05-31 04:18:08 UTC (rev 287) +++ Mercury2/src/MQuaternion.cpp 2009-05-31 04:26:04 UTC (rev 288) @@ -52,8 +52,15 @@ m_wxyz[3] = cx*cy*sz-sx*sy*cz;//q4 } -void MQuaternion::CreateFromAxisAngle(const MercuryVertex& p, const float radians) +MQuaternion MQuaternion::CreateFromAxisAngle(const MercuryVertex& p, const float radians) { + MQuaternion q; + q.FromAxisAngle(p, radians); + return q; +} + +void MQuaternion::FromAxisAngle(const MercuryVertex& p, const float radians) +{ float sn = SIN(radians/2.0f); m_wxyz[0] = COS(radians/2.0f); m_wxyz[1] = sn * p[0]; Modified: Mercury2/src/MQuaternion.h =================================================================== --- Mercury2/src/MQuaternion.h 2009-05-31 04:18:08 UTC (rev 287) +++ Mercury2/src/MQuaternion.h 2009-05-31 04:26:04 UTC (rev 288) @@ -20,7 +20,8 @@ void SetEuler(const MercuryVertex& angles); ///Make the quaternion represent a given angle radians around an axis p - void CreateFromAxisAngle(const MercuryVertex& p, const float radians); + static MQuaternion CreateFromAxisAngle(const MercuryVertex& p, const float radians); + void FromAxisAngle(const MercuryVertex& p, const float radians); void ToAxisAngle(float& angle, float& x, float& y, float& z) const; ///Access a component of the quaternion with the [] operator This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |