29 #ifndef __MATH_MATRIX_H__
30 #define __MATH_MATRIX_H__
40 #define MATRIX_INVERSE_EPSILON 1e-14
41 #define MATRIX_EPSILON 1e-6
59 explicit idMat2(
const float xx,
const float xy,
const float yx,
const float yy );
60 explicit idMat2(
const float src[ 2 ][ 2 ] );
90 float Trace(
void )
const;
103 const char *
ToString(
int precision = 2 )
const;
111 #define mat2_default mat2_identity
121 ID_INLINE
idMat2::idMat2(
const float xx,
const float xy,
const float yx,
const float yy ) {
127 memcpy(
mat, src, 2 * 2 *
sizeof(
float ) );
155 mat[1].x * a[0].x +
mat[1].y * a[1].x,
156 mat[1].x * a[0].y +
mat[1].y * a[1].y );
168 mat[1].x + a[1].x,
mat[1].y + a[1].y );
174 mat[1].x - a[1].x,
mat[1].y - a[1].y );
187 mat[0].
x = x * a[0].x + y * a[1].x;
188 mat[0].
y = x * a[0].y + y * a[1].y;
190 mat[1].
x = x * a[0].x + y * a[1].x;
191 mat[1].
y = x * a[0].y + y * a[1].y;
196 mat[0].
x += a[0].x;
mat[0].
y += a[0].y;
197 mat[1].
x += a[1].x;
mat[1].
y += a[1].y;
203 mat[0].
x -= a[0].x;
mat[0].
y -= a[0].y;
204 mat[1].
x -= a[1].x;
mat[1].
y -= a[1].y;
256 return Compare( mat2_identity, epsilon );
272 return (
mat[0][0] +
mat[1][1] );
337 explicit idMat3(
const float xx,
const float xy,
const float xz,
const float yx,
const float yy,
const float yz,
const float zx,
const float zy,
const float zz );
338 explicit idMat3(
const float src[ 3 ][ 3 ] );
375 float Trace(
void )
const;
402 const char *
ToString(
int precision = 2 )
const;
413 #define mat3_default mat3_identity
424 ID_INLINE
idMat3::idMat3(
const float xx,
const float xy,
const float xz,
const float yx,
const float yy,
const float yz,
const float zx,
const float zy,
const float zz ) {
431 memcpy(
mat, src, 3 * 3 *
sizeof(
float ) );
459 const float *m1Ptr, *m2Ptr;
463 m1Ptr =
reinterpret_cast<const float *
>(
this);
464 m2Ptr =
reinterpret_cast<const float *
>(&
a);
465 dstPtr =
reinterpret_cast<float *
>(&
dst);
467 for ( i = 0; i < 3; i++ ) {
468 for ( j = 0; j < 3; j++ ) {
469 *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 3 +
j ]
470 + m1Ptr[1] * m2Ptr[ 1 * 3 +
j ]
471 + m1Ptr[2] * m2Ptr[ 2 * 3 +
j ];
489 mat[1].x + a[1].x,
mat[1].y + a[1].y,
mat[1].z + a[1].z,
490 mat[2].x + a[2].x,
mat[2].y + a[2].y,
mat[2].z + a[2].z );
496 mat[1].x - a[1].x,
mat[1].y - a[1].y,
mat[1].z - a[1].z,
497 mat[2].x - a[2].x,
mat[2].y - a[2].y,
mat[2].z - a[2].z );
511 float *m1Ptr,
dst[3];
513 m1Ptr =
reinterpret_cast<float *
>(
this);
514 m2Ptr =
reinterpret_cast<const float *
>(&
a);
516 for ( i = 0; i < 3; i++ ) {
517 for ( j = 0; j < 3; j++ ) {
518 dst[
j] = m1Ptr[0] * m2Ptr[ 0 * 3 +
j ]
519 + m1Ptr[1] * m2Ptr[ 1 * 3 +
j ]
520 + m1Ptr[2] * m2Ptr[ 2 * 3 +
j ];
522 m1Ptr[0] = dst[0]; m1Ptr[1] = dst[1]; m1Ptr[2] = dst[2];
529 mat[0].
x += a[0].x;
mat[0].
y += a[0].y;
mat[0].
z += a[0].z;
530 mat[1].
x += a[1].x;
mat[1].
y += a[1].y;
mat[1].
z += a[1].z;
531 mat[2].
x += a[2].x;
mat[2].
y += a[2].y;
mat[2].
z += a[2].z;
537 mat[0].
x -= a[0].x;
mat[0].
y -= a[0].y;
mat[0].
z -= a[0].z;
538 mat[1].
x -= a[1].x;
mat[1].
y -= a[1].y;
mat[1].
z -= a[1].z;
539 mat[2].
x -= a[2].x;
mat[2].
y -= a[2].y;
mat[2].
z -= a[2].z;
553 float x = mat[ 0 ].x * vec.
x + mat[ 1 ].x * vec.
y + mat[ 2 ].x * vec.
z;
554 float y = mat[ 0 ].y * vec.
x + mat[ 1 ].y * vec.
y + mat[ 2 ].y * vec.
z;
555 vec.
z = mat[ 0 ].z * vec.
x + mat[ 1 ].z * vec.
y + mat[ 2 ].z * vec.
z;
596 return Compare( mat3_identity, epsilon );
625 return !
Compare( mat3_identity );
629 dst.
x = src *
mat[ 0 ];
630 dst.
y = src * mat[ 1 ];
631 dst.
z = src * mat[ 2 ];
635 dst =
mat[ 0 ] * src.
x +
mat[ 1 ] * src.
y +
mat[ 2 ] * src.
z;
653 return (
mat[0][0] +
mat[1][1] +
mat[2][2] );
660 ortho[ 0 ].Normalize();
661 ortho[ 2 ].Cross(
mat[ 0 ],
mat[ 1 ] );
662 ortho[ 2 ].Normalize();
663 ortho[ 1 ].Cross(
mat[ 2 ],
mat[ 0 ] );
664 ortho[ 1 ].Normalize();
684 float tmp0, tmp1, tmp2;
719 mat[0].x * b[0].
y +
mat[1].x * b[1].
y +
mat[2].x * b[2].
y,
720 mat[0].x * b[0].
z +
mat[1].x * b[1].
z +
mat[2].x * b[2].
z,
721 mat[0].y * b[0].x +
mat[1].y * b[1].x +
mat[2].y * b[2].x,
722 mat[0].y * b[0].y +
mat[1].y * b[1].y +
mat[2].y * b[2].y,
723 mat[0].y * b[0].z +
mat[1].y * b[1].z +
mat[2].y * b[2].z,
724 mat[0].z * b[0].x +
mat[1].z * b[1].x +
mat[2].z * b[2].x,
725 mat[0].z * b[0].y +
mat[1].z * b[1].y +
mat[2].z * b[2].y,
726 mat[0].z * b[0].z +
mat[1].z * b[1].z +
mat[2].z * b[2].z );
730 dst[0].x = transpose[0].x * b[0].x + transpose[1].x * b[1].x + transpose[2].x * b[2].x;
731 dst[0].y = transpose[0].x * b[0].y + transpose[1].x * b[1].y + transpose[2].x * b[2].y;
732 dst[0].z = transpose[0].x * b[0].z + transpose[1].x * b[1].z + transpose[2].x * b[2].z;
733 dst[1].x = transpose[0].y * b[0].x + transpose[1].y * b[1].x + transpose[2].y * b[2].x;
734 dst[1].y = transpose[0].y * b[0].y + transpose[1].y * b[1].y + transpose[2].y * b[2].y;
735 dst[1].z = transpose[0].y * b[0].z + transpose[1].y * b[1].z + transpose[2].y * b[2].z;
736 dst[2].x = transpose[0].z * b[0].x + transpose[1].z * b[1].x + transpose[2].z * b[2].x;
737 dst[2].y = transpose[0].z * b[0].y + transpose[1].z * b[1].y + transpose[2].z * b[2].y;
738 dst[2].z = transpose[0].z * b[0].z + transpose[1].z * b[1].z + transpose[2].z * b[2].z;
742 return idMat3( 0.0
f, -src.
z, src.
y, src.
z, 0.0f, -src.
x, -src.
y, src.
x, 0.0f );
768 explicit idMat4(
const float xx,
const float xy,
const float xz,
const float xw,
769 const float yx,
const float yy,
const float yz,
const float yw,
770 const float zx,
const float zy,
const float zz,
const float zw,
771 const float wx,
const float wy,
const float wz,
const float ww );
773 explicit idMat4(
const float src[ 4 ][ 4 ] );
809 float Trace(
void )
const;
823 const char *
ToString(
int precision = 2 )
const;
831 #define mat4_default mat4_identity
843 ID_INLINE
idMat4::idMat4(
const float xx,
const float xy,
const float xz,
const float xw,
844 const float yx,
const float yy,
const float yz,
const float yw,
845 const float zx,
const float zy,
const float zz,
const float zw,
846 const float wx,
const float wy,
const float wz,
const float ww ) {
847 mat[0][0] = xx;
mat[0][1] = xy;
mat[0][2] = xz;
mat[0][3] = xw;
848 mat[1][0] = yx;
mat[1][1] = yy;
mat[1][2] = yz;
mat[1][3] = yw;
849 mat[2][0] = zx;
mat[2][1] = zy;
mat[2][2] = zz;
mat[2][3] = zw;
850 mat[3][0] = wx;
mat[3][1] = wy;
mat[3][2] = wz;
mat[3][3] = ww;
855 mat[ 0 ][ 0 ] = rotation[0][0];
856 mat[ 0 ][ 1 ] = rotation[1][0];
857 mat[ 0 ][ 2 ] = rotation[2][0];
858 mat[ 0 ][ 3 ] = translation[0];
859 mat[ 1 ][ 0 ] = rotation[0][1];
860 mat[ 1 ][ 1 ] = rotation[1][1];
861 mat[ 1 ][ 2 ] = rotation[2][1];
862 mat[ 1 ][ 3 ] = translation[1];
863 mat[ 2 ][ 0 ] = rotation[0][2];
864 mat[ 2 ][ 1 ] = rotation[1][2];
865 mat[ 2 ][ 2 ] = rotation[2][2];
866 mat[ 2 ][ 3 ] = translation[2];
867 mat[ 3 ][ 0 ] = 0.0f;
868 mat[ 3 ][ 1 ] = 0.0f;
869 mat[ 3 ][ 2 ] = 0.0f;
870 mat[ 3 ][ 3 ] = 1.0f;
874 memcpy(
mat, src, 4 * 4 *
sizeof(
float ) );
915 float invS = 1.0f /
s;
925 const float *m1Ptr, *m2Ptr;
929 m1Ptr =
reinterpret_cast<const float *
>(
this);
930 m2Ptr =
reinterpret_cast<const float *
>(&
a);
931 dstPtr =
reinterpret_cast<float *
>(&
dst);
933 for ( i = 0; i < 4; i++ ) {
934 for ( j = 0; j < 4; j++ ) {
935 *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 4 +
j ]
936 + m1Ptr[1] * m2Ptr[ 1 * 4 +
j ]
937 + m1Ptr[2] * m2Ptr[ 2 * 4 +
j ]
938 + m1Ptr[3] * m2Ptr[ 3 * 4 +
j ];
949 mat[1].x + a[1].x,
mat[1].y + a[1].y,
mat[1].z + a[1].z,
mat[1].w + a[1].w,
950 mat[2].x + a[2].x,
mat[2].y + a[2].y,
mat[2].z + a[2].z,
mat[2].w + a[2].w,
951 mat[3].x + a[3].x,
mat[3].y + a[3].y,
mat[3].z + a[3].z,
mat[3].w + a[3].w );
957 mat[1].x - a[1].x,
mat[1].y - a[1].y,
mat[1].z - a[1].z,
mat[1].w - a[1].w,
958 mat[2].x - a[2].x,
mat[2].y - a[2].y,
mat[2].z - a[2].z,
mat[2].w - a[2].w,
959 mat[3].x - a[3].x,
mat[3].y - a[3].y,
mat[3].z - a[3].z,
mat[3].w - a[3].w );
976 mat[0].
x += a[0].x;
mat[0].
y += a[0].y;
mat[0].
z += a[0].z;
mat[0].
w += a[0].w;
977 mat[1].
x += a[1].x;
mat[1].
y += a[1].y;
mat[1].
z += a[1].z;
mat[1].
w += a[1].w;
978 mat[2].
x += a[2].x;
mat[2].
y += a[2].y;
mat[2].
z += a[2].z;
mat[2].
w += a[2].w;
979 mat[3].
x += a[3].x;
mat[3].
y += a[3].y;
mat[3].
z += a[3].z;
mat[3].
w += a[3].w;
984 mat[0].
x -= a[0].x;
mat[0].
y -= a[0].y;
mat[0].
z -= a[0].z;
mat[0].
w -= a[0].w;
985 mat[1].
x -= a[1].x;
mat[1].
y -= a[1].y;
mat[1].
z -= a[1].z;
mat[1].
w -= a[1].w;
986 mat[2].
x -= a[2].x;
mat[2].
y -= a[2].y;
mat[2].
z -= a[2].z;
mat[2].
w -= a[2].w;
987 mat[3].
x -= a[3].x;
mat[3].
y -= a[3].y;
mat[3].
z -= a[3].z;
mat[3].
w -= a[3].w;
1015 const float *ptr1, *ptr2;
1017 ptr1 =
reinterpret_cast<const float *
>(
mat);
1018 ptr2 =
reinterpret_cast<const float *
>(a.
mat);
1019 for ( i = 0; i < 4*4; i++ ) {
1020 if ( ptr1[i] != ptr2[i] ) {
1029 const float *ptr1, *ptr2;
1031 ptr1 =
reinterpret_cast<const float *
>(
mat);
1032 ptr2 =
reinterpret_cast<const float *
>(a.
mat);
1033 for ( i = 0; i < 4*4; i++ ) {
1058 return Compare( mat4_identity, epsilon );
1062 for (
int i = 1;
i < 4;
i++ ) {
1063 for (
int j = 0;
j <
i;
j++ ) {
1073 for (
int i = 0;
i < 4;
i++ ) {
1074 for (
int j = 0;
j < 4;
j++ ) {
1084 if ( !
mat[ 0 ][ 1 ] && !
mat[ 0 ][ 2 ] &&
1085 !
mat[ 1 ][ 0 ] && !
mat[ 1 ][ 2 ] &&
1086 !
mat[ 2 ][ 0 ] && !
mat[ 2 ][ 1 ] ) {
1093 dst.
x = src *
mat[ 0 ];
1094 dst.
y = src * mat[ 1 ];
1095 dst.
z = src * mat[ 2 ];
1096 dst.
w = src * mat[ 3 ];
1100 dst =
mat[ 0 ] * src.
x +
mat[ 1 ] * src.
y +
mat[ 2 ] * src.
z +
mat[ 3 ] * src.
w;
1104 return (
mat[0][0] +
mat[1][1] +
mat[2][2] +
mat[3][3] );
1130 0.0
f, 0.0
f, 0.0
f, 1.0
f );
1156 explicit idMat5(
const float src[ 5 ][ 5 ] );
1185 float Trace(
void )
const;
1198 const char *
ToString(
int precision = 2 )
const;
1206 #define mat5_default mat5_identity
1212 memcpy(
mat, src, 5 * 5 *
sizeof(
float ) );
1235 const float *m1Ptr, *m2Ptr;
1239 m1Ptr =
reinterpret_cast<const float *
>(
this);
1240 m2Ptr =
reinterpret_cast<const float *
>(&
a);
1241 dstPtr =
reinterpret_cast<float *
>(&
dst);
1243 for ( i = 0; i < 5; i++ ) {
1244 for ( j = 0; j < 5; j++ ) {
1245 *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 5 +
j ]
1246 + m1Ptr[1] * m2Ptr[ 1 * 5 +
j ]
1247 + m1Ptr[2] * m2Ptr[ 2 * 5 +
j ]
1248 + m1Ptr[3] * m2Ptr[ 3 * 5 +
j ]
1249 + m1Ptr[4] * m2Ptr[ 4 * 5 +
j ];
1268 mat[0][0] * vec[0] +
mat[0][1] * vec[1] +
mat[0][2] * vec[2] +
mat[0][3] * vec[3] +
mat[0][4] * vec[4],
1269 mat[1][0] * vec[0] +
mat[1][1] * vec[1] +
mat[1][2] * vec[2] +
mat[1][3] * vec[3] +
mat[1][4] * vec[4],
1270 mat[2][0] * vec[0] +
mat[2][1] * vec[1] +
mat[2][2] * vec[2] +
mat[2][3] * vec[3] +
mat[2][4] * vec[4],
1271 mat[3][0] * vec[0] +
mat[3][1] * vec[1] +
mat[3][2] * vec[2] +
mat[3][3] * vec[3] +
mat[3][4] * vec[4],
1272 mat[4][0] * vec[0] +
mat[4][1] * vec[1] +
mat[4][2] * vec[2] +
mat[4][3] * vec[3] +
mat[4][4] * vec[4] );
1277 idVec5(
mat[0][0] + a[0][0],
mat[0][1] + a[0][1],
mat[0][2] + a[0][2],
mat[0][3] + a[0][3],
mat[0][4] + a[0][4] ),
1278 idVec5(
mat[1][0] + a[1][0],
mat[1][1] + a[1][1],
mat[1][2] + a[1][2],
mat[1][3] + a[1][3],
mat[1][4] + a[1][4] ),
1279 idVec5(
mat[2][0] + a[2][0],
mat[2][1] + a[2][1],
mat[2][2] + a[2][2],
mat[2][3] + a[2][3],
mat[2][4] + a[2][4] ),
1280 idVec5(
mat[3][0] + a[3][0],
mat[3][1] + a[3][1],
mat[3][2] + a[3][2],
mat[3][3] + a[3][3],
mat[3][4] + a[3][4] ),
1281 idVec5(
mat[4][0] + a[4][0],
mat[4][1] + a[4][1],
mat[4][2] + a[4][2],
mat[4][3] + a[4][3],
mat[4][4] + a[4][4] ) );
1286 idVec5(
mat[0][0] - a[0][0],
mat[0][1] - a[0][1],
mat[0][2] - a[0][2],
mat[0][3] - a[0][3],
mat[0][4] - a[0][4] ),
1287 idVec5(
mat[1][0] - a[1][0],
mat[1][1] - a[1][1],
mat[1][2] - a[1][2],
mat[1][3] - a[1][3],
mat[1][4] - a[1][4] ),
1288 idVec5(
mat[2][0] - a[2][0],
mat[2][1] - a[2][1],
mat[2][2] - a[2][2],
mat[2][3] - a[2][3],
mat[2][4] - a[2][4] ),
1289 idVec5(
mat[3][0] - a[3][0],
mat[3][1] - a[3][1],
mat[3][2] - a[3][2],
mat[3][3] - a[3][3],
mat[3][4] - a[3][4] ),
1290 idVec5(
mat[4][0] - a[4][0],
mat[4][1] - a[4][1],
mat[4][2] - a[4][2],
mat[4][3] - a[4][3],
mat[4][4] - a[4][4] ) );
1308 mat[0][0] += a[0][0];
mat[0][1] += a[0][1];
mat[0][2] += a[0][2];
mat[0][3] += a[0][3];
mat[0][4] += a[0][4];
1309 mat[1][0] += a[1][0];
mat[1][1] += a[1][1];
mat[1][2] += a[1][2];
mat[1][3] += a[1][3];
mat[1][4] += a[1][4];
1310 mat[2][0] += a[2][0];
mat[2][1] += a[2][1];
mat[2][2] += a[2][2];
mat[2][3] += a[2][3];
mat[2][4] += a[2][4];
1311 mat[3][0] += a[3][0];
mat[3][1] += a[3][1];
mat[3][2] += a[3][2];
mat[3][3] += a[3][3];
mat[3][4] += a[3][4];
1312 mat[4][0] += a[4][0];
mat[4][1] += a[4][1];
mat[4][2] += a[4][2];
mat[4][3] += a[4][3];
mat[4][4] += a[4][4];
1317 mat[0][0] -= a[0][0];
mat[0][1] -= a[0][1];
mat[0][2] -= a[0][2];
mat[0][3] -= a[0][3];
mat[0][4] -= a[0][4];
1318 mat[1][0] -= a[1][0];
mat[1][1] -= a[1][1];
mat[1][2] -= a[1][2];
mat[1][3] -= a[1][3];
mat[1][4] -= a[1][4];
1319 mat[2][0] -= a[2][0];
mat[2][1] -= a[2][1];
mat[2][2] -= a[2][2];
mat[2][3] -= a[2][3];
mat[2][4] -= a[2][4];
1320 mat[3][0] -= a[3][0];
mat[3][1] -= a[3][1];
mat[3][2] -= a[3][2];
mat[3][3] -= a[3][3];
mat[3][4] -= a[3][4];
1321 mat[4][0] -= a[4][0];
mat[4][1] -= a[4][1];
mat[4][2] -= a[4][2];
mat[4][3] -= a[4][3];
mat[4][4] -= a[4][4];
1340 const float *ptr1, *ptr2;
1342 ptr1 =
reinterpret_cast<const float *
>(
mat);
1343 ptr2 =
reinterpret_cast<const float *
>(a.
mat);
1344 for ( i = 0; i < 5*5; i++ ) {
1345 if ( ptr1[i] != ptr2[i] ) {
1354 const float *ptr1, *ptr2;
1356 ptr1 =
reinterpret_cast<const float *
>(
mat);
1357 ptr2 =
reinterpret_cast<const float *
>(a.
mat);
1358 for ( i = 0; i < 5*5; i++ ) {
1383 return Compare( mat5_identity, epsilon );
1387 for (
int i = 1;
i < 5;
i++ ) {
1388 for (
int j = 0;
j <
i;
j++ ) {
1398 for (
int i = 0;
i < 5;
i++ ) {
1399 for (
int j = 0;
j < 5;
j++ ) {
1454 explicit idMat6(
const float src[ 6 ][ 6 ] );
1484 float Trace(
void )
const;
1497 const char *
ToString(
int precision = 2 )
const;
1505 #define mat6_default mat6_identity
1511 mat[0] =
idVec6( m0[0][0], m0[0][1], m0[0][2], m1[0][0], m1[0][1], m1[0][2] );
1512 mat[1] =
idVec6( m0[1][0], m0[1][1], m0[1][2], m1[1][0], m1[1][1], m1[1][2] );
1513 mat[2] =
idVec6( m0[2][0], m0[2][1], m0[2][2], m1[2][0], m1[2][1], m1[2][2] );
1514 mat[3] =
idVec6( m2[0][0], m2[0][1], m2[0][2], m3[0][0], m3[0][1], m3[0][2] );
1515 mat[4] =
idVec6( m2[1][0], m2[1][1], m2[1][2], m3[1][0], m3[1][1], m3[1][2] );
1516 mat[5] =
idVec6( m2[2][0], m2[2][1], m2[2][2], m3[2][0], m3[2][1], m3[2][2] );
1529 memcpy(
mat, src, 6 * 6 *
sizeof(
float ) );
1544 const float *m1Ptr, *m2Ptr;
1548 m1Ptr =
reinterpret_cast<const float *
>(
this);
1549 m2Ptr =
reinterpret_cast<const float *
>(&
a);
1550 dstPtr =
reinterpret_cast<float *
>(&
dst);
1552 for ( i = 0; i < 6; i++ ) {
1553 for ( j = 0; j < 6; j++ ) {
1554 *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 6 +
j ]
1555 + m1Ptr[1] * m2Ptr[ 1 * 6 +
j ]
1556 + m1Ptr[2] * m2Ptr[ 2 * 6 +
j ]
1557 + m1Ptr[3] * m2Ptr[ 3 * 6 +
j ]
1558 + m1Ptr[4] * m2Ptr[ 4 * 6 +
j ]
1559 + m1Ptr[5] * m2Ptr[ 5 * 6 +
j ];
1579 mat[0][0] * vec[0] +
mat[0][1] * vec[1] +
mat[0][2] * vec[2] +
mat[0][3] * vec[3] +
mat[0][4] * vec[4] +
mat[0][5] * vec[5],
1580 mat[1][0] * vec[0] +
mat[1][1] * vec[1] +
mat[1][2] * vec[2] +
mat[1][3] * vec[3] +
mat[1][4] * vec[4] +
mat[1][5] * vec[5],
1581 mat[2][0] * vec[0] +
mat[2][1] * vec[1] +
mat[2][2] * vec[2] +
mat[2][3] * vec[3] +
mat[2][4] * vec[4] +
mat[2][5] * vec[5],
1582 mat[3][0] * vec[0] +
mat[3][1] * vec[1] +
mat[3][2] * vec[2] +
mat[3][3] * vec[3] +
mat[3][4] * vec[4] +
mat[3][5] * vec[5],
1583 mat[4][0] * vec[0] +
mat[4][1] * vec[1] +
mat[4][2] * vec[2] +
mat[4][3] * vec[3] +
mat[4][4] * vec[4] +
mat[4][5] * vec[5],
1584 mat[5][0] * vec[0] +
mat[5][1] * vec[1] +
mat[5][2] * vec[2] +
mat[5][3] * vec[3] +
mat[5][4] * vec[4] +
mat[5][5] * vec[5] );
1589 idVec6(
mat[0][0] + a[0][0],
mat[0][1] + a[0][1],
mat[0][2] + a[0][2],
mat[0][3] + a[0][3],
mat[0][4] + a[0][4],
mat[0][5] + a[0][5] ),
1590 idVec6(
mat[1][0] + a[1][0],
mat[1][1] + a[1][1],
mat[1][2] + a[1][2],
mat[1][3] + a[1][3],
mat[1][4] + a[1][4],
mat[1][5] + a[1][5] ),
1591 idVec6(
mat[2][0] + a[2][0],
mat[2][1] + a[2][1],
mat[2][2] + a[2][2],
mat[2][3] + a[2][3],
mat[2][4] + a[2][4],
mat[2][5] + a[2][5] ),
1592 idVec6(
mat[3][0] + a[3][0],
mat[3][1] + a[3][1],
mat[3][2] + a[3][2],
mat[3][3] + a[3][3],
mat[3][4] + a[3][4],
mat[3][5] + a[3][5] ),
1593 idVec6(
mat[4][0] + a[4][0],
mat[4][1] + a[4][1],
mat[4][2] + a[4][2],
mat[4][3] + a[4][3],
mat[4][4] + a[4][4],
mat[4][5] + a[4][5] ),
1594 idVec6(
mat[5][0] + a[5][0],
mat[5][1] + a[5][1],
mat[5][2] + a[5][2],
mat[5][3] + a[5][3],
mat[5][4] + a[5][4],
mat[5][5] + a[5][5] ) );
1599 idVec6(
mat[0][0] - a[0][0],
mat[0][1] - a[0][1],
mat[0][2] - a[0][2],
mat[0][3] - a[0][3],
mat[0][4] - a[0][4],
mat[0][5] - a[0][5] ),
1600 idVec6(
mat[1][0] - a[1][0],
mat[1][1] - a[1][1],
mat[1][2] - a[1][2],
mat[1][3] - a[1][3],
mat[1][4] - a[1][4],
mat[1][5] - a[1][5] ),
1601 idVec6(
mat[2][0] - a[2][0],
mat[2][1] - a[2][1],
mat[2][2] - a[2][2],
mat[2][3] - a[2][3],
mat[2][4] - a[2][4],
mat[2][5] - a[2][5] ),
1602 idVec6(
mat[3][0] - a[3][0],
mat[3][1] - a[3][1],
mat[3][2] - a[3][2],
mat[3][3] - a[3][3],
mat[3][4] - a[3][4],
mat[3][5] - a[3][5] ),
1603 idVec6(
mat[4][0] - a[4][0],
mat[4][1] - a[4][1],
mat[4][2] - a[4][2],
mat[4][3] - a[4][3],
mat[4][4] - a[4][4],
mat[4][5] - a[4][5] ),
1604 idVec6(
mat[5][0] - a[5][0],
mat[5][1] - a[5][1],
mat[5][2] - a[5][2],
mat[5][3] - a[5][3],
mat[5][4] - a[5][4],
mat[5][5] - a[5][5] ) );
1623 mat[0][0] += a[0][0];
mat[0][1] += a[0][1];
mat[0][2] += a[0][2];
mat[0][3] += a[0][3];
mat[0][4] += a[0][4];
mat[0][5] += a[0][5];
1624 mat[1][0] += a[1][0];
mat[1][1] += a[1][1];
mat[1][2] += a[1][2];
mat[1][3] += a[1][3];
mat[1][4] += a[1][4];
mat[1][5] += a[1][5];
1625 mat[2][0] += a[2][0];
mat[2][1] += a[2][1];
mat[2][2] += a[2][2];
mat[2][3] += a[2][3];
mat[2][4] += a[2][4];
mat[2][5] += a[2][5];
1626 mat[3][0] += a[3][0];
mat[3][1] += a[3][1];
mat[3][2] += a[3][2];
mat[3][3] += a[3][3];
mat[3][4] += a[3][4];
mat[3][5] += a[3][5];
1627 mat[4][0] += a[4][0];
mat[4][1] += a[4][1];
mat[4][2] += a[4][2];
mat[4][3] += a[4][3];
mat[4][4] += a[4][4];
mat[4][5] += a[4][5];
1628 mat[5][0] += a[5][0];
mat[5][1] += a[5][1];
mat[5][2] += a[5][2];
mat[5][3] += a[5][3];
mat[5][4] += a[5][4];
mat[5][5] += a[5][5];
1633 mat[0][0] -= a[0][0];
mat[0][1] -= a[0][1];
mat[0][2] -= a[0][2];
mat[0][3] -= a[0][3];
mat[0][4] -= a[0][4];
mat[0][5] -= a[0][5];
1634 mat[1][0] -= a[1][0];
mat[1][1] -= a[1][1];
mat[1][2] -= a[1][2];
mat[1][3] -= a[1][3];
mat[1][4] -= a[1][4];
mat[1][5] -= a[1][5];
1635 mat[2][0] -= a[2][0];
mat[2][1] -= a[2][1];
mat[2][2] -= a[2][2];
mat[2][3] -= a[2][3];
mat[2][4] -= a[2][4];
mat[2][5] -= a[2][5];
1636 mat[3][0] -= a[3][0];
mat[3][1] -= a[3][1];
mat[3][2] -= a[3][2];
mat[3][3] -= a[3][3];
mat[3][4] -= a[3][4];
mat[3][5] -= a[3][5];
1637 mat[4][0] -= a[4][0];
mat[4][1] -= a[4][1];
mat[4][2] -= a[4][2];
mat[4][3] -= a[4][3];
mat[4][4] -= a[4][4];
mat[4][5] -= a[4][5];
1638 mat[5][0] -= a[5][0];
mat[5][1] -= a[5][1];
mat[5][2] -= a[5][2];
mat[5][3] -= a[5][3];
mat[5][4] -= a[5][4];
mat[5][5] -= a[5][5];
1657 const float *ptr1, *ptr2;
1659 ptr1 =
reinterpret_cast<const float *
>(
mat);
1660 ptr2 =
reinterpret_cast<const float *
>(a.
mat);
1661 for ( i = 0; i < 6*6; i++ ) {
1662 if ( ptr1[i] != ptr2[i] ) {
1671 const float *ptr1, *ptr2;
1673 ptr1 =
reinterpret_cast<const float *
>(
mat);
1674 ptr2 =
reinterpret_cast<const float *
>(a.
mat);
1675 for ( i = 0; i < 6*6; i++ ) {
1700 return Compare( mat6_identity, epsilon );
1704 for (
int i = 1;
i < 6;
i++ ) {
1705 for (
int j = 0;
j <
i;
j++ ) {
1715 for (
int i = 0;
i < 6;
i++ ) {
1716 for (
int j = 0;
j < 6;
j++ ) {
1726 assert( n >= 0 && n < 4 );
1727 int b0 = ((n & 2) >> 1) * 3;
1728 int b1 = (n & 1) * 3;
1730 mat[b0 + 0][b1 + 0],
mat[b0 + 0][b1 + 1],
mat[b0 + 0][b1 + 2],
1731 mat[b0 + 1][b1 + 0],
mat[b0 + 1][b1 + 1],
mat[b0 + 1][b1 + 2],
1732 mat[b0 + 2][b1 + 0],
mat[b0 + 2][b1 + 1],
mat[b0 + 2][b1 + 2] );
1780 #define MATX_MAX_TEMP 1024
1781 #define MATX_QUAD( x ) ( ( ( ( x ) + 3 ) & ~3 ) * sizeof( float ) )
1782 #define MATX_CLEAREND() int s = numRows * numColumns; while( s < ( ( s + 3 ) & ~3 ) ) { mat[s++] = 0.0f; }
1783 #define MATX_ALLOCA( n ) ( (float *) _alloca16( MATX_QUAD( n ) ) )
1789 explicit idMatX(
int rows,
int columns );
1790 explicit idMatX(
int rows,
int columns,
float *
src );
1793 void Set(
int rows,
int columns,
const float *src );
1819 void SetSize(
int rows,
int columns );
1820 void ChangeSize(
int rows,
int columns,
bool makeZero =
false );
1823 void SetData(
int rows,
int columns,
float *
data );
1825 void Zero(
int rows,
int columns );
1827 void Identity(
int rows,
int columns );
1829 void Random(
int seed,
float l = 0.0
f,
float u = 1.0
f );
1830 void Random(
int rows,
int columns,
int seed,
float l = 0.0
f,
float u = 1.0
f );
1859 float Trace(
void )
const;
1895 const char *
ToString(
int precision = 2 )
const;
1967 static void Test(
void );
1984 float Pythag(
float a,
float b )
const;
1990 void ComplexDivision(
float xr,
float xi,
float yr,
float yi,
float &cdivr,
float &cdivi );
2015 SetData( rows, columns, src );
2020 memcpy( this->
mat, src, rows * columns *
sizeof(
float ) );
2027 for ( i = 0; i < 3; i++ ) {
2028 for ( j = 0; j < 3; j++ ) {
2039 for ( i = 0; i < 3; i++ ) {
2040 for ( j = 0; j < 3; j++ ) {
2079 for ( i = 0; i <
s; i++ ) {
2124 for ( i = 0; i <
s; i++ ) {
2141 for ( i = 0; i <
s; i++ ) {
2154 for ( i = 0; i <
s; i++ ) {
2175 for ( i = 0; i <
s; i++ ) {
2190 for ( i = 0; i <
s; i++ ) {
2217 for ( i = 0; i <
s; i++ ) {
2218 if (
mat[i] != a.
mat[i] ) {
2231 for ( i = 0; i <
s; i++ ) {
2249 int alloc = ( rows * columns + 3 ) & ~3;
2265 newSize = ( rows * columns + 3 ) & ~3;
2271 idMatX::tempIndex += newSize;
2283 assert( ( ( (
int) data ) & 15 ) == 0 );
2295 memset(
mat, 0,
numRows * numColumns *
sizeof(
float ) );
2304 memset(
mat, 0, rows * columns *
sizeof(
float ) );
2313 memset(
mat, 0,
numRows * numColumns *
sizeof(
float ) );
2316 mat[
i * numColumns +
i] = 1.0f;
2321 assert( rows == columns );
2340 for ( i = 0; i <
s; i++ ) {
2353 for ( i = 0; i <
s; i++ ) {
2364 for ( i = 0; i <
s; i++ ) {
2373 for ( i = 0; i <
s; i++ ) {
2374 if (
mat[i] < min ) {
2376 }
else if (
mat[i] > max ) {
2385 ptr = (
float *) _alloca16(
numColumns *
sizeof(
float ) );
2386 memcpy( ptr,
mat + r1 *
numColumns, numColumns *
sizeof(
float ) );
2387 memcpy(
mat + r1 * numColumns,
mat + r2 * numColumns, numColumns *
sizeof(
float ) );
2388 memcpy(
mat + r2 * numColumns, ptr, numColumns *
sizeof(
float ) );
2397 for ( i = 0; i <
numRows; i++ ) {
2432 for ( i = 0; i <
size; i++ ) {
2439 float diff, maxDiff;
2444 for ( i = 0; i <
numRows; i++ ) {
2447 if ( maxDiff < 0.0f || diff > maxDiff ) {
2534 trace +=
mat[
i * numRows +
i];
2568 for ( i = 0; i <
numRows; i++ ) {
2716 const float *mPtr, *vPtr;
2722 for ( i = 0; i <
numRows; i++ ) {
2723 float sum = mPtr[0] * vPtr[0];
2725 sum += mPtr[
j] * vPtr[
j];
2738 const float *mPtr, *vPtr;
2744 for ( i = 0; i <
numRows; i++ ) {
2745 float sum = mPtr[0] * vPtr[0];
2747 sum += mPtr[
j] * vPtr[
j];
2760 const float *mPtr, *vPtr;
2766 for ( i = 0; i <
numRows; i++ ) {
2767 float sum = mPtr[0] * vPtr[0];
2769 sum += mPtr[
j] * vPtr[
j];
2782 const float *mPtr, *vPtr;
2789 float sum = mPtr[0] * vPtr[0];
2790 for ( j = 1; j <
numRows; j++ ) {
2792 sum += mPtr[0] * vPtr[
j];
2804 const float *mPtr, *vPtr;
2811 float sum = mPtr[0] * vPtr[0];
2812 for ( j = 1; j <
numRows; j++ ) {
2814 sum += mPtr[0] * vPtr[
j];
2826 const float *mPtr, *vPtr;
2833 float sum = mPtr[0] * vPtr[0];
2834 for ( j = 1; j <
numRows; j++ ) {
2836 sum += mPtr[0] * vPtr[
j];
2849 const float *m1Ptr, *m2Ptr;
2860 for ( i = 0; i < k; i++ ) {
2861 for ( j = 0; j <
l; j++ ) {
2863 sum = m1Ptr[0] * m2Ptr[0];
2866 sum += m1Ptr[
n] * m2Ptr[0];
2881 const float *m1Ptr, *m2Ptr;
2891 for ( i = 0; i < k; i++ ) {
2892 for ( j = 0; j <
l; j++ ) {
2895 sum = m1Ptr[0] * m2Ptr[0];
2896 for ( n = 1; n <
numRows; n++ ) {
2899 sum += m1Ptr[0] * m2Ptr[0];
idMat4 operator+(const idMat4 &a) const
idCQuat ToCQuat(void) const
bool IsRotated(void) const
bool InverseFastSelf(void)
idVecX TransposeMultiply(const idVecX &vec) const
idMatX operator-(const idMatX &a) const
void ComplexDivision(float xr, float xi, float yr, float yi, float &cdivr, float &cdivi)
void Cholesky_Solve(idVecX &x, const idVecX &b) const
idMatX & TransposeSelf(void)
idMatX & operator+=(const idMatX &a)
bool IsSymmetric(const float epsilon=MATRIX_EPSILON) const
idMat5 operator-(const idMat5 &a) const
bool Eigen_SolveSymmetric(idVecX &eigenValues)
void LU_Inverse(idMatX &inv, const int *index) const
virtual void VPCALL MatX_TransposeMultiplyAddVecX(idVecX &dst, const idMatX &mat, const idVecX &vec)=0
bool operator!=(const idMat3 &a) const
virtual void VPCALL Sub16(float *dst, const float *src1, const float *src2, const int count)=0
const float * ToFloatPtr(void) const
virtual void VPCALL SubAssign16(float *dst, const float *src, const int count)=0
assert(prefInfo.fullscreenBtn)
idMat4 Inverse(void) const
bool Cholesky_UpdateRowColumn(const idVecX &v, int r)
bool IsSquare(void) const
bool Compare(const idMat3 &a) const
bool operator!=(const idMatX &a) const
ID_INLINE void TransposeMultiply(const idMat3 &transpose, const idMat3 &b, idMat3 &dst)
void QR_Rotate(idMatX &R, int i, float a, float b)
bool Cholesky_UpdateIncrement(const idVecX &v)
bool IsSymmetric(const float epsilon=MATRIX_EPSILON) const
bool operator==(const idMat4 &a) const
idMat4 & operator-=(const idMat4 &a)
bool QR_UpdateRankOne(idMatX &R, const idVecX &v, const idVecX &w, float alpha)
float DeterminantGeneric(void) const
void UnprojectVector(const idVec4 &src, idVec4 &dst) const
bool QR_UpdateRowColumn(idMatX &R, const idVecX &v, const idVecX &w, int r)
void Update_RowColumn(const idVecX &v, const idVecX &w, int r)
const char * ToString(int precision=2) const
float MaxDifference(const idMatX &m) const
const float * ToFloatPtr(void) const
bool Inverse_UpdateIncrement(const idVecX &v, const idVecX &w)
idMat2 & operator*=(const float a)
idMat5 Inverse(void) const
bool SVD_Factor(idVecX &w, idMatX &V)
idMatX & SwapRows(int r1, int r2)
void SetTempSize(int rows, int columns)
virtual void VPCALL MatX_TransposeMultiplyMatX(idMatX &dst, const idMatX &m1, const idMatX &m2)=0
const float * ToFloatPtr(void) const
ID_INLINE idVec2 operator*(const idVec2 &vec, const idMat2 &mat)
bool Inverse_UpdateRankOne(const idVecX &v, const idVecX &w, float alpha)
bool Inverse_GaussJordan(void)
idMat3 Transpose(void) const
idMat2 InverseFast(void) const
void LDLT_MultiplyFactors(idMatX &m) const
idMatX & RemoveRow(int r)
void Set(int rows, int columns, const float *src)
idMatX & operator=(const idMatX &a)
bool InverseFastSelf(void)
bool LU_Factor(int *index, float *det=NULL)
void TriDiagonal_Inverse(idMatX &inv) const
idMat3 & operator-=(const idMat3 &a)
idMat2 Transpose(void) const
const float * ToFloatPtr(void) const
bool HessenbergToRealSchur(idMatX &H, idVecX &realEigenValues, idVecX &imaginaryEigenValues)
int GetDimension(void) const
idMat2 operator+(const idMat2 &a) const
virtual void VPCALL MatX_MultiplyMatX(idMatX &dst, const idMatX &m1, const idMatX &m2)=0
idMat3 & operator+=(const idMat3 &a)
idMat2 & operator+=(const idMat2 &a)
bool operator==(const idMatX &a) const
idMat6 operator*(const float a) const
bool operator==(const idMat6 &a) const
void LDLT_UnpackFactors(idMatX &L, idMatX &D) const
bool IsSymmetric(const float epsilon=MATRIX_EPSILON) const
bool Eigen_SolveSymmetricTriDiagonal(idVecX &eigenValues)
const char * ToString(int precision=2) const
int GetDimension(void) const
void Update_RankOne(const idVecX &v, const idVecX &w, float alpha)
bool IsPositiveDefinite(const float epsilon=MATRIX_EPSILON) const
float Determinant(void) const
const idVec4 & operator[](int index) const
void ClearUpperTriangle(void)
ID_INLINE idVec2 & operator*=(idVec2 &vec, const idMat2 &mat)
GLclampf GLclampf GLclampf alpha
idMatX Transpose(void) const
idMat4 Transpose(void) const
const char * ToString(int precision=2) const
void Update_RowColumnSymmetric(const idVecX &v, int r)
void MultiplySub(idVecX &dst, const idVecX &vec) const
idVec3 Cross(const idVec3 &a) const
void SVD_Solve(idVecX &x, const idVecX &b, const idVecX &w, const idMatX &V) const
bool IsRotated(void) const
void Cholesky_Inverse(idMatX &inv) const
bool Compare(const idMat2 &a) const
idMat5 & operator*=(const float a)
idMat6 InverseFast(void) const
idMat2 & TransposeSelf(void)
const float * ToFloatPtr(void) const
void Cholesky_MultiplyFactors(idMatX &m) const
void LU_MultiplyFactors(idMatX &m, const int *index) const
bool LU_UpdateIncrement(const idVecX &v, const idVecX &w, int *index)
idMat3 InverseFast(void) const
bool operator==(const idMat5 &a) const
virtual void VPCALL MatX_TransposeMultiplyVecX(idVecX &dst, const idMatX &mat, const idVecX &vec)=0
bool IsSymmetricPositiveSemiDefinite(const float epsilon=MATRIX_EPSILON) const
idMatX InverseFast(void) const
virtual void VPCALL Zero16(float *dst, const int count)=0
const idVec2 & operator[](int index) const
void Update_Increment(const idVecX &v, const idVecX &w)
idMatX & RemoveRowColumn(int r)
idMat4 & TransposeSelf(void)
bool LDLT_UpdateIncrement(const idVecX &v)
void MultiplyAdd(idVecX &dst, const idVecX &vec) const
idVec3 ToAngularVelocity(void) const
bool InverseFastSelf(void)
static float temp[MATX_MAX_TEMP+4]
idMat2 operator*(const float a) const
idMat2 Inverse(void) const
float Determinant(void) const
bool IsIdentity(const float epsilon=MATRIX_EPSILON) const
idMat5 & operator+=(const idMat5 &a)
void TransposeMultiplySub(idVecX &dst, const idVecX &vec) const
idMatX & RemoveColumn(int r)
bool LU_UpdateRankOne(const idVecX &v, const idVecX &w, float alpha, int *index)
bool IsDiagonal(const float epsilon=MATRIX_EPSILON) const
bool LDLT_UpdateRankOne(const idVecX &v, float alpha, int offset=0)
bool IsDiagonal(const float epsilon=MATRIX_EPSILON) const
GLfloat GLfloat GLfloat v2
idVecX Multiply(const idVecX &vec) const
idMat3 InertiaTranslate(const float mass, const idVec3 ¢erOfMass, const idVec3 &translation) const
int GetNumColumns(void) const
idMat3 SubMat3(int n) const
void ClearLowerTriangle(void)
idMat5 operator*(const float a) const
void Eigen_SortDecreasing(idVecX &eigenValues)
idMat6 Transpose(void) const
void TriDiagonal_ClearTriangles(void)
void Update_Decrement(int r)
const float * operator[](int index) const
GLubyte GLubyte GLubyte GLubyte w
bool IsSymmetric(const float epsilon=MATRIX_EPSILON) const
bool IsOrthonormal(const float epsilon=MATRIX_EPSILON) const
void LDLT_Solve(idVecX &x, const idVecX &b) const
bool IsDiagonal(const float epsilon=MATRIX_EPSILON) const
virtual void VPCALL AddAssign16(float *dst, const float *src, const int count)=0
virtual void VPCALL MatX_MultiplySubVecX(idVecX &dst, const idMatX &mat, const idVecX &vec)=0
void LU_UnpackFactors(idMatX &L, idMatX &U) const
bool operator!=(const idMat2 &a) const
const idVec3 & operator[](int index) const
bool IsDiagonal(const float epsilon=MATRIX_EPSILON) const
void HouseholderReduction(idVecX &diag, idVecX &subd)
idMatX & SwapColumns(int r1, int r2)
void LDLT_Inverse(idMatX &inv) const
const idVec6 & SubVec6(int row) const
virtual void VPCALL MatX_MultiplyVecX(idVecX &dst, const idMatX &mat, const idVecX &vec)=0
idMat4 TransposeMultiply(const idMat4 &b) const
static float Fabs(float f)
bool operator==(const idMat2 &a) const
idMat5 Transpose(void) const
bool IsDiagonal(const float epsilon=MATRIX_EPSILON) const
bool LDLT_UpdateDecrement(const idVecX &v, int r)
bool IsSymmetricPositiveDefinite(const float epsilon=MATRIX_EPSILON) const
idMat6 Inverse(void) const
bool IsIdentity(const float epsilon=MATRIX_EPSILON) const
const float * ToFloatPtr(void) const
GLsizei GLsizei GLenum GLenum const GLvoid * data
void SVD_BiDiag(idVecX &w, idVecX &rv1, float &anorm)
virtual void VPCALL MulAssign16(float *dst, const float constant, const int count)=0
virtual void VPCALL Mul16(float *dst, const float *src1, const float constant, const int count)=0
void * Mem_Alloc16(const int size)
bool QR_UpdateDecrement(idMatX &R, const idVecX &v, const idVecX &w, int r)
const char * ToString(int precision=2) const
int GetNumRows(void) const
void TransposeMultiplyAdd(idVecX &dst, const idVecX &vec) const
idMat4 operator*(const float a) const
bool IsZero(const float epsilon=MATRIX_EPSILON) const
bool operator==(const idMat3 &a) const
void Random(int seed, float l=0.0f, float u=1.0f)
void SVD_MultiplyFactors(idMatX &m, const idVecX &w, const idMatX &V) const
friend idMat3 SkewSymmetric(idVec3 const &src)
const char * ToString(int precision=2) const
bool InverseFastSelf(void)
bool Compare(const idMat4 &a) const
bool LU_UpdateRowColumn(const idVecX &v, const idVecX &w, int r, int *index)
bool Inverse_UpdateDecrement(const idVecX &v, const idVecX &w, int r)
void Update_IncrementSymmetric(const idVecX &v)
bool Compare(const idMat6 &a) const
idMat6 & operator+=(const idMat6 &a)
idMatX & SwapRowsColumns(int r1, int r2)
virtual void VPCALL Add16(float *dst, const float *src1, const float *src2, const int count)=0
idMatX & operator*=(const float a)
const idVec6 & operator[](int index) const
GLubyte GLubyte GLubyte a
bool operator!=(const idMat6 &a) const
bool TriDiagonal_Solve(idVecX &x, const idVecX &b) const
bool operator!=(const idMat5 &a) const
virtual void VPCALL Copy16(float *dst, const float *src, const int count)=0
bool Inverse_UpdateRowColumn(const idVecX &v, const idVecX &w, int r)
bool FixDegenerateNormal(void)
idMat3 & OrthoNormalizeSelf(void)
bool IsDiagonal(const float epsilon=MATRIX_EPSILON) const
bool IsPositiveSemiDefinite(const float epsilon=MATRIX_EPSILON) const
GLsizei GLboolean transpose
const float * ToFloatPtr(void) const
const char * ToString(int precision=2) const
virtual void VPCALL MatX_TransposeMultiplySubVecX(idVecX &dst, const idMatX &mat, const idVecX &vec)=0
float Determinant(void) const
idMat3 OrthoNormalize(void) const
void ProjectVector(const idVec3 &src, idVec3 &dst) const
bool Cholesky_UpdateDecrement(const idVecX &v, int r)
const float * ToFloatPtr(void) const
bool InverseSelfGeneric(void)
const idVecX SubVecX(int row) const
bool IsSymmetric(const float epsilon=MATRIX_EPSILON) const
void QR_MultiplyFactors(idMatX &m, const idVecX &c, const idVecX &d) const
bool IsIdentity(const float epsilon=MATRIX_EPSILON) const
int GetDimension(void) const
GLfloat GLfloat GLfloat GLfloat v3
idMatX operator*(const float a) const
bool Cholesky_Factor(void)
GLdouble GLdouble GLdouble r
bool IsPMatrix(const float epsilon=MATRIX_EPSILON) const
int GetDimension(void) const
void SetSize(int rows, int columns)
bool Cholesky_UpdateRankOne(const idVecX &v, float alpha, int offset=0)
void Update_RankOneSymmetric(const idVecX &v, float alpha)
virtual void VPCALL MatX_MultiplyAddVecX(idVecX &dst, const idMatX &mat, const idVecX &vec)=0
GLenum GLenum GLvoid * row
idMat3 & InertiaRotateSelf(const idMat3 &rotation)
idMat3 InertiaRotate(const idMat3 &rotation) const
const float * ToFloatPtr(void) const
idMat3 & operator*=(const float a)
void SVD_InitialWV(idVecX &w, idMatX &V, idVecX &rv1)
void SquareSubMatrix(const idMatX &m, int size)
idMat4 InverseFast(void) const
idQuat ToQuat(void) const
bool IsSymmetric(const float epsilon=MATRIX_EPSILON) const
const float * ToFloatPtr(void) const
bool IsIdentity(const float epsilon=MATRIX_EPSILON) const
void LU_Solve(idVecX &x, const idVecX &b, const int *index) const
int GetDimension(void) const
idMat2 & operator-=(const idMat2 &a)
void SetData(int rows, int columns, float *data)
const idVec5 & operator[](int index) const
void Mem_Free16(void *ptr)
void QR_Solve(idVecX &x, const idVecX &b, const idVecX &c, const idVecX &d) const
bool QR_UpdateIncrement(idMatX &R, const idVecX &v, const idVecX &w)
int GetDimension(void) const
void HessenbergReduction(idMatX &H)
bool IsIdentity(const float epsilon=MATRIX_EPSILON) const
bool QL(idVecX &diag, idVecX &subd)
void ProjectVector(const idVec4 &src, idVec4 &dst) const
idMat6 operator+(const idMat6 &a) const
idMatX Inverse(void) const
void SetData(int length, float *data)
bool operator!=(const idMat4 &a) const
bool UpperTriangularInverse(void)
idRotation ToRotation(void) const
bool InverseFastSelf(void)
void SVD_Inverse(idMatX &inv, const idVecX &w, const idMatX &V) const
bool QR_Factor(idVecX &c, idVecX &d)
idMat5 & TransposeSelf(void)
idAngles ToAngles(void) const
void QR_Inverse(idMatX &inv, const idVecX &c, const idVecX &d) const
idMat3 operator*(const float a) const
void UnprojectVector(const idVec3 &src, idVec3 &dst) const
idMat4 operator-(const idMat4 &a) const
idMat6 & TransposeSelf(void)
idMat6 & operator-=(const idMat6 &a)
ID_INLINE idMat3 SkewSymmetric(idVec3 const &src)
bool Eigen_Solve(idVecX &realEigenValues, idVecX &imaginaryEigenValues)
idMatX operator+(const idMatX &a) const
bool InverseFastSelf(void)
bool LowerTriangularInverse(void)
float Determinant(void) const
bool LDLT_UpdateRowColumn(const idVecX &v, int r)
idMat5 & operator-=(const idMat5 &a)
bool IsOrthogonal(const float epsilon=MATRIX_EPSILON) const
idMat3 & InertiaTranslateSelf(const float mass, const idVec3 ¢erOfMass, const idVec3 &translation)
void Eigen_SortIncreasing(idVecX &eigenValues)
const float * ToFloatPtr(void) const
virtual void VPCALL Negate16(float *dst, const int count)=0
idMat6 operator-(const idMat6 &a) const
void Inverse_Solve(idVecX &x, const idVecX &b) const
void QR_UnpackFactors(idMatX &Q, idMatX &R, const idVecX &c, const idVecX &d) const
void ChangeSize(int rows, int columns, bool makeZero=false)
float Determinant(void) const
idMat3 Inverse(void) const
idMat3 TransposeMultiply(const idMat3 &b) const
idMatX & operator-=(const idMatX &a)
const float * ToFloatPtr(void) const
idMat4 ToMat4(void) const
idMat3 operator+(const idMat3 &a) const
idMat5 InverseFast(void) const
idMat5 operator+(const idMat5 &a) const
idMat4 & operator*=(const float a)
bool IsZMatrix(const float epsilon=MATRIX_EPSILON) const
bool IsIdentity(const float epsilon=MATRIX_EPSILON) const
bool Compare(const idMat5 &a) const
bool FixDegeneracies(void)
bool IsTriDiagonal(const float epsilon=MATRIX_EPSILON) const
void SetTempSize(int size)
idMat6 & operator*=(const float a)
void Clamp(float min, float max)
float Pythag(float a, float b) const
void Diag(const idVecX &v)
bool LU_UpdateDecrement(const idVecX &v, const idVecX &w, const idVecX &u, int r, int *index)
idMat4 & operator+=(const idMat4 &a)
#define MATRIX_INVERSE_EPSILON
bool Compare(const idMatX &a) const
float Determinant(void) const
idMat3 & TransposeSelf(void)
idSIMDProcessor * SIMDProcessor