58     m_afTuple[0] = rkQ.m_afTuple[0];
 
   59     m_afTuple[1] = rkQ.m_afTuple[1];
 
   60     m_afTuple[2] = rkQ.m_afTuple[2];
 
   61     m_afTuple[3] = rkQ.m_afTuple[3];
 
   67     FromRotationMatrix(rkRot);
 
   79     FromRotationMatrix(akRotColumn);
 
   85     return memcmp(m_afTuple,rkQ.m_afTuple,4*
sizeof(Real));
 
   91     return CompareArrays(rkQ) == 0;
 
   97     return CompareArrays(rkQ) != 0;
 
  100 template <
class Real>
 
  103     return CompareArrays(rkQ) < 0;
 
  106 template <
class Real>
 
  109     return CompareArrays(rkQ) <= 0;
 
  112 template <
class Real>
 
  115     return CompareArrays(rkQ) > 0;
 
  118 template <
class Real>
 
  121     return CompareArrays(rkQ) >= 0;
 
  124 template <
class Real>
 
  126     const moMatrix3<Real>& rkRot)
 
  131     Real fTrace = rkRot(0,0) + rkRot(1,1) + rkRot(2,2);
 
  134     if (fTrace > (Real)0.0)
 
  138         m_afTuple[0] = ((Real)0.5)*fRoot;
 
  139         fRoot = ((Real)0.5)/fRoot;  
 
  140         m_afTuple[1] = (rkRot(2,1)-rkRot(1,2))*fRoot;
 
  141         m_afTuple[2] = (rkRot(0,2)-rkRot(2,0))*fRoot;
 
  142         m_afTuple[3] = (rkRot(1,0)-rkRot(0,1))*fRoot;
 
  148         if ( rkRot(1,1) > rkRot(0,0) )
 
  152         if ( rkRot(2,2) > rkRot(i,i) )
 
  160         Real* apfQuat[3] = { &m_afTuple[1], &m_afTuple[2], &m_afTuple[3] };
 
  161         *apfQuat[
i] = ((Real)0.5)*fRoot;
 
  162         fRoot = ((Real)0.5)/fRoot;
 
  163         m_afTuple[0] = (rkRot(k,j)-rkRot(j,k))*fRoot;
 
  164         *apfQuat[j] = (rkRot(j,i)+rkRot(i,j))*fRoot;
 
  165         *apfQuat[
k] = (rkRot(k,i)+rkRot(i,k))*fRoot;
 
  171 template <
class Real>
 
  174     Real fTx  = ((Real)2.0)*m_afTuple[1];
 
  175     Real fTy  = ((Real)2.0)*m_afTuple[2];
 
  176     Real fTz  = ((Real)2.0)*m_afTuple[3];
 
  177     Real fTwx = fTx*m_afTuple[0];
 
  178     Real fTwy = fTy*m_afTuple[0];
 
  179     Real fTwz = fTz*m_afTuple[0];
 
  180     Real fTxx = fTx*m_afTuple[1];
 
  181     Real fTxy = fTy*m_afTuple[1];
 
  182     Real fTxz = fTz*m_afTuple[1];
 
  183     Real fTyy = fTy*m_afTuple[2];
 
  184     Real fTyz = fTz*m_afTuple[2];
 
  185     Real fTzz = fTz*m_afTuple[3];
 
  187     rkRot(0,0) = (Real)1.0-(fTyy+fTzz);
 
  188     rkRot(0,1) = fTxy-fTwz;
 
  189     rkRot(0,2) = fTxz+fTwy;
 
  190     rkRot(1,0) = fTxy+fTwz;
 
  191     rkRot(1,1) = (Real)1.0-(fTxx+fTzz);
 
  192     rkRot(1,2) = fTyz-fTwx;
 
  193     rkRot(2,0) = fTxz-fTwy;
 
  194     rkRot(2,1) = fTyz+fTwx;
 
  195     rkRot(2,2) = (Real)1.0-(fTxx+fTyy);
 
  198 template <
class Real>
 
  202     moMatrix3<Real> kRot;
 
  203     for (
int iCol = 0; iCol < 3; iCol++)
 
  205         kRot(0,iCol) = akRotColumn[iCol][0];
 
  206         kRot(1,iCol) = akRotColumn[iCol][1];
 
  207         kRot(2,iCol) = akRotColumn[iCol][2];
 
  209     return FromRotationMatrix(kRot);
 
  212 template <
class Real>
 
  215     moMatrix3<Real> kRot;
 
  216     ToRotationMatrix(kRot);
 
  217     for (
int iCol = 0; iCol < 3; iCol++)
 
  219         akRotColumn[iCol][0] = kRot(0,iCol);
 
  220         akRotColumn[iCol][1] = kRot(1,iCol);
 
  221         akRotColumn[iCol][2] = kRot(2,iCol);
 
  225 template <
class Real>
 
  234     Real fHalfAngle = ((Real)0.5)*fAngle;
 
  237     m_afTuple[1] = fSin*rkAxis[0];
 
  238     m_afTuple[2] = fSin*rkAxis[1];
 
  239     m_afTuple[3] = fSin*rkAxis[2];
 
  244 template <
class Real>
 
  251     Real fSqrLength = m_afTuple[1]*m_afTuple[1] + m_afTuple[2]*m_afTuple[2]
 
  252         + m_afTuple[3]*m_afTuple[3];
 
  258         rkAxis[0] = m_afTuple[1]*fInvLength;
 
  259         rkAxis[1] = m_afTuple[2]*fInvLength;
 
  260         rkAxis[2] = m_afTuple[3]*fInvLength;
 
  266         rkAxis[0] = (Real)1.0;
 
  267         rkAxis[1] = (Real)0.0;
 
  268         rkAxis[2] = (Real)0.0;
 
  272 template <
class Real>
 
  277     Real fNorm = (Real)0.0;
 
  279     for (i = 0; i < 4; i++)
 
  281         fNorm += m_afTuple[
i]*m_afTuple[
i];
 
  284     if (fNorm > (Real)0.0)
 
  286         Real fInvNorm = ((Real)1.0)/fNorm;
 
  287         kInverse.m_afTuple[0] = m_afTuple[0]*fInvNorm;
 
  288         kInverse.m_afTuple[1] = -m_afTuple[1]*fInvNorm;
 
  289         kInverse.m_afTuple[2] = -m_afTuple[2]*fInvNorm;
 
  290         kInverse.m_afTuple[3] = -m_afTuple[3]*fInvNorm;
 
  295         for (i = 0; i < 4; i++)
 
  297             kInverse.m_afTuple[
i] = (Real)0.0;
 
  304 template <
class Real>
 
  307     return moQuaternion(m_afTuple[0],-m_afTuple[1],-m_afTuple[2],
 
  311 template <
class Real>
 
  321         m_afTuple[2]*m_afTuple[2] + m_afTuple[3]*m_afTuple[3]);
 
  330         Real fCoeff = fSin/fAngle;
 
  331         for (i = 1; i <= 3; i++)
 
  333             kResult.m_afTuple[
i] = fCoeff*m_afTuple[
i];
 
  338         for (i = 1; i <= 3; i++)
 
  340             kResult.m_afTuple[
i] = m_afTuple[
i];
 
  347 template <
class Real>
 
  355     kResult.m_afTuple[0] = (Real)0.0;
 
  365             Real fCoeff = fAngle/fSin;
 
  366             for (i = 1; i <= 3; i++)
 
  368                 kResult.m_afTuple[
i] = fCoeff*m_afTuple[
i];
 
  374     for (i = 1; i <= 3; i++)
 
  376         kResult.m_afTuple[
i] = m_afTuple[
i];
 
  381 template <
class Real>
 
  403     moMatrix3<Real> kRot;
 
  404     ToRotationMatrix(kRot);
 
  405     return kRot*rkVector;
 
  408 template <
class Real>
 
  412     Real fCos = rkP.
Dot(rkQ);
 
  418         Real fInvSin = ((Real)1.0)/fSin;
 
  421         *
this = fCoeff0*rkP + fCoeff1*rkQ;
 
  431 template <
class Real>
 
  435     Real fCos = rkP.
Dot(rkQ);
 
  442         Real fInvSin = ((Real)1.0)/fSin;
 
  445         *
this = fCoeff0*rkP + fCoeff1*rkQ;
 
  455 template <
class Real>
 
  470 template <
class Real>
 
  474     Real fSlerpT = ((Real)2.0)*fT*((Real)1.0-fT);
 
  477     return Slerp(fSlerpT,kSlerpP,kSlerpQ);
 
  480 template <
class Real>
 
  511     Real fCosHalfAngle = rkV1.
Dot(kBisector);
 
  514     m_afTuple[0] = fCosHalfAngle;
 
  516     if (fCosHalfAngle != (Real)0.0)
 
  518         kCross = rkV1.
Cross(kBisector);
 
  519         m_afTuple[1] = kCross.
X();
 
  520         m_afTuple[2] = kCross.
Y();
 
  521         m_afTuple[3] = kCross.
Z();
 
  532             m_afTuple[1] = -rkV1[2]*fInvLength;
 
  533             m_afTuple[2] = (Real)0.0;
 
  534             m_afTuple[3] = +rkV1[0]*fInvLength;
 
  542             m_afTuple[1] = (Real)0.0;
 
  543             m_afTuple[2] = +rkV1[2]*fInvLength;
 
  544             m_afTuple[3] = -rkV1[1]*fInvLength;
 
  551 template <
class Real>
 
  556     rkSwing = Align(rkV1,kV2);
 
  560 template <
class Real>
 
  565     rkSwing = Align(rkV1,kV2);
 
bool operator>(const moQuaternion &rkQ) const 
moMatrix3< Real > & FromAxisAngle(const moVector3< Real > &rkAxis, Real fAngle)
moQuaternion & Slerp(Real fT, const moQuaternion &rkP, const moQuaternion &rkQ)
moQuaternion & FromAxisAngle(const moVector3< Real > &rkAxis, Real fAngle)
static const moQuaternion IDENTITY
moQuaternion & Intermediate(const moQuaternion &rkQ0, const moQuaternion &rkQ1, const moQuaternion &rkQ2)
moQuaternion & SlerpExtraSpins(Real fT, const moQuaternion &rkP, const moQuaternion &rkQ, int iExtraSpins)
static Real ACos(Real fValue)
moQuaternion Conjugate() const 
static Real Sin(Real fValue)
void ToAxisAngle(moVector3< Real > &rkAxis, Real &rfAngle) const 
Clase base abstracta de donde deben derivar los objetos [virtual pura]. 
bool operator!=(const moQuaternion &rkQ) const 
moQuaternion & FromRotationMatrix(const moMatrix3< Real > &rkRot)
void ToRotationMatrix(moMatrix3< Real > &rkRot) const 
moTypes MOint moText moParamIndex moParamReference int iRow int int i int i
static Real InvSqrt(Real fValue)
bool operator>=(const moQuaternion &rkQ) const 
static Real Sqrt(Real fValue)
Real Dot(const moVector3 &rkV) const 
void DecomposeTwistTimesSwing(const moVector3< Real > &rkV1, moQuaternion &rkTwist, moQuaternion &rkSwing)
moMatrix3< Real > & Slerp(Real fT, const moMatrix3 &rkR0, const moMatrix3 &rkR1)
bool operator<=(const moQuaternion &rkQ) const 
moQuaternion & Squad(Real fT, const moQuaternion &rkQ0, const moQuaternion &rkA0, const moQuaternion &rkA1, const moQuaternion &rkQ1)
static const moQuaternion ZERO
moQuaternion & Align(const moVector3< Real > &rkV1, const moVector3< Real > &rkV2)
static Real Cos(Real fValue)
bool operator==(const moQuaternion &rkQ) const 
moVector3 Cross(const moVector3 &rkV) const 
bool operator<(const moQuaternion &rkQ) const 
moQuaternion Inverse() const 
Real Dot(const moQuaternion &rkQ) const 
moVector3< Real > Rotate(const moVector3< Real > &rkVector) const 
void DecomposeSwingTimesTwist(const moVector3< Real > &rkV1, moQuaternion &rkSwing, moQuaternion &rkTwist)