100 template <
class Real>
106 template <
class Real>
112 template <
class Real>
118 template <
class Real>
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)
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) )
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>
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];
212 template <
class Real>
215 moMatrix3<Real> 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;
244 template <
class Real>
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++)
284 if (fNorm > (Real)0.0)
286 Real fInvNorm = ((Real)1.0)/fNorm;
295 for (i = 0; i < 4; i++)
304 template <
class Real>
311 template <
class Real>
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++)
347 template <
class Real>
365 Real fCoeff = fAngle/fSin;
366 for (i = 1; i <= 3; i++)
374 for (i = 1; i <= 3; i++)
381 template <
class Real>
403 moMatrix3<Real> 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);
516 if (fCosHalfAngle != (Real)0.0)
518 kCross = rkV1.
Cross(kBisector);
551 template <
class Real>
556 rkSwing =
Align(rkV1,kV2);
560 template <
class Real>
565 rkSwing =
Align(rkV1,kV2);
moQuaternion & Slerp(Real fT, const moQuaternion &rkP, const moQuaternion &rkQ)
void ToAxisAngle(moVector3< Real > &rkAxis, Real &rfAngle) const
moQuaternion & FromAxisAngle(const moVector3< Real > &rkAxis, Real fAngle)
static const moQuaternion IDENTITY
bool operator>(const moQuaternion &rkQ) const
moQuaternion & Intermediate(const moQuaternion &rkQ0, const moQuaternion &rkQ1, const moQuaternion &rkQ2)
Real Dot(const moQuaternion &rkQ) const
moQuaternion & SlerpExtraSpins(Real fT, const moQuaternion &rkP, const moQuaternion &rkQ, int iExtraSpins)
static Real ACos(Real fValue)
bool operator>=(const moQuaternion &rkQ) const
bool operator<(const moQuaternion &rkQ) const
moVector3< Real > Rotate(const moVector3< Real > &rkVector) const
static Real Sin(Real fValue)
Clase base abstracta de donde deben derivar los objetos [virtual pura].
bool operator==(const moQuaternion &rkQ) const
moQuaternion & FromRotationMatrix(const moMatrix3< Real > &rkRot)
int CompareArrays(const moQuaternion &rkQ) const
moVector3 Cross(const moVector3 &rkV) const
static Real InvSqrt(Real fValue)
moQuaternion Conjugate() const
bool operator<=(const moQuaternion &rkQ) const
moQuaternion Inverse() const
static Real Sqrt(Real fValue)
void DecomposeTwistTimesSwing(const moVector3< Real > &rkV1, moQuaternion &rkTwist, moQuaternion &rkSwing)
moQuaternion & Squad(Real fT, const moQuaternion &rkQ0, const moQuaternion &rkA0, const moQuaternion &rkA1, const moQuaternion &rkQ1)
Real Dot(const moVector3 &rkV) const
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
void DecomposeSwingTimesTwist(const moVector3< Real > &rkV1, moQuaternion &rkSwing, moQuaternion &rkTwist)
void ToRotationMatrix(moMatrix3< Real > &rkRot) const