From: <axl...@us...> - 2009-05-31 04:13:25
|
Revision: 286 http://hgengine.svn.sourceforge.net/hgengine/?rev=286&view=rev Author: axlecrusher Date: 2009-05-31 04:13:24 +0000 (Sun, 31 May 2009) Log Message: ----------- Move vector rotate out of quaternion into vertex Modified Paths: -------------- Mercury2/src/MQuaternion.cpp Mercury2/src/MQuaternion.h Mercury2/src/MercuryVertex.cpp Mercury2/src/MercuryVertex.h Modified: Mercury2/src/MQuaternion.cpp =================================================================== --- Mercury2/src/MQuaternion.cpp 2009-05-31 04:04:35 UTC (rev 285) +++ Mercury2/src/MQuaternion.cpp 2009-05-31 04:13:24 UTC (rev 286) @@ -245,12 +245,6 @@ printf("%s: %f %f %f %f\n", s.c_str(), m_wxyz[0], m_wxyz[1], m_wxyz[2], m_wxyz[3]); } -MercuryVector MQuaternion::operator * (const MercuryVector &rhs) const -{ - return (*this * MQuaternion(0, rhs) * reciprocal()).ToVector(); -} - - //Returns the Euclidian Inner Product of two MQuaternions (Similar to Vector Dot-Product) float innerProduct(const MQuaternion & a, const MQuaternion &b) { Modified: Mercury2/src/MQuaternion.h =================================================================== --- Mercury2/src/MQuaternion.h 2009-05-31 04:04:35 UTC (rev 285) +++ Mercury2/src/MQuaternion.h 2009-05-31 04:13:24 UTC (rev 286) @@ -61,8 +61,6 @@ MQuaternion& operator *= (const float &rhs); MQuaternion& operator /= (const float &rhs); - MercuryVector operator * (const MercuryVector &rhs) const; - bool operator==(const MQuaternion &rhs) const; inline bool operator!=(const MQuaternion &rhs) const { return !(*this == rhs); } Modified: Mercury2/src/MercuryVertex.cpp =================================================================== --- Mercury2/src/MercuryVertex.cpp 2009-05-31 04:04:35 UTC (rev 285) +++ Mercury2/src/MercuryVertex.cpp 2009-05-31 04:13:24 UTC (rev 286) @@ -1,6 +1,7 @@ #include <MercuryVertex.h> #include <MercuryUtil.h> #include <MercuryMath.h> +#include <MQuaternion.h> MercuryVertex::MercuryVertex() { @@ -115,8 +116,11 @@ printf("%s: %f %f %f %f\n", s.c_str(), (*this)[0], (*this)[1], (*this)[2], (*this)[3]); } +MercuryVertex MercuryVertex::Rotate(const MQuaternion& q) const +{ + return (q * MQuaternion(0, *this) * q.reciprocal()).ToVector(); +} - /**************************************************************************** * Copyright (C) 2009 by Joshua Allen * * * Modified: Mercury2/src/MercuryVertex.h =================================================================== --- Mercury2/src/MercuryVertex.h 2009-05-31 04:04:35 UTC (rev 285) +++ Mercury2/src/MercuryVertex.h 2009-05-31 04:13:24 UTC (rev 286) @@ -10,6 +10,8 @@ #define __inline__ inline #endif +class MQuaternion; + class MercuryVertex { public: @@ -79,6 +81,8 @@ MercuryVertex DotProduct3(const MercuryVertex& rhs1, const MercuryVertex& rhs2, const MercuryVertex& rhs3) const; void Print(const MString& s = "Vertex") const; + + MercuryVertex Rotate(const MQuaternion& q) const; // float (*this)[3]; FloatRow m_xyzw; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |