#include <Matrix44.hpp>
Public Methods | |
| Matrix4By4 () | |
| Matrix4By4 (const double a1_1, const double a1_2, const double a1_3, const double a2_1, const double a2_2, const double a2_3, const double a3_1, const double a3_2, const double a3_3, const double Xt, const double Yt, const double Zt) | |
| Matrix4By4 (const Matrix4By4 &m) | |
| double | operator[] (const tJ2KMath::EMatrixElems eElem) const |
| void | operator *= (const Matrix4By4 &m) |
| BOOL | operator== (const Matrix4By4 &m) const |
| BOOL | operator!= (const Matrix4By4 &m) const |
| Matrix4By4 & | operator= (const Matrix4By4 &m) |
| void | AppendRotation (const double XAngle, const double YAngle, const double ZAngle) |
| void | AppendRotation (const Vector3D &vecAngles) |
| void | AppendScale (const double XScale, const double YScale, const double ZScale) |
| void | AppendScale (const Vector3D &vecScale) |
| void | AppendTranslation (const double XTrans, const double YTrans, const double ZTrans) |
| void | AppendTranslation (const Vector3D &vecTrans) |
| void | SetToIdentity () |
| void | SetToRotation (const double XDeg, const double YDeg, const double ZDeg) |
| void | SetToRotation (const Vector3D &vecAngles) |
| void | SetToScale (const double XScale, const double YScale, const double ZScale) |
| void | SetToScale (const Vector3D &vecScale) |
| void | SetToTranslation (const double XTrans, const double YTrans, const double ZTrans) |
| void | SetToTranslation (const Vector3D &vecTrans) |
| void | SetToTransposed (const Matrix4By4 &mtrxSrc) |
| void | Transform (Vector3D &vecTarget) const |
| void | Transform (const Vector3D &vecSource, Vector3D &vecTarget) const |
| void | Transpose () |
| void | Zero () |
Friends | |
| Matrix4By4 | operator * (const Matrix4By4 &left, const Matrix4By4 &right) |
|
|
Definition at line 1 of file Matrix44.cpp. 00001 {
00002 SetToIdentity();
00003 }
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definition at line 45 of file Matrix44.cpp. 00050 {
00051 TRawMem::SetMemBuf(jMatrix, j2klib::TCard1(0), sizeof(jMatrix));
00052 jMatrix[0][0] = a1_1;
00053 jMatrix[0][1] = a1_2;
00054 jMatrix[0][2] = a1_3;
00055 jMatrix[1][0] = a2_1;
00056 jMatrix[1][1] = a2_2;
00057 jMatrix[1][2] = a2_3;
00058 jMatrix[2][0] = a3_1;
00059 jMatrix[2][1] = a3_2;
00060 jMatrix[2][2] = a3_3;
00061 jMatrix[3][0] = Xt;
00062 jMatrix[3][1] = Yt;
00063 jMatrix[3][2] = Zt;
00064 }
|
|
|
Definition at line 66 of file Matrix44.cpp. |
|
|
Definition at line 153 of file Matrix44.cpp. 00154 {
00155 // Get a copy of the vector and convert to radians
00156 T3DVector vecTmp(vecAngles);
00157 vecTmp.ToRadians();
00158
00159 // Get the sine and cosine of each value
00160 double SinX, SinY, SinZ;
00161 double CosX, CosY, CosZ;
00162 SinX = TMathLib::Sine(vecTmp.X());
00163 CosX = TMathLib::Cosine(vecTmp.X());
00164 SinY = TMathLib::Sine(vecTmp.Y());
00165 CosY = TMathLib::Cosine(vecTmp.Y());
00166 SinZ = TMathLib::Sine(vecTmp.Z());
00167 CosZ = TMathLib::Cosine(vecTmp.Z());
00168
00169 // Concatenate the X rotation
00170 Matrix4By4 mtrxTmp;
00171 mtrxTmp[tJ2KMath::EMatrix_22] = CosX;
00172 mtrxTmp[tJ2KMath::EMatrix_33] = CosX;
00173 mtrxTmp[tJ2KMath::EMatrix_23] = SinX;
00174 mtrxTmp[tJ2KMath::EMatrix_32] = -SinX;
00175 *this *= mtrxTmp;
00176
00177 // Concatenate the Y rotation
00178 mtrxTmp.SetToIdentity();
00179 mtrxTmp[tJ2KMath::EMatrix_11] = CosY;
00180 mtrxTmp[tJ2KMath::EMatrix_33] = CosY;
00181 mtrxTmp[tJ2KMath::EMatrix_13] = -SinY;
00182 mtrxTmp[tJ2KMath::EMatrix_31] = SinY;
00183 *this *= mtrxTmp;
00184
00185 // Concatenate the Z rotation
00186 mtrxTmp.SetToIdentity();
00187 mtrxTmp[tJ2KMath::EMatrix_11] = CosZ;
00188 mtrxTmp[tJ2KMath::EMatrix_22] = CosZ;
00189 mtrxTmp[tJ2KMath::EMatrix_12] = SinZ;
00190 mtrxTmp[tJ2KMath::EMatrix_21] = -SinZ;
00191 *this *= mtrxTmp;
00192 }
|
|
||||||||||||||||
|
Definition at line 195 of file Matrix44.cpp. Referenced by SetToRotation().
00198 {
00199 // Convert the angles to radians
00200 double XA = XAngle * kJ2KLib::PI / 180.0;
00201 double YA = YAngle * kJ2KLib::PI / 180.0;
00202 double ZA = ZAngle * kJ2KLib::PI / 180.0;
00203
00204 // Get the sine and cosine of each value
00205 double SinX, SinY, SinZ;
00206 double CosX, CosY, CosZ;
00207 SinX = TMathLib::Sine(XA);
00208 CosX = TMathLib::Cosine(XA);
00209 SinY = TMathLib::Sine(YA);
00210 CosY = TMathLib::Cosine(YA);
00211 SinZ = TMathLib::Sine(ZA);
00212 CosZ = TMathLib::Cosine(ZA);
00213
00214 // Concatenate the X rotation
00215 Matrix4By4 mtrxTmp;
00216 mtrxTmp[tJ2KMath::EMatrix_22] = CosX;
00217 mtrxTmp[tJ2KMath::EMatrix_33] = CosX;
00218 mtrxTmp[tJ2KMath::EMatrix_23] = SinX;
00219 mtrxTmp[tJ2KMath::EMatrix_32] = -SinX;
00220 *this *= mtrxTmp;
00221
00222 // Concatenate the Y rotation
00223 mtrxTmp.SetToIdentity();
00224 mtrxTmp[tJ2KMath::EMatrix_11] = CosY;
00225 mtrxTmp[tJ2KMath::EMatrix_33] = CosY;
00226 mtrxTmp[tJ2KMath::EMatrix_13] = -SinY;
00227 mtrxTmp[tJ2KMath::EMatrix_31] = SinY;
00228 *this *= mtrxTmp;
00229
00230 // Concatenate the Z rotation
00231 mtrxTmp.SetToIdentity();
00232 mtrxTmp[tJ2KMath::EMatrix_11] = CosZ;
00233 mtrxTmp[tJ2KMath::EMatrix_22] = CosZ;
00234 mtrxTmp[tJ2KMath::EMatrix_12] = SinZ;
00235 mtrxTmp[tJ2KMath::EMatrix_21] = -SinZ;
00236 *this *= mtrxTmp;
00237 }
|
|
|
Definition at line 240 of file Matrix44.cpp. 00241 {
00242 // Create a temporary matrix and set up the scaling
00243 Matrix4By4 mtrxTmp;
00244 mtrxTmp[tJ2KMath::EMatrix_11] = vecScale.X();
00245 mtrxTmp[tJ2KMath::EMatrix_22] = vecScale.Y();
00246 mtrxTmp[tJ2KMath::EMatrix_33] = vecScale.Z();
00247
00248 // Concatenate it
00249 *this *= mtrxTmp;
00250 }
|
|
||||||||||||||||
|
Definition at line 253 of file Matrix44.cpp. Referenced by SetToScale().
00256 {
00257 // Create a temporary matrix and set up the scaling
00258 Matrix4By4 mtrxTmp;
00259 mtrxTmp[tJ2KMath::EMatrix_11] = XScale;
00260 mtrxTmp[tJ2KMath::EMatrix_22] = YScale;
00261 mtrxTmp[tJ2KMath::EMatrix_33] = ZScale;
00262
00263 // Concatenate it
00264 *this *= mtrxTmp;
00265 }
|
|
|
Definition at line 268 of file Matrix44.cpp. 00269 {
00270 // Create a temporary matrix and set up the translation
00271 Matrix4By4 mtrxTmp;
00272 mtrxTmp[tJ2KMath::EMatrix_Xt] = vecTrans.X();
00273 mtrxTmp[tJ2KMath::EMatrix_Yt] = vecTrans.Y();
00274 mtrxTmp[tJ2KMath::EMatrix_Zt] = vecTrans.Z();
00275
00276 // Concatenate it
00277 *this *= mtrxTmp;
00278 }
|
|
||||||||||||||||
|
Definition at line 281 of file Matrix44.cpp. Referenced by SetToTranslation().
00284 {
00285 // Create a temporary matrix and set up the translation
00286 Matrix4By4 mtrxTmp;
00287 mtrxTmp[tJ2KMath::EMatrix_Xt] = XTrans;
00288 mtrxTmp[tJ2KMath::EMatrix_Yt] = YTrans;
00289 mtrxTmp[tJ2KMath::EMatrix_Zt] = ZTrans;
00290
00291 // Concatenate it
00292 *this *= mtrxTmp;
00293 }
|
|
|
Definition at line 296 of file Matrix44.cpp. Referenced by AppendRotation(), Matrix4By4(), SetToRotation(), SetToScale(), and SetToTranslation().
|
|
|
Definition at line 16 of file Matrix44.cpp. 00016 {
00017 SetToIdentity();
00018 AppendRotation( vecAngles );
00019 }
|
|
||||||||||||||||
|
Definition at line 9 of file Matrix44.cpp. 00011 {
00012 SetToIdentity();
00013 AppendRotation( XDeg, YDeg, ZDeg );
00014 }
|
|
|
Definition at line 28 of file Matrix44.cpp. 00028 {
00029 SetToIdentity();
00030 AppendScale( vecScale );
00031 }
|
|
||||||||||||||||
|
Definition at line 21 of file Matrix44.cpp. 00023 {
00024 SetToIdentity();
00025 AppendScale( XScale, YScale, ZScale );
00026 }
|
|
|
Definition at line 40 of file Matrix44.cpp. 00040 {
00041 SetToIdentity();
00042 AppendTranslation( vecTrans );
00043 }
|
|
||||||||||||||||
|
Definition at line 33 of file Matrix44.cpp. 00035 {
00036 SetToIdentity();
00037 AppendTranslation( XTrans, YTrans, ZTrans );
00038 }
|
|
|
Definition at line 306 of file Matrix44.cpp. |
|
||||||||||||
|
Definition at line 345 of file Matrix44.cpp. 00346 {
00347 vecTarget.XMag =
00348 (
00349 (vecSource.XMag * jMatrix[0][0])
00350 + (vecSource.YMag * jMatrix[1][0])
00351 + (vecSource.ZMag * jMatrix[2][0])
00352 + jMatrix[3][0]
00353 );
00354
00355 vecTarget.YMag =
00356 (
00357 (vecSource.XMag * jMatrix[0][1])
00358 + (vecSource.YMag * jMatrix[1][1])
00359 + (vecSource.ZMag * jMatrix[2][1])
00360 + jMatrix[3][1]
00361 );
00362
00363 vecTarget.ZMag =
00364 (
00365 (vecSource.XMag * jMatrix[0][2])
00366 + (vecSource.YMag * jMatrix[1][2])
00367 + (vecSource.ZMag * jMatrix[2][2])
00368 + jMatrix[3][2]
00369 );
00370 }
|
|
|
Definition at line 320 of file Matrix44.cpp. 00321 {
00322 double X, Y, Z;
00323
00324 X = (vecTarget.XMag * jMatrix[0][0])
00325 + (vecTarget.YMag * jMatrix[1][0])
00326 + (vecTarget.ZMag * jMatrix[2][0])
00327 + jMatrix[3][0];
00328
00329 Y = (vecTarget.XMag * jMatrix[0][1])
00330 + (vecTarget.YMag * jMatrix[1][1])
00331 + (vecTarget.ZMag * jMatrix[2][1])
00332 + jMatrix[3][1];
00333
00334 Z = (vecTarget.XMag * jMatrix[0][2])
00335 + (vecTarget.YMag * jMatrix[1][2])
00336 + (vecTarget.ZMag * jMatrix[2][2])
00337 + jMatrix[3][2];
00338
00339 vecTarget.XMag = X;
00340 vecTarget.YMag = Y;
00341 vecTarget.ZMag = Z;
00342 }
|
|
|
Definition at line 373 of file Matrix44.cpp. 00374 {
00375 double aTmp[4][4];
00376
00377 // Copy the current matrix to the temp array
00378 TRawMem::CopyMemBuf(aTmp, jMatrix, sizeof(jMatrix));
00379
00380 // Now put them back in the opposite order
00381 for (j2klib::TInt4 i4Outer = 0; i4Outer < 4; i4Outer++)
00382 {
00383 for (j2klib::TInt4 i4Inner = 0; i4Inner < 4; i4Inner++)
00384 jMatrix[i4Outer][i4Inner] = aTmp[i4Inner][i4Outer];
00385 }
00386 }
|
|
|
Definition at line 388 of file Matrix44.cpp. Referenced by operator *(), and operator *=().
|
|
|
Definition at line 96 of file Matrix44.cpp. 00097 {
00098 // Make a copy of this matrix
00099 Matrix4By4 mtrxTmp(*this);
00100
00101 // Zero out this matrix as the new empty matrix to fill in
00102 Zero();
00103 for (j2klib::TCard4 c4Outer = 0; c4Outer < 4; c4Outer++)
00104 {
00105 for (j2klib::TCard4 c4Inner = 0; c4Inner < 4; c4Inner++)
00106 {
00107 for (j2klib::TCard4 c4Element = 0; c4Element < 4; c4Element++)
00108 {
00109 jMatrix[c4Outer][c4Inner]
00110 += (mtrxTmp.jMatrix[c4Outer][c4Element]
00111 * mtrxSrc.jMatrix[c4Element][c4Inner]);
00112 }
00113 }
00114 }
00115 }
|
|
|
Definition at line 5 of file Matrix44.cpp. 00005 {
00006 return !Compare( m );
00007 }
|
|
|
Definition at line 134 of file Matrix44.cpp. |
|
|
Definition at line 119 of file Matrix44.cpp. |
|
|
Definition at line 70 of file Matrix44.cpp. 00070 {
00071 return jArray[eElem];
00072 }
|
|
||||||||||||
|
Definition at line 78 of file Matrix44.cpp. 00079 {
00080 Matrix4By4 mResult;
00081
00082 mResult.Zero();
00083 for (j2klib::TCard4 c4Outer = 0; c4Outer < 4; c4Outer++)
00084 {
00085 for (j2klib::TCard4 c4Inner = 0; c4Inner < 4; c4Inner++)
00086 {
00087 for (j2klib::TCard4 c4Element = 0; c4Element < 4; c4Element++)
00088 mResult.jMatrix[c4Outer][c4Inner]
00089 += (m1.jMatrix[c4Outer][c4Element]
00090 * m2.jMatrix[c4Element][c4Inner]);
00091 }
00092 }
00093 return mResult;
00094 }
|
|
|
Definition at line 87 of file Matrix44.hpp. |
|
|
Definition at line 86 of file Matrix44.hpp. Referenced by SetToTransposed(), operator *(), operator *=(), operator=(), and operator==().
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001