77 #ifndef __MO_MATH_MATRIX_H__
78 #define __MO_MATH_MATRIX_H__
240 int i0 = 2*iRow ,i1 = i0+1;
248 int i0 = 2*iRow ,i1 = i0+1;
279 return CompareArrays(rkM) == 0;
285 return CompareArrays(rkM) != 0;
291 return CompareArrays(rkM) < 0;
297 return CompareArrays(rkM) <= 0;
303 return CompareArrays(rkM) > 0;
309 return CompareArrays(rkM) >= 0;
351 Real fInvDet = ((Real)1.0)/fDet;
352 kInverse.m_afEntry[0] = m_afEntry[3]*fInvDet;
353 kInverse.m_afEntry[1] = -m_afEntry[1]*fInvDet;
354 kInverse.m_afEntry[2] = -m_afEntry[2]*fInvDet;
355 kInverse.m_afEntry[3] = m_afEntry[0]*fInvDet;
359 kInverse.m_afEntry[0] = (Real)0.0;
360 kInverse.m_afEntry[1] = (Real)0.0;
361 kInverse.m_afEntry[2] = (Real)0.0;
362 kInverse.m_afEntry[3] = (Real)0.0;
387 return rkU.
Dot((*
this)*rkV);
412 m_afEntry[0] *= fInvLength;
413 m_afEntry[2] *= fInvLength;
416 Real fDot0 = m_afEntry[0]*m_afEntry[1] + m_afEntry[2]*m_afEntry[3];
417 m_afEntry[1] -= fDot0*m_afEntry[0];
418 m_afEntry[3] -= fDot0*m_afEntry[2];
421 m_afEntry[3]*m_afEntry[3]);
423 m_afEntry[1] *= fInvLength;
424 m_afEntry[3] *= fInvLength;
431 Real fDiff = m_afEntry[0] - m_afEntry[3];
433 ((Real)4.0)*m_afEntry[1]*m_afEntry[1]);
434 Real fEVal0 = ((Real)0.5)*(fTrace-fDiscr);
435 Real fEVal1 = ((Real)0.5)*(fTrace+fDiscr);
439 if (fDiff >= (Real)0.0)
442 fSin = fEVal0 - m_afEntry[0];
446 fCos = fEVal0 - m_afEntry[3];
453 rkRot.m_afEntry[0] = fCos;
454 rkRot.m_afEntry[1] = -fSin;
455 rkRot.m_afEntry[2] = fSin;
456 rkRot.m_afEntry[3] = fCos;
498 fScalar*m_afEntry[1],
499 fScalar*m_afEntry[2],
500 fScalar*m_afEntry[3]);
504 if (fScalar != (Real)0.0)
506 Real fInvScalar = ((Real)1.0)/fScalar;
509 fInvScalar*m_afEntry[1],
510 fInvScalar*m_afEntry[2],
511 fInvScalar*m_afEntry[3]);
516 moMath<Real>::MAX_REAL,
517 moMath<Real>::MAX_REAL,
518 moMath<Real>::MAX_REAL);
556 if (fScalar != (Real)0.0)
558 Real fInvScalar = ((Real)1.0)/fScalar;
600 int CompareArrays (
const moMatrix2& rkM)
const
602 return memcmp(
m_afEntry,rkM.m_afEntry,4*
sizeof(Real));
611 template <
class Real>
618 template <
class Real>
623 rkV[0]*rkM[0][0] + rkV[1]*rkM[1][0],
624 rkV[0]*rkM[0][1] + rkV[1]*rkM[1][1]);
649 template <class Real>
683 moMatrix3 (Real fM00, Real fM01, Real fM02, Real fM10, Real fM11,
684 Real fM12, Real fM20, Real fM21, Real fM22)
854 Real fOneMinusCos = ((Real)1.0)-fCos;
855 Real fX2 = rkAxis[0]*rkAxis[0];
856 Real fY2 = rkAxis[1]*rkAxis[1];
857 Real fZ2 = rkAxis[2]*rkAxis[2];
858 Real fXYM = rkAxis[0]*rkAxis[1]*fOneMinusCos;
859 Real fXZM = rkAxis[0]*rkAxis[2]*fOneMinusCos;
860 Real fYZM = rkAxis[1]*rkAxis[2]*fOneMinusCos;
861 Real fXSin = rkAxis[0]*fSin;
862 Real fYSin = rkAxis[1]*fSin;
863 Real fZSin = rkAxis[2]*fSin;
897 int i0 = 3*iRow, i1 = i0+1, i2 = i1+1;
906 int i0 = 3*iRow, i1 = i0+1, i2 = i1+1;
944 return CompareArrays(rkM) == 0;
950 return CompareArrays(rkM) != 0;
956 return CompareArrays(rkM) < 0;
962 return CompareArrays(rkM) <= 0;
968 return CompareArrays(rkM) > 0;
974 return CompareArrays(rkM) >= 0;
980 return moMatrix3<Real>(
996 return moMatrix3<Real>(
1038 return moMatrix3<Real>(
1085 kInverse.m_afEntry[0] =
1087 kInverse.m_afEntry[1] =
1088 m_afEntry[2]*m_afEntry[7] - m_afEntry[1]*m_afEntry[8];
1089 kInverse.m_afEntry[2] =
1090 m_afEntry[1]*m_afEntry[5] - m_afEntry[2]*m_afEntry[4];
1091 kInverse.m_afEntry[3] =
1092 m_afEntry[5]*m_afEntry[6] - m_afEntry[3]*m_afEntry[8];
1093 kInverse.m_afEntry[4] =
1094 m_afEntry[0]*m_afEntry[8] - m_afEntry[2]*m_afEntry[6];
1095 kInverse.m_afEntry[5] =
1096 m_afEntry[2]*m_afEntry[3] - m_afEntry[0]*m_afEntry[5];
1097 kInverse.m_afEntry[6] =
1098 m_afEntry[3]*m_afEntry[7] - m_afEntry[4]*m_afEntry[6];
1099 kInverse.m_afEntry[7] =
1100 m_afEntry[1]*m_afEntry[6] - m_afEntry[0]*m_afEntry[7];
1101 kInverse.m_afEntry[8] =
1102 m_afEntry[0]*m_afEntry[4] - m_afEntry[1]*m_afEntry[3];
1105 m_afEntry[0]*kInverse.m_afEntry[0] +
1106 m_afEntry[1]*kInverse.m_afEntry[3] +
1107 m_afEntry[2]*kInverse.m_afEntry[6];
1114 Real fInvDet = ((Real)1.0)/fDet;
1115 kInverse.m_afEntry[0] *= fInvDet;
1116 kInverse.m_afEntry[1] *= fInvDet;
1117 kInverse.m_afEntry[2] *= fInvDet;
1118 kInverse.m_afEntry[3] *= fInvDet;
1119 kInverse.m_afEntry[4] *= fInvDet;
1120 kInverse.m_afEntry[5] *= fInvDet;
1121 kInverse.m_afEntry[6] *= fInvDet;
1122 kInverse.m_afEntry[7] *= fInvDet;
1123 kInverse.m_afEntry[8] *= fInvDet;
1130 return moMatrix3<Real>(
1132 m_afEntry[2]*m_afEntry[7] - m_afEntry[1]*m_afEntry[8],
1133 m_afEntry[1]*m_afEntry[5] - m_afEntry[2]*m_afEntry[4],
1134 m_afEntry[5]*m_afEntry[6] - m_afEntry[3]*m_afEntry[8],
1135 m_afEntry[0]*m_afEntry[8] - m_afEntry[2]*m_afEntry[6],
1136 m_afEntry[2]*m_afEntry[3] - m_afEntry[0]*m_afEntry[5],
1137 m_afEntry[3]*m_afEntry[7] - m_afEntry[4]*m_afEntry[6],
1138 m_afEntry[1]*m_afEntry[6] - m_afEntry[0]*m_afEntry[7],
1139 m_afEntry[0]*m_afEntry[4] - m_afEntry[1]*m_afEntry[3]);
1146 Real fCo10 = m_afEntry[5]*m_afEntry[6] - m_afEntry[3]*m_afEntry[8];
1147 Real fCo20 = m_afEntry[3]*m_afEntry[7] - m_afEntry[4]*m_afEntry[6];
1148 Real fDet = m_afEntry[0]*fCo00 + m_afEntry[1]*fCo10 + m_afEntry[2]*fCo20;
1156 return rkU.
Dot((*
this)*rkV);
1162 return moMatrix3<Real>(
1171 return moMatrix3<Real>(
1172 rkDiag[0]*
m_afEntry[0],rkDiag[0]*m_afEntry[1],rkDiag[0]*m_afEntry[2],
1173 rkDiag[1]*m_afEntry[3],rkDiag[1]*m_afEntry[4],rkDiag[1]*m_afEntry[5],
1174 rkDiag[2]*m_afEntry[6],rkDiag[2]*m_afEntry[7],rkDiag[2]*m_afEntry[8]);
1203 Real fCos = ((Real)0.5)*(fTrace-(Real)1.0);
1206 if (rfAngle > (Real)0.0)
1210 rkAxis[0] = m_afEntry[7]-m_afEntry[5];
1211 rkAxis[1] = m_afEntry[2]-m_afEntry[6];
1212 rkAxis[2] = m_afEntry[3]-m_afEntry[1];
1219 if (m_afEntry[0] >= m_afEntry[4])
1222 if (m_afEntry[0] >= m_afEntry[8])
1226 m_afEntry[4] - m_afEntry[8] + (Real)1.0);
1227 fHalfInverse = ((Real)0.5)/rkAxis[0];
1228 rkAxis[1] = fHalfInverse*m_afEntry[1];
1229 rkAxis[2] = fHalfInverse*m_afEntry[2];
1235 m_afEntry[0] - m_afEntry[4] + (Real)1.0);
1236 fHalfInverse = ((Real)0.5)/rkAxis[2];
1237 rkAxis[0] = fHalfInverse*m_afEntry[2];
1238 rkAxis[1] = fHalfInverse*m_afEntry[5];
1244 if (m_afEntry[4] >= m_afEntry[8])
1248 m_afEntry[0] - m_afEntry[8] + (Real)1.0);
1249 fHalfInverse = ((Real)0.5)/rkAxis[1];
1250 rkAxis[0] = fHalfInverse*m_afEntry[1];
1251 rkAxis[2] = fHalfInverse*m_afEntry[5];
1257 m_afEntry[0] - m_afEntry[4] + (Real)1.0);
1258 fHalfInverse = ((Real)0.5)/rkAxis[2];
1259 rkAxis[0] = fHalfInverse*m_afEntry[2];
1260 rkAxis[1] = fHalfInverse*m_afEntry[5];
1269 rkAxis[0] = (Real)1.0;
1270 rkAxis[1] = (Real)0.0;
1271 rkAxis[2] = (Real)0.0;
1292 m_afEntry[0] *= fInvLength;
1293 m_afEntry[3] *= fInvLength;
1294 m_afEntry[6] *= fInvLength;
1297 Real fDot0 = m_afEntry[0]*m_afEntry[1] + m_afEntry[3]*m_afEntry[4] +
1298 m_afEntry[6]*m_afEntry[7];
1300 m_afEntry[1] -= fDot0*m_afEntry[0];
1301 m_afEntry[4] -= fDot0*m_afEntry[3];
1302 m_afEntry[7] -= fDot0*m_afEntry[6];
1305 m_afEntry[4]*m_afEntry[4] + m_afEntry[7]*m_afEntry[7]);
1307 m_afEntry[1] *= fInvLength;
1308 m_afEntry[4] *= fInvLength;
1309 m_afEntry[7] *= fInvLength;
1312 Real fDot1 = m_afEntry[1]*m_afEntry[2] + m_afEntry[4]*m_afEntry[5] +
1313 m_afEntry[7]*m_afEntry[8];
1315 fDot0 = m_afEntry[0]*m_afEntry[2] + m_afEntry[3]*m_afEntry[5] +
1316 m_afEntry[6]*m_afEntry[8];
1318 m_afEntry[2] -= fDot0*m_afEntry[0] + fDot1*m_afEntry[1];
1319 m_afEntry[5] -= fDot0*m_afEntry[3] + fDot1*m_afEntry[4];
1320 m_afEntry[8] -= fDot0*m_afEntry[6] + fDot1*m_afEntry[7];
1323 m_afEntry[5]*m_afEntry[5] + m_afEntry[8]*m_afEntry[8]);
1325 m_afEntry[2] *= fInvLength;
1326 m_afEntry[5] *= fInvLength;
1327 m_afEntry[8] *= fInvLength;
1335 Real afDiag[3], afSubd[2];
1337 bool bReflection = rkRot.Tridiagonalize(afDiag,afSubd);
1338 bool bConverged = rkRot.QLAlgorithm(afDiag,afSubd);
1339 if (!bConverged)
return;
1345 if (afDiag[1] < afDiag[0])
1349 afDiag[0] = afDiag[1];
1353 for (i = 0; i < 3; i++)
1355 fSave = rkRot[i][0];
1356 rkRot[i][0] = rkRot[i][1];
1357 rkRot[i][1] = fSave;
1359 bReflection = !bReflection;
1362 if (afDiag[2] < afDiag[1])
1366 afDiag[1] = afDiag[2];
1370 for (i = 0; i < 3; i++)
1372 fSave = rkRot[i][1];
1373 rkRot[i][1] = rkRot[i][2];
1374 rkRot[i][2] = fSave;
1376 bReflection = !bReflection;
1379 if (afDiag[1] < afDiag[0])
1383 afDiag[0] = afDiag[1];
1387 for (i = 0; i < 3; i++)
1389 fSave = rkRot[i][0];
1390 rkRot[i][0] = rkRot[i][1];
1391 rkRot[i][1] = fSave;
1393 bReflection = !bReflection;
1396 rkDiag.MakeDiagonal(afDiag[0],afDiag[1],afDiag[2]);
1403 rkRot[0][2] = -rkRot[0][2];
1404 rkRot[1][2] = -rkRot[1][2];
1405 rkRot[2][2] = -rkRot[2][2];
1418 (Real)1.0,(Real)0.0,(Real)0.0,
1419 (Real)0.0,fCos,-fSin,
1420 (Real)0.0,fSin,fCos);
1425 fCos,(Real)0.0,fSin,
1426 (Real)0.0,(Real)1.0,(Real)0.0,
1427 -fSin,(Real)0.0,fCos);
1432 fCos,-fSin,(Real)0.0,
1433 fSin,fCos,(Real)0.0,
1434 (Real)0.0,(Real)0.0,(Real)1.0);
1436 *
this = kXMat*(kYMat*kZMat);
1449 (Real)1.0,(Real)0.0,(Real)0.0,
1450 (Real)0.0,fCos,-fSin,
1451 (Real)0.0,fSin,fCos);
1456 fCos,-fSin,(Real)0.0,
1457 fSin,fCos,(Real)0.0,
1458 (Real)0.0,(Real)0.0,(Real)1.0);
1463 fCos,(Real)0.0,fSin,
1464 (Real)0.0,(Real)1.0,(Real)0.0,
1465 -fSin,(Real)0.0,fCos);
1467 *
this = kXMat*(kZMat*kYMat);
1480 fCos,(Real)0.0,fSin,
1481 (Real)0.0,(Real)1.0,(Real)0.0,
1482 -fSin,(Real)0.0,fCos);
1487 (Real)1.0,(Real)0.0,(Real)0.0,
1488 (Real)0.0,fCos,-fSin,
1489 (Real)0.0,fSin,fCos);
1494 fCos,-fSin,(Real)0.0,
1495 fSin,fCos,(Real)0.0,
1496 (Real)0.0,(Real)0.0,(Real)1.0);
1498 *
this = kYMat*(kXMat*kZMat);
1511 fCos,(Real)0.0,fSin,
1512 (Real)0.0,(Real)1.0,(Real)0.0,
1513 -fSin,(Real)0.0,fCos);
1518 fCos,-fSin,(Real)0.0,
1519 fSin,fCos,(Real)0.0,
1520 (Real)0.0,(Real)0.0,(Real)1.0);
1525 (Real)1.0,(Real)0.0,(Real)0.0,
1526 (Real)0.0,fCos,-fSin,
1527 (Real)0.0,fSin,fCos);
1529 *
this = kYMat*(kZMat*kXMat);
1542 fCos,-fSin,(Real)0.0,
1543 fSin,fCos,(Real)0.0,
1544 (Real)0.0,(Real)0.0,(Real)1.0);
1549 (Real)1.0,(Real)0.0,(Real)0.0,
1550 (Real)0.0,fCos,-fSin,
1551 (Real)0.0,fSin,fCos);
1556 fCos,(Real)0.0,fSin,
1557 (Real)0.0,(Real)1.0,(Real)0.0,
1558 -fSin,(Real)0.0,fCos);
1560 *
this = kZMat*(kXMat*kYMat);
1573 fCos,-fSin,(Real)0.0,
1574 fSin,fCos,(Real)0.0,
1575 (Real)0.0,(Real)0.0,(Real)1.0);
1580 fCos,(Real)0.0,fSin,
1581 (Real)0.0,(Real)1.0,(Real)0.0,
1582 -fSin,(Real)0.0,fCos);
1587 (Real)1.0,(Real)0.0,(Real)0.0,
1588 (Real)0.0,fCos,-fSin,
1589 (Real)0.0,fSin,fCos);
1591 *
this = kZMat*(kYMat*kXMat);
1597 Real& rfZAngle)
const
1608 rfYAngle = (Real)asin((
double)
m_afEntry[2]);
1617 rfZAngle = (Real)0.0;
1626 rfZAngle = (Real)0.0;
1633 Real& rfYAngle)
const
1644 rfZAngle = (Real)asin(-(
double)
m_afEntry[1]);
1653 rfYAngle = (Real)0.0;
1662 rfYAngle = (Real)0.0;
1669 Real& rfZAngle)
const
1680 rfXAngle = (Real)asin(-(
double)
m_afEntry[5]);
1689 rfZAngle = (Real)0.0;
1698 rfZAngle = (Real)0.0;
1705 Real& rfXAngle)
const
1716 rfZAngle = (Real)asin((
double)
m_afEntry[3]);
1725 rfXAngle = (Real)0.0;
1734 rfXAngle = (Real)0.0;
1741 Real& rfYAngle)
const
1752 rfXAngle = (Real)asin((
double)
m_afEntry[7]);
1761 rfYAngle = (Real)0.0;
1770 rfYAngle = (Real)0.0;
1777 Real& rfXAngle)
const
1788 rfYAngle = (Real)asin(-(
double)
m_afEntry[6]);
1797 rfXAngle = (Real)0.0;
1806 rfXAngle = (Real)0.0;
1817 moMatrix3 kProd = rkR0.TransposeTimes(rkR1);
1818 kProd.ToAxisAngle(kAxis,fAngle);
1831 Bidiagonalize(kA,rkL,rkRTranspose);
1834 const int iMax = 32;
1835 const Real fEpsilon = (Real)1e-04;
1836 for (
int i = 0; i < iMax; i++)
1838 Real fTmp, fTmp0, fTmp1;
1839 Real fSin0, fCos0, fTan0;
1840 Real fSin1, fCos1, fTan1;
1852 rkD[0][0] = kA[0][0];
1853 rkD[1][1] = kA[1][1];
1854 rkD[2][2] = kA[2][2];
1860 fTmp = (kA[1][1]*kA[1][1] - kA[2][2]*kA[2][2] +
1861 kA[1][2]*kA[1][2])/(kA[1][2]*kA[2][2]);
1865 fSin0 = fTan0*fCos0;
1867 for (iCol = 0; iCol < 3; iCol++)
1869 fTmp0 = rkL[iCol][1];
1870 fTmp1 = rkL[iCol][2];
1871 rkL[iCol][1] = fCos0*fTmp0-fSin0*fTmp1;
1872 rkL[iCol][2] = fSin0*fTmp0+fCos0*fTmp1;
1875 fTan1 = (kA[1][2]-kA[2][2]*fTan0)/kA[1][1];
1877 fSin1 = -fTan1*fCos1;
1879 for (iRow = 0; iRow < 3; iRow++)
1881 fTmp0 = rkRTranspose[1][iRow];
1882 fTmp1 = rkRTranspose[2][iRow];
1883 rkRTranspose[1][iRow] = fCos1*fTmp0-fSin1*fTmp1;
1884 rkRTranspose[2][iRow] = fSin1*fTmp0+fCos1*fTmp1;
1887 rkD[0][0] = kA[0][0];
1888 rkD[1][1] = fCos0*fCos1*kA[1][1] -
1889 fSin1*(fCos0*kA[1][2]-fSin0*kA[2][2]);
1890 rkD[2][2] = fSin0*fSin1*kA[1][1] +
1891 fCos1*(fSin0*kA[1][2]+fCos0*kA[2][2]);
1900 fTmp = (kA[0][0]*kA[0][0] + kA[1][1]*kA[1][1] -
1901 kA[0][1]*kA[0][1])/(kA[0][1]*kA[1][1]);
1905 fSin0 = fTan0*fCos0;
1907 for (iCol = 0; iCol < 3; iCol++)
1909 fTmp0 = rkL[iCol][0];
1910 fTmp1 = rkL[iCol][1];
1911 rkL[iCol][0] = fCos0*fTmp0-fSin0*fTmp1;
1912 rkL[iCol][1] = fSin0*fTmp0+fCos0*fTmp1;
1915 fTan1 = (kA[0][1]-kA[1][1]*fTan0)/kA[0][0];
1917 fSin1 = -fTan1*fCos1;
1919 for (iRow = 0; iRow < 3; iRow++)
1921 fTmp0 = rkRTranspose[0][iRow];
1922 fTmp1 = rkRTranspose[1][iRow];
1923 rkRTranspose[0][iRow] = fCos1*fTmp0-fSin1*fTmp1;
1924 rkRTranspose[1][iRow] = fSin1*fTmp0+fCos1*fTmp1;
1927 rkD[0][0] = fCos0*fCos1*kA[0][0] -
1928 fSin1*(fCos0*kA[0][1]-fSin0*kA[1][1]);
1929 rkD[1][1] = fSin0*fSin1*kA[0][0] +
1930 fCos1*(fSin0*kA[0][1]+fCos0*kA[1][1]);
1931 rkD[2][2] = kA[2][2];
1936 GolubKahanStep(kA,rkL,rkRTranspose);
1942 for (iRow = 0; iRow < 3; iRow++)
1944 if (rkD[iRow][iRow] < (Real)0.0)
1946 rkD[iRow][iRow] = -rkD[iRow][iRow];
1947 for (iCol = 0; iCol < 3; iCol++)
1949 rkRTranspose[iRow][iCol] = -rkRTranspose[iRow][iCol];
1959 *
this = rkL*(rkD*rkRTranspose);
1970 rkQ = kL*kRTranspose;
1973 rkS = kRTranspose.TransposeTimes(kD*kRTranspose);
1978 rkS[0][1] = ((Real)0.5)*(rkS[0][1] + rkS[1][0]);
1979 rkS[1][0] = rkS[0][1];
1980 rkS[0][2] = ((Real)0.5)*(rkS[0][2] + rkS[2][0]);
1981 rkS[2][0] = rkS[0][2];
1982 rkS[1][2] = ((Real)0.5)*(rkS[1][2] + rkS[2][1]);
1983 rkS[2][1] = rkS[1][2];
2014 rkQ[0][0] = m_afEntry[0]*fInvLength;
2015 rkQ[1][0] = m_afEntry[3]*fInvLength;
2016 rkQ[2][0] = m_afEntry[6]*fInvLength;
2018 Real fDot = rkQ[0][0]*m_afEntry[1] + rkQ[1][0]*m_afEntry[4] +
2019 rkQ[2][0]*m_afEntry[7];
2020 rkQ[0][1] = m_afEntry[1]-fDot*rkQ[0][0];
2021 rkQ[1][1] = m_afEntry[4]-fDot*rkQ[1][0];
2022 rkQ[2][1] = m_afEntry[7]-fDot*rkQ[2][0];
2024 rkQ[1][1]*rkQ[1][1] + rkQ[2][1]*rkQ[2][1]);
2025 rkQ[0][1] *= fInvLength;
2026 rkQ[1][1] *= fInvLength;
2027 rkQ[2][1] *= fInvLength;
2029 fDot = rkQ[0][0]*m_afEntry[2] + rkQ[1][0]*m_afEntry[5] +
2030 rkQ[2][0]*m_afEntry[8];
2031 rkQ[0][2] = m_afEntry[2]-fDot*rkQ[0][0];
2032 rkQ[1][2] = m_afEntry[5]-fDot*rkQ[1][0];
2033 rkQ[2][2] = m_afEntry[8]-fDot*rkQ[2][0];
2034 fDot = rkQ[0][1]*m_afEntry[2] + rkQ[1][1]*m_afEntry[5] +
2035 rkQ[2][1]*m_afEntry[8];
2036 rkQ[0][2] -= fDot*rkQ[0][1];
2037 rkQ[1][2] -= fDot*rkQ[1][1];
2038 rkQ[2][2] -= fDot*rkQ[2][1];
2040 rkQ[1][2]*rkQ[1][2] + rkQ[2][2]*rkQ[2][2]);
2041 rkQ[0][2] *= fInvLength;
2042 rkQ[1][2] *= fInvLength;
2043 rkQ[2][2] *= fInvLength;
2046 Real fDet = rkQ[0][0]*rkQ[1][1]*rkQ[2][2] + rkQ[0][1]*rkQ[1][2]*rkQ[2][0]
2047 + rkQ[0][2]*rkQ[1][0]*rkQ[2][1] - rkQ[0][2]*rkQ[1][1]*rkQ[2][0]
2048 - rkQ[0][1]*rkQ[1][0]*rkQ[2][2] - rkQ[0][0]*rkQ[1][2]*rkQ[2][1];
2050 if (fDet < (Real)0.0)
2052 for (
int iRow = 0; iRow < 3; iRow++)
2054 for (
int iCol = 0; iCol < 3; iCol++)
2056 rkQ[iRow][iCol] = -rkQ[iRow][iCol];
2063 kR[0][0] = rkQ[0][0]*m_afEntry[0] + rkQ[1][0]*m_afEntry[3] +
2064 rkQ[2][0]*m_afEntry[6];
2065 kR[0][1] = rkQ[0][0]*m_afEntry[1] + rkQ[1][0]*m_afEntry[4] +
2066 rkQ[2][0]*m_afEntry[7];
2067 kR[1][1] = rkQ[0][1]*m_afEntry[1] + rkQ[1][1]*m_afEntry[4] +
2068 rkQ[2][1]*m_afEntry[7];
2069 kR[0][2] = rkQ[0][0]*m_afEntry[2] + rkQ[1][0]*m_afEntry[5] +
2070 rkQ[2][0]*m_afEntry[8];
2071 kR[1][2] = rkQ[0][1]*m_afEntry[2] + rkQ[1][1]*m_afEntry[5] +
2072 rkQ[2][1]*m_afEntry[8];
2073 kR[2][2] = rkQ[0][2]*m_afEntry[2] + rkQ[1][2]*m_afEntry[5] +
2074 rkQ[2][2]*m_afEntry[8];
2077 rkD.MakeDiagonal(kR[0][0],kR[1][1],kR[2][2]);
2080 Real fInvD0 = ((Real)1.0)/rkD[0][0];
2081 rkU[0][0] = (Real)1.0;
2082 rkU[0][1] = kR[0][1]*fInvD0;
2083 rkU[0][2] = kR[0][2]*fInvD0;
2084 rkU[1][0] = (Real)0.0;
2085 rkU[1][1] = (Real)1.0;
2086 rkU[1][2] = kR[1][2]/rkD[1][1];
2087 rkU[2][0] = (Real)0.0;
2088 rkU[2][1] = (Real)0.0;
2089 rkU[2][2] = (Real)1.0;
2121 return moMatrix3<Real>(
2134 return moMatrix3<Real>(
2147 return moMatrix3<Real>(
2186 return moMatrix3<Real>(
2188 fScalar*m_afEntry[1],
2189 fScalar*m_afEntry[2],
2190 fScalar*m_afEntry[3],
2191 fScalar*m_afEntry[4],
2192 fScalar*m_afEntry[5],
2193 fScalar*m_afEntry[6],
2194 fScalar*m_afEntry[7],
2195 fScalar*m_afEntry[8]);
2199 if (fScalar != (Real)0.0)
2201 Real fInvScalar = ((Real)1.0)/fScalar;
2202 return moMatrix3<Real>(
2204 fInvScalar*m_afEntry[1],
2205 fInvScalar*m_afEntry[2],
2206 fInvScalar*m_afEntry[3],
2207 fInvScalar*m_afEntry[4],
2208 fInvScalar*m_afEntry[5],
2209 fInvScalar*m_afEntry[6],
2210 fInvScalar*m_afEntry[7],
2211 fInvScalar*m_afEntry[8]);
2214 return moMatrix3<Real>(
2216 moMath<Real>::MAX_REAL,
2217 moMath<Real>::MAX_REAL,
2218 moMath<Real>::MAX_REAL,
2219 moMath<Real>::MAX_REAL,
2220 moMath<Real>::MAX_REAL,
2221 moMath<Real>::MAX_REAL,
2222 moMath<Real>::MAX_REAL,
2223 moMath<Real>::MAX_REAL);
2227 return moMatrix3<Real>(
2281 if (fScalar != (Real)0.0)
2283 Real fInvScalar = ((Real)1.0)/fScalar;
2332 bool Tridiagonalize (Real afDiag[3], Real afSubd[2])
2353 Real fInvLength = ((Real)1.0)/afSubd[0];
2356 Real fTmp = ((Real)2.0)*fM01*fM12+fM02*(fM22-fM11);
2357 afDiag[1] = fM11+fM02*fTmp;
2358 afDiag[2] = fM22-fM02*fTmp;
2359 afSubd[1] = fM12-fM01*fTmp;
2393 bool QLAlgorithm (Real afDiag[3], Real afSubd[2])
2402 const int iMax = 32;
2403 for (
int i = 0; i < iMax; i++)
2405 Real fSum, fDiff, fDiscr, fEValue0, fEValue1, fCos, fSin, fTmp;
2419 fSum = afDiag[1] + afDiag[2];
2420 fDiff = afDiag[1] - afDiag[2];
2422 ((Real)4.0)*afSubd[1]*afSubd[1]);
2423 fEValue0 = ((Real)0.5)*(fSum - fDiscr);
2424 fEValue1 = ((Real)0.5)*(fSum + fDiscr);
2427 if (fDiff >= (Real)0.0)
2430 fSin = afDiag[1] - fEValue0;
2434 fCos = afDiag[2] - fEValue0;
2443 for (iRow = 0; iRow < 3; iRow++)
2451 afDiag[1] = fEValue0;
2452 afDiag[2] = fEValue1;
2453 afSubd[0] = (Real)0.0;
2454 afSubd[1] = (Real)0.0;
2469 fSum = afDiag[0] + afDiag[1];
2470 fDiff = afDiag[0] - afDiag[1];
2472 ((Real)4.0)*afSubd[0]*afSubd[0]);
2473 fEValue0 = ((Real)0.5)*(fSum - fDiscr);
2474 fEValue1 = ((Real)0.5)*(fSum + fDiscr);
2477 if (fDiff >= (Real)0.0)
2480 fSin = afDiag[0] - fEValue0;
2484 fCos = afDiag[1] - fEValue0;
2493 for (iRow = 0; iRow < 3; iRow++)
2501 afDiag[0] = fEValue0;
2502 afDiag[1] = fEValue1;
2503 afSubd[0] = (Real)0.0;
2504 afSubd[1] = (Real)0.0;
2516 Real fRatio = (afDiag[1]-afDiag[0])/(((Real)2.0f)*afSubd[0]);
2518 Real fB = afSubd[1];
2519 Real fA = afDiag[2] - afDiag[0];
2520 if (fRatio >= (Real)0.0)
2522 fA += afSubd[0]/(fRatio + fRoot);
2526 fA += afSubd[0]/(fRatio - fRoot);
2545 for (iRow = 0; iRow < 3; iRow++)
2555 Real fTmp0 = (afDiag[1] - afDiag[2])*fSin +
2556 ((Real)2.0)*afSubd[1]*fCos;
2557 Real fTmp1 = fCos*afSubd[0];
2558 fB = fSin*afSubd[0];
2559 fA = fCos*fTmp0 - afSubd[1];
2568 afSubd[1] = fB*fRoot;
2569 fSin = ((Real)1.0)/fRoot;
2576 afSubd[1] = fA*fRoot;
2577 fCos = ((Real)1.0)/fRoot;
2583 for (iRow = 0; iRow < 3; iRow++)
2591 Real fTmp2 = afDiag[1] - fTmp0;
2593 fTmp0 = (afDiag[0] - fTmp2)*fSin + ((Real)2.0)*fTmp1*fCos;
2594 afSubd[0] = fCos*fTmp0 - fTmp1;
2596 afDiag[1] = fTmp2 + fTmp0;
2608 Real afV[3], afW[3];
2609 Real fLength, fSign, fT1, fInvT1, fT2;
2614 rkA[2][0]*rkA[2][0]);
2615 if (fLength > (Real)0.0)
2617 fSign = (rkA[0][0] > (Real)0.0 ? (Real)1.0 : -(Real)1.0);
2618 fT1 = rkA[0][0] + fSign*fLength;
2619 fInvT1 = ((Real)1.0)/fT1;
2620 afV[1] = rkA[1][0]*fInvT1;
2621 afV[2] = rkA[2][0]*fInvT1;
2623 fT2 = -((Real)2.0)/(((Real)1.0)+afV[1]*afV[1]+afV[2]*afV[2]);
2624 afW[0] = fT2*(rkA[0][0]+rkA[1][0]*afV[1]+rkA[2][0]*afV[2]);
2625 afW[1] = fT2*(rkA[0][1]+rkA[1][1]*afV[1]+rkA[2][1]*afV[2]);
2626 afW[2] = fT2*(rkA[0][2]+rkA[1][2]*afV[1]+rkA[2][2]*afV[2]);
2627 rkA[0][0] += afW[0];
2628 rkA[0][1] += afW[1];
2629 rkA[0][2] += afW[2];
2630 rkA[1][1] += afV[1]*afW[1];
2631 rkA[1][2] += afV[1]*afW[2];
2632 rkA[2][1] += afV[2]*afW[1];
2633 rkA[2][2] += afV[2]*afW[2];
2635 rkL[0][0] = ((Real)1.0)+fT2;
2636 rkL[0][1] = fT2*afV[1];
2637 rkL[1][0] = rkL[0][1];
2638 rkL[0][2] = fT2*afV[2];
2639 rkL[2][0] = rkL[0][2];
2640 rkL[1][1] = ((Real)1.0)+fT2*afV[1]*afV[1];
2641 rkL[1][2] = fT2*afV[1]*afV[2];
2642 rkL[2][1] = rkL[1][2];
2643 rkL[2][2] = ((Real)1.0)+fT2*afV[2]*afV[2];
2648 rkL = moMatrix3::IDENTITY;
2654 if (fLength > (Real)0.0)
2656 fSign = (rkA[0][1] > (Real)0.0 ? (Real)1.0 : -(Real)1.0);
2657 fT1 = rkA[0][1] + fSign*fLength;
2658 afV[2] = rkA[0][2]/fT1;
2660 fT2 = -((Real)2.0)/(((Real)1.0)+afV[2]*afV[2]);
2661 afW[0] = fT2*(rkA[0][1]+rkA[0][2]*afV[2]);
2662 afW[1] = fT2*(rkA[1][1]+rkA[1][2]*afV[2]);
2663 afW[2] = fT2*(rkA[2][1]+rkA[2][2]*afV[2]);
2664 rkA[0][1] += afW[0];
2665 rkA[1][1] += afW[1];
2666 rkA[1][2] += afW[1]*afV[2];
2667 rkA[2][1] += afW[2];
2668 rkA[2][2] += afW[2]*afV[2];
2670 rkR[0][0] = (Real)1.0;
2671 rkR[0][1] = (Real)0.0;
2672 rkR[1][0] = (Real)0.0;
2673 rkR[0][2] = (Real)0.0;
2674 rkR[2][0] = (Real)0.0;
2675 rkR[1][1] = ((Real)1.0)+fT2;
2676 rkR[1][2] = fT2*afV[2];
2677 rkR[2][1] = rkR[1][2];
2678 rkR[2][2] = ((Real)1.0)+fT2*afV[2]*afV[2];
2682 rkR = moMatrix3::IDENTITY;
2687 if (fLength > (Real)0.0)
2689 fSign = (rkA[1][1] > (Real)0.0 ? (Real)1.0 : -(Real)1.0);
2690 fT1 = rkA[1][1] + fSign*fLength;
2691 afV[2] = rkA[2][1]/fT1;
2693 fT2 = -((Real)2.0)/(((Real)1.0)+afV[2]*afV[2]);
2694 afW[1] = fT2*(rkA[1][1]+rkA[2][1]*afV[2]);
2695 afW[2] = fT2*(rkA[1][2]+rkA[2][2]*afV[2]);
2696 rkA[1][1] += afW[1];
2697 rkA[1][2] += afW[2];
2698 rkA[2][2] += afV[2]*afW[2];
2700 Real fA = ((Real)1.0)+fT2;
2701 Real fB = fT2*afV[2];
2702 Real fC = ((Real)1.0)+fB*afV[2];
2706 rkL[0][0] = (Real)1.0;
2707 rkL[0][1] = (Real)0.0;
2708 rkL[1][0] = (Real)0.0;
2709 rkL[0][2] = (Real)0.0;
2710 rkL[2][0] = (Real)0.0;
2718 for (
int iRow = 0; iRow < 3; iRow++)
2720 Real fTmp0 = rkL[iRow][1];
2721 Real fTmp1 = rkL[iRow][2];
2722 rkL[iRow][1] = fA*fTmp0+fB*fTmp1;
2723 rkL[iRow][2] = fB*fTmp0+fC*fTmp1;
2733 Real fT11 = rkA[0][1]*rkA[0][1]+rkA[1][1]*rkA[1][1];
2734 Real fT22 = rkA[1][2]*rkA[1][2]+rkA[2][2]*rkA[2][2];
2735 Real fT12 = rkA[1][1]*rkA[1][2];
2736 Real fTrace = fT11+fT22;
2737 Real fDiff = fT11-fT22;
2739 Real fRoot1 = ((Real)0.5)*(fTrace+fDiscr);
2740 Real fRoot2 = ((Real)0.5)*(fTrace-fDiscr);
2745 Real fZ = rkA[0][1];
2747 Real fSin = fZ*fInvLength;
2748 Real fCos = -fY*fInvLength;
2750 Real fTmp0 = rkA[0][0];
2751 Real fTmp1 = rkA[0][1];
2752 rkA[0][0] = fCos*fTmp0-fSin*fTmp1;
2753 rkA[0][1] = fSin*fTmp0+fCos*fTmp1;
2754 rkA[1][0] = -fSin*rkA[1][1];
2758 for (iRow = 0; iRow < 3; iRow++)
2760 fTmp0 = rkR[0][iRow];
2761 fTmp1 = rkR[1][iRow];
2762 rkR[0][iRow] = fCos*fTmp0-fSin*fTmp1;
2763 rkR[1][iRow] = fSin*fTmp0+fCos*fTmp1;
2770 fSin = fZ*fInvLength;
2771 fCos = -fY*fInvLength;
2773 rkA[0][0] = fCos*rkA[0][0]-fSin*rkA[1][0];
2776 rkA[0][1] = fCos*fTmp0-fSin*fTmp1;
2777 rkA[1][1] = fSin*fTmp0+fCos*fTmp1;
2778 rkA[0][2] = -fSin*rkA[1][2];
2782 for (iCol = 0; iCol < 3; iCol++)
2784 fTmp0 = rkL[iCol][0];
2785 fTmp1 = rkL[iCol][1];
2786 rkL[iCol][0] = fCos*fTmp0-fSin*fTmp1;
2787 rkL[iCol][1] = fSin*fTmp0+fCos*fTmp1;
2794 fSin = fZ*fInvLength;
2795 fCos = -fY*fInvLength;
2797 rkA[0][1] = fCos*rkA[0][1]-fSin*rkA[0][2];
2800 rkA[1][1] = fCos*fTmp0-fSin*fTmp1;
2801 rkA[1][2] = fSin*fTmp0+fCos*fTmp1;
2802 rkA[2][1] = -fSin*rkA[2][2];
2805 for (iRow = 0; iRow < 3; iRow++)
2807 fTmp0 = rkR[1][iRow];
2808 fTmp1 = rkR[2][iRow];
2809 rkR[1][iRow] = fCos*fTmp0-fSin*fTmp1;
2810 rkR[2][iRow] = fSin*fTmp0+fCos*fTmp1;
2817 fSin = fZ*fInvLength;
2818 fCos = -fY*fInvLength;
2820 rkA[1][1] = fCos*rkA[1][1]-fSin*rkA[2][1];
2823 rkA[1][2] = fCos*fTmp0-fSin*fTmp1;
2824 rkA[2][2] = fSin*fTmp0+fCos*fTmp1;
2826 for (iCol = 0; iCol < 3; iCol++)
2828 fTmp0 = rkL[iCol][1];
2829 fTmp1 = rkL[iCol][2];
2830 rkL[iCol][1] = fCos*fTmp0-fSin*fTmp1;
2831 rkL[iCol][2] = fSin*fTmp0+fCos*fTmp1;
2836 int CompareArrays (
const moMatrix3& rkM)
const
2838 return memcmp(
m_afEntry,rkM.m_afEntry,9*
sizeof(Real));
2845 template <
class Real>
2846 inline moMatrix3<Real>
operator* (Real fScalar,
const moMatrix3<Real>& rkM)
2852 template <
class Real>
2854 const moMatrix3<Real>& rkM)
2857 rkV[0]*rkM[0][0] + rkV[1]*rkM[1][0] + rkV[2]*rkM[2][0],
2858 rkV[0]*rkM[0][1] + rkV[1]*rkM[1][1] + rkV[2]*rkM[2][1],
2859 rkV[0]*rkM[0][2] + rkV[1]*rkM[1][2] + rkV[2]*rkM[2][2]);
2886 template <
class Real>
2892 moMatrix4 (
bool bZero =
true)
2905 moMatrix4 (
const moMatrix4& rkM) : moAbstract()
2926 moMatrix4 (Real fM00, Real fM01, Real fM02, Real fM03,
2927 Real fM10, Real fM11, Real fM12, Real fM13,
2928 Real fM20, Real fM21, Real fM22, Real fM23,
2929 Real fM30, Real fM31, Real fM32, Real fM33) {
2948 moMatrix4 (
const Real afEntry[16],
bool bRowMajor =
true )
3008 (*this) = moMatrix4::ZERO;
3030 (*this) = moMatrix4::IDENTITY;
3036 int i0 = 4*iRow, i1 = i0+1, i2 = i1+1, i3 = i2+1;
3045 int i0 = 4*iRow, i1 = i0+1, i2 = i1+1, i3 = i2+1;
3061 m_afEntry[iCol+12]);
3086 return CompareArrays(rkM) == 0;
3091 return CompareArrays(rkM) != 0;
3094 bool operator< (
const moMatrix4& rkM)
const
3096 return CompareArrays(rkM) < 0;
3101 return CompareArrays(rkM) <= 0;
3104 bool operator> (
const moMatrix4& rkM)
const
3106 return CompareArrays(rkM) > 0;
3111 return CompareArrays(rkM) >= 0;
3116 return moMatrix4<Real>(
3138 return moMatrix4<Real>(
3223 return moMatrix4<Real>(
3305 moMatrix4<Real>
Inverse ()
const
3308 Real fA1 = m_afEntry[ 0]*m_afEntry[ 6] - m_afEntry[ 2]*m_afEntry[ 4];
3309 Real fA2 = m_afEntry[ 0]*m_afEntry[ 7] - m_afEntry[ 3]*m_afEntry[ 4];
3310 Real fA3 = m_afEntry[ 1]*m_afEntry[ 6] - m_afEntry[ 2]*m_afEntry[ 5];
3311 Real fA4 = m_afEntry[ 1]*m_afEntry[ 7] - m_afEntry[ 3]*m_afEntry[ 5];
3312 Real fA5 = m_afEntry[ 2]*m_afEntry[ 7] - m_afEntry[ 3]*m_afEntry[ 6];
3313 Real fB0 = m_afEntry[ 8]*m_afEntry[13] - m_afEntry[ 9]*m_afEntry[12];
3314 Real fB1 = m_afEntry[ 8]*m_afEntry[14] - m_afEntry[10]*m_afEntry[12];
3315 Real fB2 = m_afEntry[ 8]*m_afEntry[15] - m_afEntry[11]*m_afEntry[12];
3316 Real fB3 = m_afEntry[ 9]*m_afEntry[14] - m_afEntry[10]*m_afEntry[13];
3317 Real fB4 = m_afEntry[ 9]*m_afEntry[15] - m_afEntry[11]*m_afEntry[13];
3318 Real fB5 = m_afEntry[10]*m_afEntry[15] - m_afEntry[11]*m_afEntry[14];
3320 Real fDet = fA0*fB5-fA1*fB4+fA2*fB3+fA3*fB2-fA4*fB1+fA5*fB0;
3323 return moMatrix4<Real>::ZERO;
3327 kInv.m_afEntry[ 0] =
3328 + m_afEntry[ 5]*fB5 - m_afEntry[ 6]*fB4 + m_afEntry[ 7]*fB3;
3329 kInv.m_afEntry[ 4] =
3330 - m_afEntry[ 4]*fB5 + m_afEntry[ 6]*fB2 - m_afEntry[ 7]*fB1;
3331 kInv.m_afEntry[ 8] =
3332 + m_afEntry[ 4]*fB4 - m_afEntry[ 5]*fB2 + m_afEntry[ 7]*fB0;
3333 kInv.m_afEntry[12] =
3334 - m_afEntry[ 4]*fB3 + m_afEntry[ 5]*fB1 - m_afEntry[ 6]*fB0;
3335 kInv.m_afEntry[ 1] =
3336 - m_afEntry[ 1]*fB5 + m_afEntry[ 2]*fB4 - m_afEntry[ 3]*fB3;
3337 kInv.m_afEntry[ 5] =
3338 + m_afEntry[ 0]*fB5 - m_afEntry[ 2]*fB2 + m_afEntry[ 3]*fB1;
3339 kInv.m_afEntry[ 9] =
3340 - m_afEntry[ 0]*fB4 + m_afEntry[ 1]*fB2 - m_afEntry[ 3]*fB0;
3341 kInv.m_afEntry[13] =
3342 + m_afEntry[ 0]*fB3 - m_afEntry[ 1]*fB1 + m_afEntry[ 2]*fB0;
3343 kInv.m_afEntry[ 2] =
3344 + m_afEntry[13]*fA5 - m_afEntry[14]*fA4 + m_afEntry[15]*fA3;
3345 kInv.m_afEntry[ 6] =
3346 - m_afEntry[12]*fA5 + m_afEntry[14]*fA2 - m_afEntry[15]*fA1;
3347 kInv.m_afEntry[10] =
3348 + m_afEntry[12]*fA4 - m_afEntry[13]*fA2 + m_afEntry[15]*fA0;
3349 kInv.m_afEntry[14] =
3350 - m_afEntry[12]*fA3 + m_afEntry[13]*fA1 - m_afEntry[14]*fA0;
3351 kInv.m_afEntry[ 3] =
3352 - m_afEntry[ 9]*fA5 + m_afEntry[10]*fA4 - m_afEntry[11]*fA3;
3353 kInv.m_afEntry[ 7] =
3354 + m_afEntry[ 8]*fA5 - m_afEntry[10]*fA2 + m_afEntry[11]*fA1;
3355 kInv.m_afEntry[11] =
3356 - m_afEntry[ 8]*fA4 + m_afEntry[ 9]*fA2 - m_afEntry[11]*fA0;
3357 kInv.m_afEntry[15] =
3358 + m_afEntry[ 8]*fA3 - m_afEntry[ 9]*fA1 + m_afEntry[10]*fA0;
3360 Real fInvDet = ((Real)1.0)/fDet;
3361 kInv.m_afEntry[ 0] *= fInvDet;
3362 kInv.m_afEntry[ 1] *= fInvDet;
3363 kInv.m_afEntry[ 2] *= fInvDet;
3364 kInv.m_afEntry[ 3] *= fInvDet;
3365 kInv.m_afEntry[ 4] *= fInvDet;
3366 kInv.m_afEntry[ 5] *= fInvDet;
3367 kInv.m_afEntry[ 6] *= fInvDet;
3368 kInv.m_afEntry[ 7] *= fInvDet;
3369 kInv.m_afEntry[ 8] *= fInvDet;
3370 kInv.m_afEntry[ 9] *= fInvDet;
3371 kInv.m_afEntry[10] *= fInvDet;
3372 kInv.m_afEntry[11] *= fInvDet;
3373 kInv.m_afEntry[12] *= fInvDet;
3374 kInv.m_afEntry[13] *= fInvDet;
3375 kInv.m_afEntry[14] *= fInvDet;
3376 kInv.m_afEntry[15] *= fInvDet;
3381 moMatrix4<Real>
Adjoint ()
const
3383 Real fA0 = m_afEntry[ 0]*m_afEntry[ 5] - m_afEntry[ 1]*m_afEntry[ 4];
3384 Real fA1 = m_afEntry[ 0]*m_afEntry[ 6] - m_afEntry[ 2]*m_afEntry[ 4];
3385 Real fA2 = m_afEntry[ 0]*m_afEntry[ 7] - m_afEntry[ 3]*m_afEntry[ 4];
3386 Real fA3 = m_afEntry[ 1]*m_afEntry[ 6] - m_afEntry[ 2]*m_afEntry[ 5];
3387 Real fA4 = m_afEntry[ 1]*m_afEntry[ 7] - m_afEntry[ 3]*m_afEntry[ 5];
3388 Real fA5 = m_afEntry[ 2]*m_afEntry[ 7] - m_afEntry[ 3]*m_afEntry[ 6];
3389 Real fB0 = m_afEntry[ 8]*m_afEntry[13] - m_afEntry[ 9]*m_afEntry[12];
3390 Real fB1 = m_afEntry[ 8]*m_afEntry[14] - m_afEntry[10]*m_afEntry[12];
3391 Real fB2 = m_afEntry[ 8]*m_afEntry[15] - m_afEntry[11]*m_afEntry[12];
3392 Real fB3 = m_afEntry[ 9]*m_afEntry[14] - m_afEntry[10]*m_afEntry[13];
3393 Real fB4 = m_afEntry[ 9]*m_afEntry[15] - m_afEntry[11]*m_afEntry[13];
3394 Real fB5 = m_afEntry[10]*m_afEntry[15] - m_afEntry[11]*m_afEntry[14];
3396 return moMatrix4<Real>(
3397 + m_afEntry[ 5]*fB5 - m_afEntry[ 6]*fB4 + m_afEntry[ 7]*fB3,
3398 - m_afEntry[ 1]*fB5 + m_afEntry[ 2]*fB4 - m_afEntry[ 3]*fB3,
3399 + m_afEntry[13]*fA5 - m_afEntry[14]*fA4 + m_afEntry[15]*fA3,
3400 - m_afEntry[ 9]*fA5 + m_afEntry[10]*fA4 - m_afEntry[11]*fA3,
3401 - m_afEntry[ 4]*fB5 + m_afEntry[ 6]*fB2 - m_afEntry[ 7]*fB1,
3402 + m_afEntry[ 0]*fB5 - m_afEntry[ 2]*fB2 + m_afEntry[ 3]*fB1,
3403 - m_afEntry[12]*fA5 + m_afEntry[14]*fA2 - m_afEntry[15]*fA1,
3404 + m_afEntry[ 8]*fA5 - m_afEntry[10]*fA2 + m_afEntry[11]*fA1,
3405 + m_afEntry[ 4]*fB4 - m_afEntry[ 5]*fB2 + m_afEntry[ 7]*fB0,
3406 - m_afEntry[ 0]*fB4 + m_afEntry[ 1]*fB2 - m_afEntry[ 3]*fB0,
3407 + m_afEntry[12]*fA4 - m_afEntry[13]*fA2 + m_afEntry[15]*fA0,
3408 - m_afEntry[ 8]*fA4 + m_afEntry[ 9]*fA2 - m_afEntry[11]*fA0,
3409 - m_afEntry[ 4]*fB3 + m_afEntry[ 5]*fB1 - m_afEntry[ 6]*fB0,
3410 + m_afEntry[ 0]*fB3 - m_afEntry[ 1]*fB1 + m_afEntry[ 2]*fB0,
3411 - m_afEntry[12]*fA3 + m_afEntry[13]*fA1 - m_afEntry[14]*fA0,
3412 + m_afEntry[ 8]*fA3 - m_afEntry[ 9]*fA1 + m_afEntry[10]*fA0);
3417 Real fA0 = m_afEntry[ 0]*m_afEntry[ 5] - m_afEntry[ 1]*m_afEntry[ 4];
3418 Real fA1 = m_afEntry[ 0]*m_afEntry[ 6] - m_afEntry[ 2]*m_afEntry[ 4];
3419 Real fA2 = m_afEntry[ 0]*m_afEntry[ 7] - m_afEntry[ 3]*m_afEntry[ 4];
3420 Real fA3 = m_afEntry[ 1]*m_afEntry[ 6] - m_afEntry[ 2]*m_afEntry[ 5];
3421 Real fA4 = m_afEntry[ 1]*m_afEntry[ 7] - m_afEntry[ 3]*m_afEntry[ 5];
3422 Real fA5 = m_afEntry[ 2]*m_afEntry[ 7] - m_afEntry[ 3]*m_afEntry[ 6];
3423 Real fB0 = m_afEntry[ 8]*m_afEntry[13] - m_afEntry[ 9]*m_afEntry[12];
3424 Real fB1 = m_afEntry[ 8]*m_afEntry[14] - m_afEntry[10]*m_afEntry[12];
3425 Real fB2 = m_afEntry[ 8]*m_afEntry[15] - m_afEntry[11]*m_afEntry[12];
3426 Real fB3 = m_afEntry[ 9]*m_afEntry[14] - m_afEntry[10]*m_afEntry[13];
3427 Real fB4 = m_afEntry[ 9]*m_afEntry[15] - m_afEntry[11]*m_afEntry[13];
3428 Real fB5 = m_afEntry[10]*m_afEntry[15] - m_afEntry[11]*m_afEntry[14];
3429 Real fDet = fA0*fB5-fA1*fB4+fA2*fB3+fA3*fB2-fA4*fB1+fA5*fB0;
3436 return rkU.
Dot((*
this)*rkV);
3462 Real fNdD = rkNormal.
Dot(rkDirection);
3463 Real fNdP = rkNormal.
Dot(rkPoint);
3464 m_afEntry[ 0] = rkDirection[0]*rkNormal[0] - fNdD;
3465 m_afEntry[ 1] = rkDirection[0]*rkNormal[1];
3466 m_afEntry[ 2] = rkDirection[0]*rkNormal[2];
3467 m_afEntry[ 3] = -fNdP*rkDirection[0];
3468 m_afEntry[ 4] = rkDirection[1]*rkNormal[0];
3469 m_afEntry[ 5] = rkDirection[1]*rkNormal[1] - fNdD;
3470 m_afEntry[ 6] = rkDirection[1]*rkNormal[2];
3471 m_afEntry[ 7] = -fNdP*rkDirection[1];
3472 m_afEntry[ 8] = rkDirection[2]*rkNormal[0];
3473 m_afEntry[ 9] = rkDirection[2]*rkNormal[1];
3474 m_afEntry[10] = rkDirection[2]*rkNormal[2] - fNdD;
3475 m_afEntry[11] = -fNdP*rkDirection[2];
3476 m_afEntry[12] = 0.0f;
3477 m_afEntry[13] = 0.0f;
3478 m_afEntry[14] = 0.0f;
3479 m_afEntry[15] = -fNdD;
3493 Real fNdEmP = rkNormal.
Dot(rkEye-rkPoint);
3495 m_afEntry[ 0] = fNdEmP - rkEye[0]*rkNormal[0];
3496 m_afEntry[ 1] = -rkEye[0]*rkNormal[1];
3497 m_afEntry[ 2] = -rkEye[0]*rkNormal[2];
3498 m_afEntry[ 3] = -(m_afEntry[0]*rkEye[0] + m_afEntry[1]*rkEye[1] +
3499 m_afEntry[2]*rkEye[2]);
3500 m_afEntry[ 4] = -rkEye[1]*rkNormal[0];
3501 m_afEntry[ 5] = fNdEmP - rkEye[1]*rkNormal[1];
3502 m_afEntry[ 6] = -rkEye[1]*rkNormal[2];
3503 m_afEntry[ 7] = -(m_afEntry[4]*rkEye[0] + m_afEntry[5]*rkEye[1] +
3504 m_afEntry[6]*rkEye[2]);
3505 m_afEntry[ 8] = -rkEye[2]*rkNormal[0];
3506 m_afEntry[ 9] = -rkEye[2]*rkNormal[1];
3507 m_afEntry[10] = fNdEmP- rkEye[2]*rkNormal[2];
3508 m_afEntry[11] = -(m_afEntry[8]*rkEye[0] + m_afEntry[9]*rkEye[1] +
3509 m_afEntry[10]*rkEye[2]);
3510 m_afEntry[12] = -rkNormal[0];
3511 m_afEntry[13] = -rkNormal[1];
3512 m_afEntry[14] = -rkNormal[2];
3513 m_afEntry[15] = rkNormal.
Dot(rkEye);
3526 Real fTwoNdP = ((Real)2.0)*(rkNormal.
Dot(rkPoint));
3528 m_afEntry[ 0] = (Real)1.0 - ((Real)2.0)*rkNormal[0]*rkNormal[0];
3529 m_afEntry[ 1] = -((Real)2.0)*rkNormal[0]*rkNormal[1];
3530 m_afEntry[ 2] = -((Real)2.0)*rkNormal[0]*rkNormal[2];
3531 m_afEntry[ 3] = fTwoNdP*rkNormal[0];
3532 m_afEntry[ 4] = -((Real)2.0)*rkNormal[1]*rkNormal[0];
3533 m_afEntry[ 5] = (Real)1.0 - ((Real)2.0)*rkNormal[1]*rkNormal[1];
3534 m_afEntry[ 6] = -((Real)2.0)*rkNormal[1]*rkNormal[2];
3535 m_afEntry[ 7] = fTwoNdP*rkNormal[1];
3536 m_afEntry[ 8] = -((Real)2.0)*rkNormal[2]*rkNormal[0];
3537 m_afEntry[ 9] = -((Real)2.0)*rkNormal[2]*rkNormal[1];
3538 m_afEntry[10] = (Real)1.0 - ((Real)2.0)*rkNormal[2]*rkNormal[2];
3539 m_afEntry[11] = fTwoNdP*rkNormal[2];
3540 m_afEntry[12] = (Real)0.0;
3541 m_afEntry[13] = (Real)0.0;
3542 m_afEntry[14] = (Real)0.0;
3543 m_afEntry[15] = (Real)1.0;
3553 const Real* GetPointer()
const {
return &m_afEntry[0]; }
3554 Real* GetPointer() {
return &m_afEntry[0]; }
3556 inline operator const Real* ()
const {
return m_afEntry; }
3557 inline operator Real* () {
return m_afEntry; }
3558 inline const Real*
operator[] (
int iRow)
const {
return &m_afEntry[4*iRow]; }
3559 inline Real*
operator[] (
int iRow) {
return &m_afEntry[4*iRow]; }
3560 inline Real
operator() (
int iRow,
int iCol)
const {
return m_afEntry[iCol+4*iRow]; }
3561 inline Real&
operator() (
int iRow,
int iCol) {
return m_afEntry[iCol+4*iRow]; }
3565 inline moMatrix4<Real>&
operator= (
const moMatrix4& rkM)
3567 m_afEntry[ 0] = rkM.m_afEntry[ 0];
3568 m_afEntry[ 1] = rkM.m_afEntry[ 1];
3569 m_afEntry[ 2] = rkM.m_afEntry[ 2];
3570 m_afEntry[ 3] = rkM.m_afEntry[ 3];
3571 m_afEntry[ 4] = rkM.m_afEntry[ 4];
3572 m_afEntry[ 5] = rkM.m_afEntry[ 5];
3573 m_afEntry[ 6] = rkM.m_afEntry[ 6];
3574 m_afEntry[ 7] = rkM.m_afEntry[ 7];
3575 m_afEntry[ 8] = rkM.m_afEntry[ 8];
3576 m_afEntry[ 9] = rkM.m_afEntry[ 9];
3577 m_afEntry[10] = rkM.m_afEntry[10];
3578 m_afEntry[11] = rkM.m_afEntry[11];
3579 m_afEntry[12] = rkM.m_afEntry[12];
3580 m_afEntry[13] = rkM.m_afEntry[13];
3581 m_afEntry[14] = rkM.m_afEntry[14];
3582 m_afEntry[15] = rkM.m_afEntry[15];
3589 inline moMatrix4<Real>
operator+ (
const moMatrix4& rkM)
const
3591 return moMatrix4<Real>(
3592 m_afEntry[ 0] + rkM.m_afEntry[ 0],
3593 m_afEntry[ 1] + rkM.m_afEntry[ 1],
3594 m_afEntry[ 2] + rkM.m_afEntry[ 2],
3595 m_afEntry[ 3] + rkM.m_afEntry[ 3],
3596 m_afEntry[ 4] + rkM.m_afEntry[ 4],
3597 m_afEntry[ 5] + rkM.m_afEntry[ 5],
3598 m_afEntry[ 6] + rkM.m_afEntry[ 6],
3599 m_afEntry[ 7] + rkM.m_afEntry[ 7],
3600 m_afEntry[ 8] + rkM.m_afEntry[ 8],
3601 m_afEntry[ 9] + rkM.m_afEntry[ 9],
3602 m_afEntry[10] + rkM.m_afEntry[10],
3603 m_afEntry[11] + rkM.m_afEntry[11],
3604 m_afEntry[12] + rkM.m_afEntry[12],
3605 m_afEntry[13] + rkM.m_afEntry[13],
3606 m_afEntry[14] + rkM.m_afEntry[14],
3607 m_afEntry[15] + rkM.m_afEntry[15]);
3609 inline moMatrix4<Real>
operator- (
const moMatrix4& rkM)
const
3611 return moMatrix4<Real>(
3612 m_afEntry[ 0] - rkM.m_afEntry[ 0],
3613 m_afEntry[ 1] - rkM.m_afEntry[ 1],
3614 m_afEntry[ 2] - rkM.m_afEntry[ 2],
3615 m_afEntry[ 3] - rkM.m_afEntry[ 3],
3616 m_afEntry[ 4] - rkM.m_afEntry[ 4],
3617 m_afEntry[ 5] - rkM.m_afEntry[ 5],
3618 m_afEntry[ 6] - rkM.m_afEntry[ 6],
3619 m_afEntry[ 7] - rkM.m_afEntry[ 7],
3620 m_afEntry[ 8] - rkM.m_afEntry[ 8],
3621 m_afEntry[ 9] - rkM.m_afEntry[ 9],
3622 m_afEntry[10] - rkM.m_afEntry[10],
3623 m_afEntry[11] - rkM.m_afEntry[11],
3624 m_afEntry[12] - rkM.m_afEntry[12],
3625 m_afEntry[13] - rkM.m_afEntry[13],
3626 m_afEntry[14] - rkM.m_afEntry[14],
3627 m_afEntry[15] - rkM.m_afEntry[15]);
3629 inline moMatrix4<Real>
operator* (
const moMatrix4& rkM)
const
3631 return moMatrix4<Real>(
3632 m_afEntry[ 0]*rkM.m_afEntry[ 0] +
3633 m_afEntry[ 1]*rkM.m_afEntry[ 4] +
3634 m_afEntry[ 2]*rkM.m_afEntry[ 8] +
3635 m_afEntry[ 3]*rkM.m_afEntry[12],
3637 m_afEntry[ 0]*rkM.m_afEntry[ 1] +
3638 m_afEntry[ 1]*rkM.m_afEntry[ 5] +
3639 m_afEntry[ 2]*rkM.m_afEntry[ 9] +
3640 m_afEntry[ 3]*rkM.m_afEntry[13],
3642 m_afEntry[ 0]*rkM.m_afEntry[ 2] +
3643 m_afEntry[ 1]*rkM.m_afEntry[ 6] +
3644 m_afEntry[ 2]*rkM.m_afEntry[10] +
3645 m_afEntry[ 3]*rkM.m_afEntry[14],
3647 m_afEntry[ 0]*rkM.m_afEntry[ 3] +
3648 m_afEntry[ 1]*rkM.m_afEntry[ 7] +
3649 m_afEntry[ 2]*rkM.m_afEntry[11] +
3650 m_afEntry[ 3]*rkM.m_afEntry[15],
3652 m_afEntry[ 4]*rkM.m_afEntry[ 0] +
3653 m_afEntry[ 5]*rkM.m_afEntry[ 4] +
3654 m_afEntry[ 6]*rkM.m_afEntry[ 8] +
3655 m_afEntry[ 7]*rkM.m_afEntry[12],
3657 m_afEntry[ 4]*rkM.m_afEntry[ 1] +
3658 m_afEntry[ 5]*rkM.m_afEntry[ 5] +
3659 m_afEntry[ 6]*rkM.m_afEntry[ 9] +
3660 m_afEntry[ 7]*rkM.m_afEntry[13],
3662 m_afEntry[ 4]*rkM.m_afEntry[ 2] +
3663 m_afEntry[ 5]*rkM.m_afEntry[ 6] +
3664 m_afEntry[ 6]*rkM.m_afEntry[10] +
3665 m_afEntry[ 7]*rkM.m_afEntry[14],
3667 m_afEntry[ 4]*rkM.m_afEntry[ 3] +
3668 m_afEntry[ 5]*rkM.m_afEntry[ 7] +
3669 m_afEntry[ 6]*rkM.m_afEntry[11] +
3670 m_afEntry[ 7]*rkM.m_afEntry[15],
3672 m_afEntry[ 8]*rkM.m_afEntry[ 0] +
3673 m_afEntry[ 9]*rkM.m_afEntry[ 4] +
3674 m_afEntry[10]*rkM.m_afEntry[ 8] +
3675 m_afEntry[11]*rkM.m_afEntry[12],
3677 m_afEntry[ 8]*rkM.m_afEntry[ 1] +
3678 m_afEntry[ 9]*rkM.m_afEntry[ 5] +
3679 m_afEntry[10]*rkM.m_afEntry[ 9] +
3680 m_afEntry[11]*rkM.m_afEntry[13],
3682 m_afEntry[ 8]*rkM.m_afEntry[ 2] +
3683 m_afEntry[ 9]*rkM.m_afEntry[ 6] +
3684 m_afEntry[10]*rkM.m_afEntry[10] +
3685 m_afEntry[11]*rkM.m_afEntry[14],
3687 m_afEntry[ 8]*rkM.m_afEntry[ 3] +
3688 m_afEntry[ 9]*rkM.m_afEntry[ 7] +
3689 m_afEntry[10]*rkM.m_afEntry[11] +
3690 m_afEntry[11]*rkM.m_afEntry[15],
3692 m_afEntry[12]*rkM.m_afEntry[ 0] +
3693 m_afEntry[13]*rkM.m_afEntry[ 4] +
3694 m_afEntry[14]*rkM.m_afEntry[ 8] +
3695 m_afEntry[15]*rkM.m_afEntry[12],
3697 m_afEntry[12]*rkM.m_afEntry[ 1] +
3698 m_afEntry[13]*rkM.m_afEntry[ 5] +
3699 m_afEntry[14]*rkM.m_afEntry[ 9] +
3700 m_afEntry[15]*rkM.m_afEntry[13],
3702 m_afEntry[12]*rkM.m_afEntry[ 2] +
3703 m_afEntry[13]*rkM.m_afEntry[ 6] +
3704 m_afEntry[14]*rkM.m_afEntry[10] +
3705 m_afEntry[15]*rkM.m_afEntry[14],
3707 m_afEntry[12]*rkM.m_afEntry[ 3] +
3708 m_afEntry[13]*rkM.m_afEntry[ 7] +
3709 m_afEntry[14]*rkM.m_afEntry[11] +
3710 m_afEntry[15]*rkM.m_afEntry[15]);
3712 inline moMatrix4<Real>
operator* (Real fScalar)
const
3714 return moMatrix4<Real>(
3715 fScalar*m_afEntry[ 0],
3716 fScalar*m_afEntry[ 1],
3717 fScalar*m_afEntry[ 2],
3718 fScalar*m_afEntry[ 3],
3719 fScalar*m_afEntry[ 4],
3720 fScalar*m_afEntry[ 5],
3721 fScalar*m_afEntry[ 6],
3722 fScalar*m_afEntry[ 7],
3723 fScalar*m_afEntry[ 8],
3724 fScalar*m_afEntry[ 9],
3725 fScalar*m_afEntry[10],
3726 fScalar*m_afEntry[11],
3727 fScalar*m_afEntry[12],
3728 fScalar*m_afEntry[13],
3729 fScalar*m_afEntry[14],
3730 fScalar*m_afEntry[15]);
3732 inline moMatrix4<Real>
operator/ (Real fScalar)
const
3734 if (fScalar != (Real)0.0)
3736 Real fInvScalar = ((Real)1.0)/fScalar;
3737 return moMatrix4<Real>(
3738 fInvScalar*m_afEntry[ 0],
3739 fInvScalar*m_afEntry[ 1],
3740 fInvScalar*m_afEntry[ 2],
3741 fInvScalar*m_afEntry[ 3],
3742 fInvScalar*m_afEntry[ 4],
3743 fInvScalar*m_afEntry[ 5],
3744 fInvScalar*m_afEntry[ 6],
3745 fInvScalar*m_afEntry[ 7],
3746 fInvScalar*m_afEntry[ 8],
3747 fInvScalar*m_afEntry[ 9],
3748 fInvScalar*m_afEntry[10],
3749 fInvScalar*m_afEntry[11],
3750 fInvScalar*m_afEntry[12],
3751 fInvScalar*m_afEntry[13],
3752 fInvScalar*m_afEntry[14],
3753 fInvScalar*m_afEntry[15]);
3756 return moMatrix4<Real>(
3758 moMath<Real>::MAX_REAL,
3759 moMath<Real>::MAX_REAL,
3760 moMath<Real>::MAX_REAL,
3761 moMath<Real>::MAX_REAL,
3762 moMath<Real>::MAX_REAL,
3763 moMath<Real>::MAX_REAL,
3764 moMath<Real>::MAX_REAL,
3765 moMath<Real>::MAX_REAL,
3766 moMath<Real>::MAX_REAL,
3767 moMath<Real>::MAX_REAL,
3768 moMath<Real>::MAX_REAL,
3769 moMath<Real>::MAX_REAL,
3770 moMath<Real>::MAX_REAL,
3771 moMath<Real>::MAX_REAL,
3772 moMath<Real>::MAX_REAL);
3774 inline moMatrix4<Real>
operator- ()
const
3776 return moMatrix4<Real>(
3796 inline moMatrix4<Real>&
operator+= (
const moMatrix4& rkM)
3798 m_afEntry[ 0] += rkM.m_afEntry[ 0];
3799 m_afEntry[ 1] += rkM.m_afEntry[ 1];
3800 m_afEntry[ 2] += rkM.m_afEntry[ 2];
3801 m_afEntry[ 3] += rkM.m_afEntry[ 3];
3802 m_afEntry[ 4] += rkM.m_afEntry[ 4];
3803 m_afEntry[ 5] += rkM.m_afEntry[ 5];
3804 m_afEntry[ 6] += rkM.m_afEntry[ 6];
3805 m_afEntry[ 7] += rkM.m_afEntry[ 7];
3806 m_afEntry[ 8] += rkM.m_afEntry[ 8];
3807 m_afEntry[ 9] += rkM.m_afEntry[ 9];
3808 m_afEntry[10] += rkM.m_afEntry[10];
3809 m_afEntry[11] += rkM.m_afEntry[11];
3810 m_afEntry[12] += rkM.m_afEntry[12];
3811 m_afEntry[13] += rkM.m_afEntry[13];
3812 m_afEntry[14] += rkM.m_afEntry[14];
3813 m_afEntry[15] += rkM.m_afEntry[15];
3816 inline moMatrix4<Real>&
operator-= (
const moMatrix4& rkM)
3818 m_afEntry[ 0] -= rkM.m_afEntry[ 0];
3819 m_afEntry[ 1] -= rkM.m_afEntry[ 1];
3820 m_afEntry[ 2] -= rkM.m_afEntry[ 2];
3821 m_afEntry[ 3] -= rkM.m_afEntry[ 3];
3822 m_afEntry[ 4] -= rkM.m_afEntry[ 4];
3823 m_afEntry[ 5] -= rkM.m_afEntry[ 5];
3824 m_afEntry[ 6] -= rkM.m_afEntry[ 6];
3825 m_afEntry[ 7] -= rkM.m_afEntry[ 7];
3826 m_afEntry[ 8] -= rkM.m_afEntry[ 8];
3827 m_afEntry[ 9] -= rkM.m_afEntry[ 9];
3828 m_afEntry[10] -= rkM.m_afEntry[10];
3829 m_afEntry[11] -= rkM.m_afEntry[11];
3830 m_afEntry[12] -= rkM.m_afEntry[12];
3831 m_afEntry[13] -= rkM.m_afEntry[13];
3832 m_afEntry[14] -= rkM.m_afEntry[14];
3833 m_afEntry[15] -= rkM.m_afEntry[15];
3836 inline moMatrix4<Real>&
operator*= (Real fScalar)
3838 m_afEntry[ 0] *= fScalar;
3839 m_afEntry[ 1] *= fScalar;
3840 m_afEntry[ 2] *= fScalar;
3841 m_afEntry[ 3] *= fScalar;
3842 m_afEntry[ 4] *= fScalar;
3843 m_afEntry[ 5] *= fScalar;
3844 m_afEntry[ 6] *= fScalar;
3845 m_afEntry[ 7] *= fScalar;
3846 m_afEntry[ 8] *= fScalar;
3847 m_afEntry[ 9] *= fScalar;
3848 m_afEntry[10] *= fScalar;
3849 m_afEntry[11] *= fScalar;
3850 m_afEntry[12] *= fScalar;
3851 m_afEntry[13] *= fScalar;
3852 m_afEntry[14] *= fScalar;
3853 m_afEntry[15] *= fScalar;
3856 inline moMatrix4<Real>&
operator/= (Real fScalar)
3858 if (fScalar != (Real)0.0)
3860 Real fInvScalar = ((Real)1.0)/fScalar;
3861 m_afEntry[ 0] *= fInvScalar;
3862 m_afEntry[ 1] *= fInvScalar;
3863 m_afEntry[ 2] *= fInvScalar;
3864 m_afEntry[ 3] *= fInvScalar;
3865 m_afEntry[ 4] *= fInvScalar;
3866 m_afEntry[ 5] *= fInvScalar;
3867 m_afEntry[ 6] *= fInvScalar;
3868 m_afEntry[ 7] *= fInvScalar;
3869 m_afEntry[ 8] *= fInvScalar;
3870 m_afEntry[ 9] *= fInvScalar;
3871 m_afEntry[10] *= fInvScalar;
3872 m_afEntry[11] *= fInvScalar;
3873 m_afEntry[12] *= fInvScalar;
3874 m_afEntry[13] *= fInvScalar;
3875 m_afEntry[14] *= fInvScalar;
3876 m_afEntry[15] *= fInvScalar;
3905 m_afEntry[ 0]*rkV[0] +
3906 m_afEntry[ 1]*rkV[1] +
3907 m_afEntry[ 2]*rkV[2] +
3908 m_afEntry[ 3]*rkV[3],
3910 m_afEntry[ 4]*rkV[0] +
3911 m_afEntry[ 5]*rkV[1] +
3912 m_afEntry[ 6]*rkV[2] +
3913 m_afEntry[ 7]*rkV[3],
3915 m_afEntry[ 8]*rkV[0] +
3916 m_afEntry[ 9]*rkV[1] +
3917 m_afEntry[10]*rkV[2] +
3918 m_afEntry[11]*rkV[3],
3920 m_afEntry[12]*rkV[0] +
3921 m_afEntry[13]*rkV[1] +
3922 m_afEntry[14]*rkV[2] +
3923 m_afEntry[15]*rkV[3]);
3927 static const moMatrix4 ZERO;
3928 static const moMatrix4 IDENTITY;
3932 int CompareArrays (
const moMatrix4& rkM)
const
3934 return memcmp(m_afEntry,rkM.m_afEntry,16*
sizeof(Real));
3942 template <
class Real>
3943 inline moMatrix4<Real>
operator* (Real fScalar,
const moMatrix4<Real>& rkM)
3949 template <
class Real>
3951 const moMatrix4<Real>& rkM)
3954 rkV[0]*rkM[0][0]+rkV[1]*rkM[1][0]+rkV[2]*rkM[2][0]+rkV[3]*rkM[3][0],
3955 rkV[0]*rkM[0][1]+rkV[1]*rkM[1][1]+rkV[2]*rkM[2][1]+rkV[3]*rkM[3][1],
3956 rkV[0]*rkM[0][2]+rkV[1]*rkM[1][2]+rkV[2]*rkM[2][2]+rkV[3]*rkM[3][2],
3957 rkV[0]*rkM[0][3]+rkV[1]*rkM[1][3]+rkV[2]*rkM[2][3]+rkV[3]*rkM[3][3]);
moMatrix3< Real > & FromAxisAngle(const moVector3< Real > &rkAxis, Real fAngle)
template class LIBMOLDEO_API moMatrix3< MOfloat >
bool operator<=(const moMatrix3 &rkM) const
moMatrix3< Real > & FromEulerAnglesYXZ(Real fYAngle, Real fXAngle, Real fZAngle)
moMatrix2(const moVector2< Real > *akV, bool bColumns)
moMatrix3< Real > & FromEulerAnglesZYX(Real fZAngle, Real fYAngle, Real fXAngle)
void FromAngle(Real fAngle)
Real QForm(const moVector2< Real > &rkU, const moVector2< Real > &rkV) const
template class LIBMOLDEO_API moMatrix4< MOfloat >
moDeclareExportedDynamicArray(moMatrix2f, moMatrix2fArray)
static const moMatrix2 IDENTITY
void QDUDecomposition(moMatrix3 &rkQ, moMatrix3 &rkD, moMatrix3 &rkU) const
moMatrix3 operator-(const moMatrix3 &rkM) const
void MakeDiagonal(Real fM00, Real fM11)
static Real ACos(Real fValue)
bool ToEulerAnglesZXY(Real &rfZAngle, Real &rfXAngle, Real &rfYAngle) const
void SingularValueComposition(const moMatrix3 &rkL, const moMatrix3 &rkD, const moMatrix3 &rkRTranspose)
moMatrix3 operator/(Real fScalar) const
bool operator>(const moMatrix3 &rkM) const
static Real ATan2(Real fY, Real fX)
void ToAxisAngle(moVector3< Real > &rkAxis, Real &rfAngle) const
bool ToEulerAnglesYXZ(Real &rfYAngle, Real &rfXAngle, Real &rfZAngle) const
Real QForm(const moVector3< Real > &rkU, const moVector3< Real > &rkV) const
moMatrix2(const moMatrix2 &rkM)
moMatrix3< Real > Inverse() const
moVector2< Real > GetColumn(int iCol) const
static Real Sin(Real fValue)
moMatrix3< MOfloat > moMatrix3f
Clase base abstracta de donde deben derivar los objetos [virtual pura].
moMatrix2< MOfloat > moMatrix2f
bool ToEulerAnglesXYZ(Real &rfXAngle, Real &rfYAngle, Real &rfZAngle) const
void ToAngle(Real &rfAngle) const
void SetRow(int iRow, const moVector3< Real > &rkV)
moVector2< Real > GetRow(int iRow) const
void EigenDecomposition(moMatrix2 &rkRot, moMatrix2 &rkDiag) const
template class LIBMOLDEO_API moMatrix4< MOdouble >
moMatrix2< Real > Transpose() const
void GetColumnMajor(Real *afCMajor) const
moMatrix2< Real > operator*(Real fScalar, const moMatrix2< Real > &rkM)
moMatrix3 & operator-=(const moMatrix3 &rkM)
moMatrix2(const Real afEntry[4], bool bRowMajor)
static Real InvSqrt(Real fValue)
moMatrix3< Real > & FromEulerAnglesXZY(Real fXAngle, Real fZAngle, Real fYAngle)
bool operator==(const moMatrix3 &rkM) const
void SetColumn(int iCol, const moVector3< Real > &rkV)
moVector3< Real > GetRow(int iRow) const
bool ToEulerAnglesXZY(Real &rfXAngle, Real &rfZAngle, Real &rfYAngle) const
static Real Sqrt(Real fValue)
moMatrix3< Real > & MakeDiagonal(Real fM00, Real fM11, Real fM22)
bool operator<(const moMatrix3 &rkM) const
moMatrix3< Real > DiagonalTimes(const moVector3< Real > &rkDiag) const
moMatrix2< Real > TimesTranspose(const moMatrix2 &rkM) const
bool ToEulerAnglesYZX(Real &rfYAngle, Real &rfZAngle, Real &rfXAngle) const
Real Dot(const moVector3 &rkV) const
moMatrix2< Real > TransposeTimes(const moMatrix2 &rkM) const
bool ToEulerAnglesZYX(Real &rfZAngle, Real &rfYAngle, Real &rfXAngle) const
moMatrix3< Real > & Slerp(Real fT, const moMatrix3 &rkR0, const moMatrix3 &rkR1)
template class LIBMOLDEO_API moMatrix3< MOdouble >
moMatrix2(bool bZero=true)
moMatrix3< Real > TimesDiagonal(const moVector3< Real > &rkDiag) const
moVector3< Real > GetColumn(int iCol) const
moMatrix3< Real > & FromEulerAnglesZXY(Real fZAngle, Real fXAngle, Real fYAngle)
moMatrix3 & operator/=(Real fScalar)
moMatrix2(Real fM00, Real fM01, Real fM10, Real fM11)
moMatrix3< Real > & MakeZero()
moMatrix3< Real > Adjoint() const
moMatrix3< Real > & FromEulerAnglesXYZ(Real fXAngle, Real fYAngle, Real fZAngle)
void SetColumn(int iCol, const moVector2< Real > &rkV)
moMatrix4< MOfloat > moMatrix4f
static Real Cos(Real fValue)
Real Dot(const moVector2 &rkV) const
moMatrix3< Real > TimesTranspose(const moMatrix3 &rkM) const
void EigenDecomposition(moMatrix3 &rkRot, moMatrix3 &rkDiag) const
bool operator!=(const moMatrix3 &rkM) const
moMatrix2(Real fM00, Real fM11)
void GetColumnMajor(Real *afCMajor) const
moMatrix3 & operator*=(Real fScalar)
moMatrix3< MOdouble > moMatrix3d
moMatrix3(const moMatrix3 &rkM)
bool operator>=(const moMatrix3 &rkM) const
moMatrix2< Real > Inverse() const
moMatrix3 & operator=(const moMatrix3 &rkM)
moMatrix2< MOdouble > moMatrix2d
moMatrix2(const moVector2< Real > &rkU, const moVector2< Real > &rkV)
moMatrix4< MOdouble > moMatrix4d
static const moMatrix2 ZERO
moMatrix3< Real > Transpose() const
Real Dot(const moVector4 &rkV) const
Real operator()(int iRow, int iCol) const
moMatrix3< Real > & MakeTensorProduct(const moVector3< Real > &rkU, const moVector3< Real > &rkV)
void PolarDecomposition(moMatrix3 &rkQ, moMatrix3 &rkS)
MOboolean m_bInitialized
Valor de inicialización
moMatrix3< Real > & MakeIdentity()
moMatrix3 operator+(const moMatrix3 &rkM) const
static Real FAbs(Real fValue)
moMatrix2(const moVector2< Real > &rkU, const moVector2< Real > &rkV, bool bColumns)
moMatrix3< Real > & FromEulerAnglesYZX(Real fYAngle, Real fZAngle, Real fXAngle)
moMatrix3 & operator+=(const moMatrix3 &rkM)
void SingularValueDecomposition(moMatrix3 &rkL, moMatrix3 &rkD, moMatrix3 &rkRTranspose) const
void MakeTensorProduct(const moVector2< Real > &rkU, const moVector2< Real > &rkV)
void SetRow(int iRow, const moVector2< Real > &rkV)
moMatrix3< Real > TransposeTimes(const moMatrix3 &rkM) const
const Real * operator[](int iRow) const
moMatrix2< Real > Adjoint() const