40 #ifndef __MO_MATH_VECTOR3_H__ 
   41 #define __MO_MATH_VECTOR3_H__ 
   57         m_afTuple[0] = afTuple[0];
 
   58         m_afTuple[1] = afTuple[1];
 
   59         m_afTuple[2] = afTuple[2];
 
   62         m_afTuple[0] = rkV.m_afTuple[0];
 
   63         m_afTuple[1] = rkV.m_afTuple[1];
 
   64         m_afTuple[2] = rkV.m_afTuple[2];
 
   68     inline operator const Real* () 
const { 
return m_afTuple; }
 
   69     inline operator Real* () { 
return m_afTuple; }
 
   73     inline Real 
X ()
 const { 
return m_afTuple[0]; }
 
   74     inline Real& 
X () { 
return m_afTuple[0]; }
 
   75     inline Real 
Y ()
 const { 
return m_afTuple[1]; }
 
   76     inline Real& 
Y () { 
return m_afTuple[1]; }
 
   77     inline Real 
Z ()
 const { 
return m_afTuple[2]; }
 
   78     inline Real& 
Z () { 
return m_afTuple[2]; }
 
   83         m_afTuple[0] = rkV.m_afTuple[0];
 
   84         m_afTuple[1] = rkV.m_afTuple[1];
 
   85         m_afTuple[2] = rkV.m_afTuple[2];
 
  100           moVector3<Real> ret(m_afTuple[0]+rkV.m_afTuple[0], m_afTuple[1]+rkV.m_afTuple[1], m_afTuple[2]+rkV.m_afTuple[2]);
 
  104         return moVector3<Real>(m_afTuple[0]-rkV.m_afTuple[0],m_afTuple[1]-rkV.m_afTuple[1],m_afTuple[2]-rkV.m_afTuple[2]);
 
  108             fScalar*m_afTuple[0],
 
  109             fScalar*m_afTuple[1],
 
  110             fScalar*m_afTuple[2]);
 
  115         if (fScalar != (Real)0.0)
 
  117             Real fInvScalar = ((Real)1.0)/fScalar;
 
  118             kQuot.m_afTuple[0] = fInvScalar*m_afTuple[0];
 
  119             kQuot.m_afTuple[1] = fInvScalar*m_afTuple[1];
 
  120             kQuot.m_afTuple[2] = fInvScalar*m_afTuple[2];
 
  140         m_afTuple[0] += rkV.m_afTuple[0];
 
  141         m_afTuple[1] += rkV.m_afTuple[1];
 
  142         m_afTuple[2] += rkV.m_afTuple[2];
 
  148         m_afTuple[0] -= rkV.m_afTuple[0];
 
  149         m_afTuple[1] -= rkV.m_afTuple[1];
 
  150         m_afTuple[2] -= rkV.m_afTuple[2];
 
  156         m_afTuple[0] *= fScalar;
 
  157         m_afTuple[1] *= fScalar;
 
  158         m_afTuple[2] *= fScalar;
 
  164         if (fScalar != (Real)0.0)
 
  166             Real fInvScalar = ((Real)1.0)/fScalar;
 
  167             m_afTuple[0] *= fInvScalar;
 
  168             m_afTuple[1] *= fInvScalar;
 
  169             m_afTuple[2] *= fInvScalar;
 
  185         m_afTuple[0]*m_afTuple[0] +
 
  186         m_afTuple[1]*m_afTuple[1] +
 
  187         m_afTuple[2]*m_afTuple[2]);
 
  193             m_afTuple[0]*m_afTuple[0] +
 
  194             m_afTuple[1]*m_afTuple[1] +
 
  195             m_afTuple[2]*m_afTuple[2];
 
  201             m_afTuple[0]*rkV.m_afTuple[0] +
 
  202             m_afTuple[1]*rkV.m_afTuple[1] +
 
  203             m_afTuple[2]*rkV.m_afTuple[2];
 
  206         Real fLength = Length();
 
  210             Real fInvLength = ((Real)1.0)/fLength;
 
  211             m_afTuple[0] *= fInvLength;
 
  212             m_afTuple[1] *= fInvLength;
 
  213             m_afTuple[2] *= fInvLength;
 
  218             m_afTuple[0] = (Real)0.0;
 
  219             m_afTuple[1] = (Real)0.0;
 
  220             m_afTuple[2] = (Real)0.0;
 
  233         m_afTuple[1]*rkV.m_afTuple[2] - m_afTuple[2]*rkV.m_afTuple[1],
 
  234         m_afTuple[2]*rkV.m_afTuple[0] - m_afTuple[0]*rkV.m_afTuple[2],
 
  235         m_afTuple[0]*rkV.m_afTuple[1] - m_afTuple[1]*rkV.m_afTuple[0]);
 
  240                 m_afTuple[1]*rkV.m_afTuple[2] - m_afTuple[2]*rkV.m_afTuple[1],
 
  241                 m_afTuple[2]*rkV.m_afTuple[0] - m_afTuple[0]*rkV.m_afTuple[2],
 
  242                 m_afTuple[0]*rkV.m_afTuple[1] - m_afTuple[1]*rkV.m_afTuple[0]);
 
  269         Real fMax = (Real)0.0;
 
  271         for (i = 0; i < 3; i++)
 
  273             for (
int j = 0; j < 3; j++)
 
  284         if (fMax > (Real)1.0)
 
  286             Real fInvMax = ((Real)1.0)/fMax;
 
  287             for (i = 0; i < 4; i++)
 
  289                 akDiff[
i] *= fInvMax;
 
  293         Real fDet = akDiff[0].
Dot(akDiff[1].Cross(akDiff[2]));
 
  299             Real fInvDet = ((Real)1.0)/fDet;
 
  300             afBary[0] = akDiff[3].
Dot(kE1cE2)*fInvDet;
 
  301             afBary[1] = akDiff[3].
Dot(kE2cE0)*fInvDet;
 
  302             afBary[2] = akDiff[3].
Dot(kE0cE1)*fInvDet;
 
  303             afBary[3] = (Real)1.0 - afBary[0] - afBary[1] - afBary[2];
 
  316             if (fSqrArea > fMaxSqrArea)
 
  319                 fMaxSqrArea = fSqrArea;
 
  322             if (fSqrArea > fMaxSqrArea)
 
  325                 fMaxSqrArea = fSqrArea;
 
  328             if (fSqrArea > fMaxSqrArea)
 
  331                 fMaxSqrArea = fSqrArea;
 
  336                 Real fInvSqrArea = ((Real)1.0)/fMaxSqrArea;
 
  340                     kTmp = akDiff[3].
Cross(akDiff[1]);
 
  341                     afBary[0] = kE0cE1.
Dot(kTmp)*fInvSqrArea;
 
  342                     kTmp = akDiff[0].
Cross(akDiff[3]);
 
  343                     afBary[1] = kE0cE1.
Dot(kTmp)*fInvSqrArea;
 
  344                     afBary[2] = (Real)0.0;
 
  345                     afBary[3] = (Real)1.0 - afBary[0] - afBary[1];
 
  347                 else if (iMaxIndex == 1)
 
  349                     afBary[0] = (Real)0.0;
 
  350                     kTmp = akDiff[3].
Cross(akDiff[2]);
 
  351                     afBary[1] = kE1cE2.
Dot(kTmp)*fInvSqrArea;
 
  352                     kTmp = akDiff[1].
Cross(akDiff[3]);
 
  353                     afBary[2] = kE1cE2.
Dot(kTmp)*fInvSqrArea;
 
  354                     afBary[3] = (Real)1.0 - afBary[1] - afBary[2];
 
  356                 else if (iMaxIndex == 2)
 
  358                     kTmp = akDiff[2].
Cross(akDiff[3]);
 
  359                     afBary[0] = kE2cE0.
Dot(kTmp)*fInvSqrArea;
 
  360                     afBary[1] = (Real)0.0;
 
  361                     kTmp = akDiff[3].
Cross(akDiff[0]);
 
  362                     afBary[2] = kE2cE0.
Dot(kTmp)*fInvSqrArea;
 
  363                     afBary[3] = (Real)1.0 - afBary[0] - afBary[2];
 
  367                     akDiff[3] = *
this - rkV2;
 
  368                     kTmp = akDiff[3].
Cross(kE12);
 
  369                     afBary[0] = kE02cE12.
Dot(kTmp)*fInvSqrArea;
 
  370                     kTmp = kE02.
Cross(akDiff[3]);
 
  371                     afBary[1] = kE02cE12.
Dot(kTmp)*fInvSqrArea;
 
  372                     afBary[2] = (Real)1.0 - afBary[0] - afBary[1];
 
  373                     afBary[3] = (Real)0.0;
 
  384                 if (fSqrLength > fMaxSqrLength)
 
  387                     fMaxSqrLength = fSqrLength;
 
  390                 if (fSqrLength > fMaxSqrLength)
 
  393                     fMaxSqrLength = fSqrLength;
 
  396                 if (fSqrLength > fMaxSqrLength)
 
  399                     fMaxSqrLength = fSqrLength;
 
  402                 if (fSqrLength > fMaxSqrLength)
 
  405                     fMaxSqrLength = fSqrLength;
 
  409                 if (fSqrLength > fMaxSqrLength)
 
  412                     fMaxSqrLength = fSqrLength;
 
  417                     Real fInvSqrLength = ((Real)1.0)/fMaxSqrLength;
 
  421                         afBary[0] = akDiff[3].
Dot(akDiff[0])*fInvSqrLength;
 
  422                         afBary[1] = (Real)0.0;
 
  423                         afBary[2] = (Real)0.0;
 
  424                         afBary[3] = (Real)1.0 - afBary[0];
 
  426                     else if (iMaxIndex == 1)
 
  429                         afBary[0] = (Real)0.0;
 
  430                         afBary[1] = akDiff[3].
Dot(akDiff[1])*fInvSqrLength;
 
  431                         afBary[2] = (Real)0.0;
 
  432                         afBary[3] = (Real)1.0 - afBary[1];
 
  434                     else if (iMaxIndex == 2)
 
  437                         afBary[0] = (Real)0.0;
 
  438                         afBary[1] = (Real)0.0;
 
  439                         afBary[2] = akDiff[3].
Dot(akDiff[2])*fInvSqrLength;
 
  440                         afBary[3] = (Real)1.0 - afBary[2];
 
  442                     else if (iMaxIndex == 3)
 
  445                         akDiff[3] = *
this - rkV2;
 
  446                         afBary[0] = akDiff[3].
Dot(kE02)*fInvSqrLength;
 
  447                         afBary[1] = (Real)0.0;
 
  448                         afBary[2] = (Real)1.0 - afBary[0];
 
  449                         afBary[3] = (Real)0.0;
 
  451                     else if (iMaxIndex == 4)
 
  454                         akDiff[3] = *
this - rkV2;
 
  455                         afBary[0] = (Real)0.0;
 
  456                         afBary[1] = akDiff[3].
Dot(kE12)*fInvSqrLength;
 
  457                         afBary[2] = (Real)1.0 - afBary[1];
 
  458                         afBary[3] = (Real)0.0;
 
  463                         akDiff[3] = *
this - rkV1;
 
  464                         afBary[0] = akDiff[3].
Dot(kE01)*fInvSqrLength;
 
  465                         afBary[1] = (Real)1.0 - afBary[0];
 
  466                         afBary[2] = (Real)0.0;
 
  467                         afBary[3] = (Real)0.0;
 
  473                     afBary[0] = (Real)0.25;
 
  474                     afBary[1] = afBary[0];
 
  475                     afBary[2] = afBary[0];
 
  476                     afBary[3] = afBary[0];
 
  501         Real fDot0 = rkU.
Dot(rkV);
 
  506         Real fDot1 = rkV.
Dot(rkW);
 
  507         fDot0 = rkU.Dot(rkW);
 
  508         rkW -= fDot0*rkU + fDot1*rkV;
 
  526         GenerateComplementBasis(rkU,rkV,rkW);
 
  542                 rkW.m_afTuple[2]*rkW.m_afTuple[2]);
 
  543             rkU.m_afTuple[0] = -rkW.m_afTuple[2]*fInvLength;
 
  544             rkU.m_afTuple[1] = (Real)0.0;
 
  545             rkU.m_afTuple[2] = +rkW.m_afTuple[0]*fInvLength;
 
  546             rkV.m_afTuple[0] = rkW.m_afTuple[1]*rkU.m_afTuple[2];
 
  547             rkV.m_afTuple[1] = rkW.m_afTuple[2]*rkU.m_afTuple[0] -
 
  548                 rkW.m_afTuple[0]*rkU.m_afTuple[2];
 
  549             rkV.m_afTuple[2] = -rkW.m_afTuple[1]*rkU.m_afTuple[0];
 
  555                 rkW.m_afTuple[2]*rkW.m_afTuple[2]);
 
  556             rkU.m_afTuple[0] = (Real)0.0;
 
  557             rkU.m_afTuple[1] = +rkW.m_afTuple[2]*fInvLength;
 
  558             rkU.m_afTuple[2] = -rkW.m_afTuple[1]*fInvLength;
 
  559             rkV.m_afTuple[0] = rkW.m_afTuple[1]*rkU.m_afTuple[2] -
 
  560                 rkW.m_afTuple[2]*rkU.m_afTuple[1];
 
  561             rkV.m_afTuple[1] = -rkW.m_afTuple[0]*rkU.m_afTuple[2];
 
  562             rkV.m_afTuple[2] = rkW.m_afTuple[0]*rkU.m_afTuple[1];
 
  571         if (!(iVQuantity > 0 && akPoint)) 
return;
 
  575         for (
int i = 1; 
i < iVQuantity; 
i++)
 
  578             for (
int j = 0; j < 3; j++)
 
  580                 if (rkPoint[j] < rkMin[j])
 
  582                     rkMin[j] = rkPoint[j];
 
  584                 else if (rkPoint[j] > rkMax[j])
 
  586                     rkMax[j] = rkPoint[j];
 
  597         if ((0 < l) && (0 < lv)) 
return Dot(rkV) / (l * lv);
 
  614     int CompareArrays (
const moVector3& rkV)
 const {
return memcmp(m_afTuple,rkV.m_afTuple,3*
sizeof(Real));}
 
  621 template <
class Real>
 
  624     return moVector3<Real>(fScalar*rkV[0], fScalar*rkV[1], fScalar*rkV[2]);
 
moVector3< Real > operator*(Real fScalar, const moVector3< Real > &rkV)
 
bool operator<=(const moMatrix3 &rkM) const 
 
Real SquaredLength() const 
 
moMatrix3 operator-(const moMatrix3 &rkM) const 
 
static Real ACos(Real fValue)
 
moMatrix3 operator/(Real fScalar) const 
 
bool operator>(const moMatrix3 &rkM) const 
 
static void ComputeExtremes(int iVQuantity, const moVector3 *akPoint, moVector3 &rkMin, moVector3 &rkMax)
 
Clase base abstracta de donde deben derivar los objetos [virtual pura]. 
 
static void Orthonormalize(moVector3 *akV)
 
static const moVector3 ONE
 
static const moVector3 UNIT_X
 
moVector3(const Real *afTuple)
 
moMatrix3 & operator-=(const moMatrix3 &rkM)
 
moTypes MOint moText moParamIndex moParamReference int iRow int int i int i
 
static const moVector3 UNIT_Y
 
static Real InvSqrt(Real fValue)
 
bool operator==(const moMatrix3 &rkM) const 
 
static Real Sqrt(Real fValue)
 
bool operator<(const moMatrix3 &rkM) const 
 
static const moVector3 UNIT_Z
 
Real Dot(const moVector3 &rkV) const 
 
moMatrix3 & operator/=(Real fScalar)
 
void GetBarycentrics(const moVector3< Real > &rkV0, const moVector3< Real > &rkV1, const moVector3< Real > &rkV2, const moVector3< Real > &rkV3, Real afBary[4]) const 
 
moVector3< MOdouble > moVector3d
 
moVector3(const moVector3 &rkV)
 
moVector3 Cross(const moVector3 &rkV) const 
 
moVector3(Real fX, Real fY, Real fZ)
 
bool operator!=(const moMatrix3 &rkM) const 
 
static void GenerateComplementBasis(moVector3 &rkU, moVector3 &rkV, const moVector3 &rkW)
 
moMatrix3 & operator*=(Real fScalar)
 
bool operator>=(const moMatrix3 &rkM) const 
 
Real Cosine(const moVector3< Real > &rkV)
 
moMatrix3 & operator=(const moMatrix3 &rkM)
 
moVector3< MOlong > moVector3i
 
moDeclareExportedDynamicArray(moVector3i, moVector3iArray)
 
moVector3< MOfloat > moVector3f
 
Real Angle(const moVector3< Real > &rkV)
 
static const moVector3 ZERO
 
moMatrix3 operator+(const moMatrix3 &rkM) const 
 
static Real FAbs(Real fValue)
 
moMatrix3 & operator+=(const moMatrix3 &rkM)
 
static void GenerateOrthonormalBasis(moVector3 &rkU, moVector3 &rkV, moVector3 &rkW)
 
static void Orthonormalize(moVector3 &rkU, moVector3 &rkV, moVector3 &rkW)
 
const Real * operator[](int iRow) const 
 
moVector3 UnitCross(const moVector3 &rkV) const