29 #include "../precompiled.h"
50 double det, invDet,
a;
61 mat[0][0] = mat[1][1] * invDet;
62 mat[0][1] = - mat[0][1] * invDet;
63 mat[1][0] = - mat[1][0] * invDet;
64 mat[1][1] = a * invDet;
78 double det, invDet,
a;
89 mat[0][0] = mat[1][1] * invDet;
90 mat[0][1] = - mat[0][1] * invDet;
91 mat[1][0] = - mat[1][0] * invDet;
92 mat[1][1] = a * invDet;
98 float *mat =
reinterpret_cast<float *
>(
this);
104 mat[0*2+0] = d = 1.0f / di;
109 mat[1*2+1] += mat[0*2+1] * d;
112 mat[1*2+1] = d = 1.0f / di;
117 mat[0*2+0] += mat[1*2+0] * d;
158 }
else if ( sp < -1.0
f ) {
191 static int next[ 3 ] = { 1, 2, 0 };
193 trace =
mat[ 0 ][ 0 ] +
mat[ 1 ][ 1 ] +
mat[ 2 ][ 2 ];
195 if ( trace > 0.0
f ) {
201 q[0] = ( mat[ 2 ][ 1 ] - mat[ 1 ][ 2 ] ) * s;
202 q[1] = ( mat[ 0 ][ 2 ] - mat[ 2 ][ 0 ] ) * s;
203 q[2] = ( mat[ 1 ][ 0 ] - mat[ 0 ][ 1 ] ) * s;
208 if ( mat[ 1 ][ 1 ] > mat[ 0 ][ 0 ] ) {
211 if ( mat[ 2 ][ 2 ] > mat[ i ][ i ] ) {
217 t = ( mat[
i ][
i ] - ( mat[
j ][
j ] + mat[ k ][ k ] ) ) + 1.0f;
221 q[3] = ( mat[ k ][
j ] - mat[
j ][ k ] ) * s;
222 q[
j] = ( mat[
j ][
i ] + mat[
i ][
j ] ) * s;
223 q[k] = ( mat[ k ][
i ] + mat[
i ][ k ] ) * s;
254 static int next[ 3 ] = { 1, 2, 0 };
256 trace =
mat[ 0 ][ 0 ] +
mat[ 1 ][ 1 ] +
mat[ 2 ][ 2 ];
257 if ( trace > 0.0
f ) {
263 r.
vec[0] = ( mat[ 2 ][ 1 ] - mat[ 1 ][ 2 ] ) * s;
264 r.
vec[1] = ( mat[ 0 ][ 2 ] - mat[ 2 ][ 0 ] ) * s;
265 r.
vec[2] = ( mat[ 1 ][ 0 ] - mat[ 0 ][ 1 ] ) * s;
270 if ( mat[ 1 ][ 1 ] > mat[ 0 ][ 0 ] ) {
273 if ( mat[ 2 ][ 2 ] > mat[ i ][ i ] ) {
279 t = ( mat[
i ][
i ] - ( mat[
j ][
j ] + mat[ k ][ k ] ) ) + 1.0f;
283 r.
angle = ( mat[ k ][
j ] - mat[
j ][ k ] ) * s;
284 r.
vec[
j] = ( mat[
j ][
i ] + mat[
i ][
j ] ) * s;
285 r.
vec[k] = ( mat[ k ][
i ] + mat[
i ][ k ] ) * s;
321 float det2_12_01 =
mat[1][0] *
mat[2][1] -
mat[1][1] *
mat[2][0];
322 float det2_12_02 = mat[1][0] * mat[2][2] - mat[1][2] * mat[2][0];
323 float det2_12_12 = mat[1][1] * mat[2][2] - mat[1][2] * mat[2][1];
325 return mat[0][0] * det2_12_12 - mat[0][1] * det2_12_02 + mat[0][2] * det2_12_01;
339 inverse[0][0] =
mat[1][1] *
mat[2][2] -
mat[1][2] *
mat[2][1];
340 inverse[1][0] = mat[1][2] * mat[2][0] - mat[1][0] * mat[2][2];
341 inverse[2][0] = mat[1][0] * mat[2][1] - mat[1][1] * mat[2][0];
343 det = mat[0][0] * inverse[0][0] + mat[0][1] * inverse[1][0] + mat[0][2] * inverse[2][0];
351 inverse[0][1] = mat[0][2] * mat[2][1] - mat[0][1] * mat[2][2];
352 inverse[0][2] = mat[0][1] * mat[1][2] - mat[0][2] * mat[1][1];
353 inverse[1][1] = mat[0][0] * mat[2][2] - mat[0][2] * mat[2][0];
354 inverse[1][2] = mat[0][2] * mat[1][0] - mat[0][0] * mat[1][2];
355 inverse[2][1] = mat[0][1] * mat[2][0] - mat[0][0] * mat[2][1];
356 inverse[2][2] = mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0];
358 mat[0][0] = inverse[0][0] * invDet;
359 mat[0][1] = inverse[0][1] * invDet;
360 mat[0][2] = inverse[0][2] * invDet;
362 mat[1][0] = inverse[1][0] * invDet;
363 mat[1][1] = inverse[1][1] * invDet;
364 mat[1][2] = inverse[1][2] * invDet;
366 mat[2][0] = inverse[2][0] * invDet;
367 mat[2][1] = inverse[2][1] * invDet;
368 mat[2][2] = inverse[2][2] * invDet;
385 inverse[0][0] =
mat[1][1] *
mat[2][2] -
mat[1][2] *
mat[2][1];
386 inverse[1][0] = mat[1][2] * mat[2][0] - mat[1][0] * mat[2][2];
387 inverse[2][0] = mat[1][0] * mat[2][1] - mat[1][1] * mat[2][0];
389 det = mat[0][0] * inverse[0][0] + mat[0][1] * inverse[1][0] + mat[0][2] * inverse[2][0];
397 inverse[0][1] = mat[0][2] * mat[2][1] - mat[0][1] * mat[2][2];
398 inverse[0][2] = mat[0][1] * mat[1][2] - mat[0][2] * mat[1][1];
399 inverse[1][1] = mat[0][0] * mat[2][2] - mat[0][2] * mat[2][0];
400 inverse[1][2] = mat[0][2] * mat[1][0] - mat[0][0] * mat[1][2];
401 inverse[2][1] = mat[0][1] * mat[2][0] - mat[0][0] * mat[2][1];
402 inverse[2][2] = mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0];
404 mat[0][0] = inverse[0][0] * invDet;
405 mat[0][1] = inverse[0][1] * invDet;
406 mat[0][2] = inverse[0][2] * invDet;
408 mat[1][0] = inverse[1][0] * invDet;
409 mat[1][1] = inverse[1][1] * invDet;
410 mat[1][2] = inverse[1][2] * invDet;
412 mat[2][0] = inverse[2][0] * invDet;
413 mat[2][1] = inverse[2][1] * invDet;
414 mat[2][2] = inverse[2][2] * invDet;
420 float *mat =
reinterpret_cast<float *
>(
this);
426 mat[0] = d = 1.0f / di;
433 mat[4] += mat[1] * d;
434 mat[5] += mat[2] * d;
436 mat[7] += mat[1] * d;
437 mat[8] += mat[2] * d;
440 mat[4] = d = 1.0f / di;
447 mat[0] += mat[3] * d;
448 mat[2] += mat[5] * d;
450 mat[6] += mat[3] * d;
451 mat[8] += mat[5] * d;
454 mat[8] = d = 1.0f / di;
461 mat[0] += mat[6] * d;
462 mat[1] += mat[7] * d;
464 mat[3] += mat[6] * d;
465 mat[4] += mat[7] * d;
472 float r1[2], r2[2], r3;
474 float *mat =
reinterpret_cast<float *
>(
this);
477 det = mat[0*3+0] * mat[1*3+1] - mat[0*3+1] * mat[1*3+0];
485 r0[0][0] = mat[1*3+1] * invDet;
486 r0[0][1] = - mat[0*3+1] * invDet;
487 r0[1][0] = - mat[1*3+0] * invDet;
488 r0[1][1] = mat[0*3+0] * invDet;
491 r1[0] = r0[0][0] * mat[0*3+2] + r0[0][1] * mat[1*3+2];
492 r1[1] = r0[1][0] * mat[0*3+2] + r0[1][1] * mat[1*3+2];
495 r2[0] = mat[2*3+0] * r1[0] + mat[2*3+1] * r1[1];
498 r3 = r2[0] - mat[2*3+2];
508 r2[0] = mat[2*3+0] * r0[0][0] + mat[2*3+1] * r0[1][0];
509 r2[1] = mat[2*3+0] * r0[0][1] + mat[2*3+1] * r0[1][1];
512 mat[2*3+0] = r3 * r2[0];
513 mat[2*3+1] = r3 * r2[1];
516 mat[0*3+0] = r0[0][0] - r1[0] * mat[2*3+0];
517 mat[0*3+1] = r0[0][1] - r1[0] * mat[2*3+1];
518 mat[1*3+0] = r0[1][0] - r1[1] * mat[2*3+0];
519 mat[1*3+1] = r0[1][1] - r1[1] * mat[2*3+1];
522 mat[0*3+2] = r1[0] * r3;
523 mat[1*3+2] = r1[1] * r3;
541 newCenter = centerOfMass + translation;
543 m[0][0] = mass * ( ( centerOfMass[1] * centerOfMass[1] + centerOfMass[2] * centerOfMass[2] )
544 - ( newCenter[1] * newCenter[1] + newCenter[2] * newCenter[2] ) );
545 m[1][1] = mass * ( ( centerOfMass[0] * centerOfMass[0] + centerOfMass[2] * centerOfMass[2] )
546 - ( newCenter[0] * newCenter[0] + newCenter[2] * newCenter[2] ) );
547 m[2][2] = mass * ( ( centerOfMass[0] * centerOfMass[0] + centerOfMass[1] * centerOfMass[1] )
548 - ( newCenter[0] * newCenter[0] + newCenter[1] * newCenter[1] ) );
550 m[0][1] = m[1][0] = mass * ( newCenter[0] * newCenter[1] - centerOfMass[0] * centerOfMass[1] );
551 m[1][2] = m[2][1] = mass * ( newCenter[1] * newCenter[2] - centerOfMass[1] * centerOfMass[2] );
552 m[0][2] = m[2][0] = mass * ( newCenter[0] * newCenter[2] - centerOfMass[0] * centerOfMass[2] );
566 newCenter = centerOfMass + translation;
568 m[0][0] = mass * ( ( centerOfMass[1] * centerOfMass[1] + centerOfMass[2] * centerOfMass[2] )
569 - ( newCenter[1] * newCenter[1] + newCenter[2] * newCenter[2] ) );
570 m[1][1] = mass * ( ( centerOfMass[0] * centerOfMass[0] + centerOfMass[2] * centerOfMass[2] )
571 - ( newCenter[0] * newCenter[0] + newCenter[2] * newCenter[2] ) );
572 m[2][2] = mass * ( ( centerOfMass[0] * centerOfMass[0] + centerOfMass[1] * centerOfMass[1] )
573 - ( newCenter[0] * newCenter[0] + newCenter[1] * newCenter[1] ) );
575 m[0][1] = m[1][0] = mass * ( newCenter[0] * newCenter[1] - centerOfMass[0] * centerOfMass[1] );
576 m[1][2] = m[2][1] = mass * ( newCenter[1] * newCenter[2] - centerOfMass[1] * centerOfMass[2] );
577 m[0][2] = m[2][0] = mass * ( newCenter[0] * newCenter[2] - centerOfMass[0] * centerOfMass[2] );
591 return rotation.
Transpose() * (*this) * rotation;
601 *
this = rotation.
Transpose() * (*this) * rotation;
621 idMat4 mat4_zero(
idVec4( 0, 0, 0, 0 ),
idVec4( 0, 0, 0, 0 ),
idVec4( 0, 0, 0, 0 ),
idVec4( 0, 0, 0, 0 ) );
622 idMat4 mat4_identity(
idVec4( 1, 0, 0, 0 ),
idVec4( 0, 1, 0, 0 ),
idVec4( 0, 0, 1, 0 ),
idVec4( 0, 0, 0, 1 ) );
633 for( i = 0; i < 4; i++ ) {
634 for( j = 0; j < 4; j++ ) {
635 transpose[
i ][
j ] =
mat[
j ][
i ];
650 for( i = 0; i < 4; i++ ) {
651 for( j = i + 1; j < 4; j++ ) {
652 temp =
mat[
i ][
j ];
654 mat[
j ][
i ] = temp;
668 float det2_01_01 =
mat[0][0] *
mat[1][1] -
mat[0][1] *
mat[1][0];
669 float det2_01_02 = mat[0][0] * mat[1][2] - mat[0][2] * mat[1][0];
670 float det2_01_03 = mat[0][0] * mat[1][3] - mat[0][3] * mat[1][0];
671 float det2_01_12 = mat[0][1] * mat[1][2] - mat[0][2] * mat[1][1];
672 float det2_01_13 = mat[0][1] * mat[1][3] - mat[0][3] * mat[1][1];
673 float det2_01_23 = mat[0][2] * mat[1][3] - mat[0][3] * mat[1][2];
676 float det3_201_012 = mat[2][0] * det2_01_12 - mat[2][1] * det2_01_02 + mat[2][2] * det2_01_01;
677 float det3_201_013 = mat[2][0] * det2_01_13 - mat[2][1] * det2_01_03 + mat[2][3] * det2_01_01;
678 float det3_201_023 = mat[2][0] * det2_01_23 - mat[2][2] * det2_01_03 + mat[2][3] * det2_01_02;
679 float det3_201_123 = mat[2][1] * det2_01_23 - mat[2][2] * det2_01_13 + mat[2][3] * det2_01_12;
681 return ( - det3_201_123 * mat[3][0] + det3_201_023 * mat[3][1] - det3_201_013 * mat[3][2] + det3_201_012 * mat[3][3] );
695 float det2_01_01 =
mat[0][0] *
mat[1][1] -
mat[0][1] *
mat[1][0];
696 float det2_01_02 = mat[0][0] * mat[1][2] - mat[0][2] * mat[1][0];
697 float det2_01_03 = mat[0][0] * mat[1][3] - mat[0][3] * mat[1][0];
698 float det2_01_12 = mat[0][1] * mat[1][2] - mat[0][2] * mat[1][1];
699 float det2_01_13 = mat[0][1] * mat[1][3] - mat[0][3] * mat[1][1];
700 float det2_01_23 = mat[0][2] * mat[1][3] - mat[0][3] * mat[1][2];
703 float det3_201_012 = mat[2][0] * det2_01_12 - mat[2][1] * det2_01_02 + mat[2][2] * det2_01_01;
704 float det3_201_013 = mat[2][0] * det2_01_13 - mat[2][1] * det2_01_03 + mat[2][3] * det2_01_01;
705 float det3_201_023 = mat[2][0] * det2_01_23 - mat[2][2] * det2_01_03 + mat[2][3] * det2_01_02;
706 float det3_201_123 = mat[2][1] * det2_01_23 - mat[2][2] * det2_01_13 + mat[2][3] * det2_01_12;
708 det = ( - det3_201_123 * mat[3][0] + det3_201_023 * mat[3][1] - det3_201_013 * mat[3][2] + det3_201_012 * mat[3][3] );
717 float det2_03_01 = mat[0][0] * mat[3][1] - mat[0][1] * mat[3][0];
718 float det2_03_02 = mat[0][0] * mat[3][2] - mat[0][2] * mat[3][0];
719 float det2_03_03 = mat[0][0] * mat[3][3] - mat[0][3] * mat[3][0];
720 float det2_03_12 = mat[0][1] * mat[3][2] - mat[0][2] * mat[3][1];
721 float det2_03_13 = mat[0][1] * mat[3][3] - mat[0][3] * mat[3][1];
722 float det2_03_23 = mat[0][2] * mat[3][3] - mat[0][3] * mat[3][2];
724 float det2_13_01 = mat[1][0] * mat[3][1] - mat[1][1] * mat[3][0];
725 float det2_13_02 = mat[1][0] * mat[3][2] - mat[1][2] * mat[3][0];
726 float det2_13_03 = mat[1][0] * mat[3][3] - mat[1][3] * mat[3][0];
727 float det2_13_12 = mat[1][1] * mat[3][2] - mat[1][2] * mat[3][1];
728 float det2_13_13 = mat[1][1] * mat[3][3] - mat[1][3] * mat[3][1];
729 float det2_13_23 = mat[1][2] * mat[3][3] - mat[1][3] * mat[3][2];
732 float det3_203_012 = mat[2][0] * det2_03_12 - mat[2][1] * det2_03_02 + mat[2][2] * det2_03_01;
733 float det3_203_013 = mat[2][0] * det2_03_13 - mat[2][1] * det2_03_03 + mat[2][3] * det2_03_01;
734 float det3_203_023 = mat[2][0] * det2_03_23 - mat[2][2] * det2_03_03 + mat[2][3] * det2_03_02;
735 float det3_203_123 = mat[2][1] * det2_03_23 - mat[2][2] * det2_03_13 + mat[2][3] * det2_03_12;
737 float det3_213_012 = mat[2][0] * det2_13_12 - mat[2][1] * det2_13_02 + mat[2][2] * det2_13_01;
738 float det3_213_013 = mat[2][0] * det2_13_13 - mat[2][1] * det2_13_03 + mat[2][3] * det2_13_01;
739 float det3_213_023 = mat[2][0] * det2_13_23 - mat[2][2] * det2_13_03 + mat[2][3] * det2_13_02;
740 float det3_213_123 = mat[2][1] * det2_13_23 - mat[2][2] * det2_13_13 + mat[2][3] * det2_13_12;
742 float det3_301_012 = mat[3][0] * det2_01_12 - mat[3][1] * det2_01_02 + mat[3][2] * det2_01_01;
743 float det3_301_013 = mat[3][0] * det2_01_13 - mat[3][1] * det2_01_03 + mat[3][3] * det2_01_01;
744 float det3_301_023 = mat[3][0] * det2_01_23 - mat[3][2] * det2_01_03 + mat[3][3] * det2_01_02;
745 float det3_301_123 = mat[3][1] * det2_01_23 - mat[3][2] * det2_01_13 + mat[3][3] * det2_01_12;
747 mat[0][0] = - det3_213_123 * invDet;
748 mat[1][0] = + det3_213_023 * invDet;
749 mat[2][0] = - det3_213_013 * invDet;
750 mat[3][0] = + det3_213_012 * invDet;
752 mat[0][1] = + det3_203_123 * invDet;
753 mat[1][1] = - det3_203_023 * invDet;
754 mat[2][1] = + det3_203_013 * invDet;
755 mat[3][1] = - det3_203_012 * invDet;
757 mat[0][2] = + det3_301_123 * invDet;
758 mat[1][2] = - det3_301_023 * invDet;
759 mat[2][2] = + det3_301_013 * invDet;
760 mat[3][2] = - det3_301_012 * invDet;
762 mat[0][3] = - det3_201_123 * invDet;
763 mat[1][3] = + det3_201_023 * invDet;
764 mat[2][3] = - det3_201_013 * invDet;
765 mat[3][3] = + det3_201_012 * invDet;
782 float det2_01_01 =
mat[0][0] *
mat[1][1] -
mat[0][1] *
mat[1][0];
783 float det2_01_02 = mat[0][0] * mat[1][2] - mat[0][2] * mat[1][0];
784 float det2_01_03 = mat[0][0] * mat[1][3] - mat[0][3] * mat[1][0];
785 float det2_01_12 = mat[0][1] * mat[1][2] - mat[0][2] * mat[1][1];
786 float det2_01_13 = mat[0][1] * mat[1][3] - mat[0][3] * mat[1][1];
787 float det2_01_23 = mat[0][2] * mat[1][3] - mat[0][3] * mat[1][2];
790 float det3_201_012 = mat[2][0] * det2_01_12 - mat[2][1] * det2_01_02 + mat[2][2] * det2_01_01;
791 float det3_201_013 = mat[2][0] * det2_01_13 - mat[2][1] * det2_01_03 + mat[2][3] * det2_01_01;
792 float det3_201_023 = mat[2][0] * det2_01_23 - mat[2][2] * det2_01_03 + mat[2][3] * det2_01_02;
793 float det3_201_123 = mat[2][1] * det2_01_23 - mat[2][2] * det2_01_13 + mat[2][3] * det2_01_12;
795 det = ( - det3_201_123 * mat[3][0] + det3_201_023 * mat[3][1] - det3_201_013 * mat[3][2] + det3_201_012 * mat[3][3] );
804 float det2_03_01 = mat[0][0] * mat[3][1] - mat[0][1] * mat[3][0];
805 float det2_03_02 = mat[0][0] * mat[3][2] - mat[0][2] * mat[3][0];
806 float det2_03_03 = mat[0][0] * mat[3][3] - mat[0][3] * mat[3][0];
807 float det2_03_12 = mat[0][1] * mat[3][2] - mat[0][2] * mat[3][1];
808 float det2_03_13 = mat[0][1] * mat[3][3] - mat[0][3] * mat[3][1];
809 float det2_03_23 = mat[0][2] * mat[3][3] - mat[0][3] * mat[3][2];
811 float det2_13_01 = mat[1][0] * mat[3][1] - mat[1][1] * mat[3][0];
812 float det2_13_02 = mat[1][0] * mat[3][2] - mat[1][2] * mat[3][0];
813 float det2_13_03 = mat[1][0] * mat[3][3] - mat[1][3] * mat[3][0];
814 float det2_13_12 = mat[1][1] * mat[3][2] - mat[1][2] * mat[3][1];
815 float det2_13_13 = mat[1][1] * mat[3][3] - mat[1][3] * mat[3][1];
816 float det2_13_23 = mat[1][2] * mat[3][3] - mat[1][3] * mat[3][2];
819 float det3_203_012 = mat[2][0] * det2_03_12 - mat[2][1] * det2_03_02 + mat[2][2] * det2_03_01;
820 float det3_203_013 = mat[2][0] * det2_03_13 - mat[2][1] * det2_03_03 + mat[2][3] * det2_03_01;
821 float det3_203_023 = mat[2][0] * det2_03_23 - mat[2][2] * det2_03_03 + mat[2][3] * det2_03_02;
822 float det3_203_123 = mat[2][1] * det2_03_23 - mat[2][2] * det2_03_13 + mat[2][3] * det2_03_12;
824 float det3_213_012 = mat[2][0] * det2_13_12 - mat[2][1] * det2_13_02 + mat[2][2] * det2_13_01;
825 float det3_213_013 = mat[2][0] * det2_13_13 - mat[2][1] * det2_13_03 + mat[2][3] * det2_13_01;
826 float det3_213_023 = mat[2][0] * det2_13_23 - mat[2][2] * det2_13_03 + mat[2][3] * det2_13_02;
827 float det3_213_123 = mat[2][1] * det2_13_23 - mat[2][2] * det2_13_13 + mat[2][3] * det2_13_12;
829 float det3_301_012 = mat[3][0] * det2_01_12 - mat[3][1] * det2_01_02 + mat[3][2] * det2_01_01;
830 float det3_301_013 = mat[3][0] * det2_01_13 - mat[3][1] * det2_01_03 + mat[3][3] * det2_01_01;
831 float det3_301_023 = mat[3][0] * det2_01_23 - mat[3][2] * det2_01_03 + mat[3][3] * det2_01_02;
832 float det3_301_123 = mat[3][1] * det2_01_23 - mat[3][2] * det2_01_13 + mat[3][3] * det2_01_12;
834 mat[0][0] = - det3_213_123 * invDet;
835 mat[1][0] = + det3_213_023 * invDet;
836 mat[2][0] = - det3_213_013 * invDet;
837 mat[3][0] = + det3_213_012 * invDet;
839 mat[0][1] = + det3_203_123 * invDet;
840 mat[1][1] = - det3_203_023 * invDet;
841 mat[2][1] = + det3_203_013 * invDet;
842 mat[3][1] = - det3_203_012 * invDet;
844 mat[0][2] = + det3_301_123 * invDet;
845 mat[1][2] = - det3_301_023 * invDet;
846 mat[2][2] = + det3_301_013 * invDet;
847 mat[3][2] = - det3_301_012 * invDet;
849 mat[0][3] = - det3_201_123 * invDet;
850 mat[1][3] = + det3_201_023 * invDet;
851 mat[2][3] = - det3_201_013 * invDet;
852 mat[3][3] = + det3_201_012 * invDet;
858 float *mat =
reinterpret_cast<float *
>(
this);
864 mat[0] = d = 1.0f / di;
873 mat[5] += mat[1] * d;
874 mat[6] += mat[2] * d;
875 mat[7] += mat[3] * d;
877 mat[9] += mat[1] * d;
878 mat[10] += mat[2] * d;
879 mat[11] += mat[3] * d;
881 mat[13] += mat[1] * d;
882 mat[14] += mat[2] * d;
883 mat[15] += mat[3] * d;
886 mat[5] = d = 1.0f / di;
895 mat[0] += mat[4] * d;
896 mat[2] += mat[6] * d;
897 mat[3] += mat[7] * d;
899 mat[8] += mat[4] * d;
900 mat[10] += mat[6] * d;
901 mat[11] += mat[7] * d;
903 mat[12] += mat[4] * d;
904 mat[14] += mat[6] * d;
905 mat[15] += mat[7] * d;
908 mat[10] = d = 1.0f / di;
917 mat[0] += mat[8] * d;
918 mat[1] += mat[9] * d;
919 mat[3] += mat[11] * d;
921 mat[4] += mat[8] * d;
922 mat[5] += mat[9] * d;
923 mat[7] += mat[11] * d;
925 mat[12] += mat[8] * d;
926 mat[13] += mat[9] * d;
927 mat[15] += mat[11] * d;
930 mat[15] = d = 1.0f / di;
939 mat[0] += mat[12] * d;
940 mat[1] += mat[13] * d;
941 mat[2] += mat[14] * d;
943 mat[4] += mat[12] * d;
944 mat[5] += mat[13] * d;
945 mat[6] += mat[14] * d;
947 mat[8] += mat[12] * d;
948 mat[9] += mat[13] * d;
949 mat[10] += mat[14] * d;
956 float a, det, invDet;
957 float *mat =
reinterpret_cast<float *
>(
this);
960 det = mat[0*4+0] * mat[1*4+1] - mat[0*4+1] * mat[1*4+0];
968 r0[0][0] = mat[1*4+1] * invDet;
969 r0[0][1] = - mat[0*4+1] * invDet;
970 r0[1][0] = - mat[1*4+0] * invDet;
971 r0[1][1] = mat[0*4+0] * invDet;
974 r1[0][0] = r0[0][0] * mat[0*4+2] + r0[0][1] * mat[1*4+2];
975 r1[0][1] = r0[0][0] * mat[0*4+3] + r0[0][1] * mat[1*4+3];
976 r1[1][0] = r0[1][0] * mat[0*4+2] + r0[1][1] * mat[1*4+2];
977 r1[1][1] = r0[1][0] * mat[0*4+3] + r0[1][1] * mat[1*4+3];
980 r2[0][0] = mat[2*4+0] * r1[0][0] + mat[2*4+1] * r1[1][0];
981 r2[0][1] = mat[2*4+0] * r1[0][1] + mat[2*4+1] * r1[1][1];
982 r2[1][0] = mat[3*4+0] * r1[0][0] + mat[3*4+1] * r1[1][0];
983 r2[1][1] = mat[3*4+0] * r1[0][1] + mat[3*4+1] * r1[1][1];
986 r3[0][0] = r2[0][0] - mat[2*4+2];
987 r3[0][1] = r2[0][1] - mat[2*4+3];
988 r3[1][0] = r2[1][0] - mat[3*4+2];
989 r3[1][1] = r2[1][1] - mat[3*4+3];
992 det = r3[0][0] * r3[1][1] - r3[0][1] * r3[1][0];
1001 r3[0][0] = r3[1][1] * invDet;
1002 r3[0][1] = - r3[0][1] * invDet;
1003 r3[1][0] = - r3[1][0] * invDet;
1004 r3[1][1] = a * invDet;
1007 r2[0][0] = mat[2*4+0] * r0[0][0] + mat[2*4+1] * r0[1][0];
1008 r2[0][1] = mat[2*4+0] * r0[0][1] + mat[2*4+1] * r0[1][1];
1009 r2[1][0] = mat[3*4+0] * r0[0][0] + mat[3*4+1] * r0[1][0];
1010 r2[1][1] = mat[3*4+0] * r0[0][1] + mat[3*4+1] * r0[1][1];
1013 mat[2*4+0] = r3[0][0] * r2[0][0] + r3[0][1] * r2[1][0];
1014 mat[2*4+1] = r3[0][0] * r2[0][1] + r3[0][1] * r2[1][1];
1015 mat[3*4+0] = r3[1][0] * r2[0][0] + r3[1][1] * r2[1][0];
1016 mat[3*4+1] = r3[1][0] * r2[0][1] + r3[1][1] * r2[1][1];
1019 mat[0*4+0] = r0[0][0] - r1[0][0] * mat[2*4+0] - r1[0][1] * mat[3*4+0];
1020 mat[0*4+1] = r0[0][1] - r1[0][0] * mat[2*4+1] - r1[0][1] * mat[3*4+1];
1021 mat[1*4+0] = r0[1][0] - r1[1][0] * mat[2*4+0] - r1[1][1] * mat[3*4+0];
1022 mat[1*4+1] = r0[1][1] - r1[1][0] * mat[2*4+1] - r1[1][1] * mat[3*4+1];
1025 mat[0*4+2] = r1[0][0] * r3[0][0] + r1[0][1] * r3[1][0];
1026 mat[0*4+3] = r1[0][0] * r3[0][1] + r1[0][1] * r3[1][1];
1027 mat[1*4+2] = r1[1][0] * r3[0][0] + r1[1][1] * r3[1][0];
1028 mat[1*4+3] = r1[1][0] * r3[0][1] + r1[1][1] * r3[1][1];
1031 mat[2*4+2] = -r3[0][0];
1032 mat[2*4+3] = -r3[0][1];
1033 mat[3*4+2] = -r3[1][0];
1034 mat[3*4+3] = -r3[1][1];
1056 idMat5 mat5_zero(
idVec5( 0, 0, 0, 0, 0 ),
idVec5( 0, 0, 0, 0, 0 ),
idVec5( 0, 0, 0, 0, 0 ),
idVec5( 0, 0, 0, 0, 0 ),
idVec5( 0, 0, 0, 0, 0 ) );
1057 idMat5 mat5_identity(
idVec5( 1, 0, 0, 0, 0 ),
idVec5( 0, 1, 0, 0, 0 ),
idVec5( 0, 0, 1, 0, 0 ),
idVec5( 0, 0, 0, 1, 0 ),
idVec5( 0, 0, 0, 0, 1 ) );
1068 for( i = 0; i < 5; i++ ) {
1069 for( j = 0; j < 5; j++ ) {
1070 transpose[
i ][
j ] =
mat[
j ][
i ];
1085 for( i = 0; i < 5; i++ ) {
1086 for( j = i + 1; j < 5; j++ ) {
1087 temp =
mat[
i ][
j ];
1089 mat[
j ][
i ] = temp;
1103 float det2_34_01 =
mat[3][0] *
mat[4][1] -
mat[3][1] *
mat[4][0];
1104 float det2_34_02 = mat[3][0] * mat[4][2] - mat[3][2] * mat[4][0];
1105 float det2_34_03 = mat[3][0] * mat[4][3] - mat[3][3] * mat[4][0];
1106 float det2_34_04 = mat[3][0] * mat[4][4] - mat[3][4] * mat[4][0];
1107 float det2_34_12 = mat[3][1] * mat[4][2] - mat[3][2] * mat[4][1];
1108 float det2_34_13 = mat[3][1] * mat[4][3] - mat[3][3] * mat[4][1];
1109 float det2_34_14 = mat[3][1] * mat[4][4] - mat[3][4] * mat[4][1];
1110 float det2_34_23 = mat[3][2] * mat[4][3] - mat[3][3] * mat[4][2];
1111 float det2_34_24 = mat[3][2] * mat[4][4] - mat[3][4] * mat[4][2];
1112 float det2_34_34 = mat[3][3] * mat[4][4] - mat[3][4] * mat[4][3];
1115 float det3_234_012 = mat[2][0] * det2_34_12 - mat[2][1] * det2_34_02 + mat[2][2] * det2_34_01;
1116 float det3_234_013 = mat[2][0] * det2_34_13 - mat[2][1] * det2_34_03 + mat[2][3] * det2_34_01;
1117 float det3_234_014 = mat[2][0] * det2_34_14 - mat[2][1] * det2_34_04 + mat[2][4] * det2_34_01;
1118 float det3_234_023 = mat[2][0] * det2_34_23 - mat[2][2] * det2_34_03 + mat[2][3] * det2_34_02;
1119 float det3_234_024 = mat[2][0] * det2_34_24 - mat[2][2] * det2_34_04 + mat[2][4] * det2_34_02;
1120 float det3_234_034 = mat[2][0] * det2_34_34 - mat[2][3] * det2_34_04 + mat[2][4] * det2_34_03;
1121 float det3_234_123 = mat[2][1] * det2_34_23 - mat[2][2] * det2_34_13 + mat[2][3] * det2_34_12;
1122 float det3_234_124 = mat[2][1] * det2_34_24 - mat[2][2] * det2_34_14 + mat[2][4] * det2_34_12;
1123 float det3_234_134 = mat[2][1] * det2_34_34 - mat[2][3] * det2_34_14 + mat[2][4] * det2_34_13;
1124 float det3_234_234 = mat[2][2] * det2_34_34 - mat[2][3] * det2_34_24 + mat[2][4] * det2_34_23;
1127 float det4_1234_0123 = mat[1][0] * det3_234_123 - mat[1][1] * det3_234_023 + mat[1][2] * det3_234_013 - mat[1][3] * det3_234_012;
1128 float det4_1234_0124 = mat[1][0] * det3_234_124 - mat[1][1] * det3_234_024 + mat[1][2] * det3_234_014 - mat[1][4] * det3_234_012;
1129 float det4_1234_0134 = mat[1][0] * det3_234_134 - mat[1][1] * det3_234_034 + mat[1][3] * det3_234_014 - mat[1][4] * det3_234_013;
1130 float det4_1234_0234 = mat[1][0] * det3_234_234 - mat[1][2] * det3_234_034 + mat[1][3] * det3_234_024 - mat[1][4] * det3_234_023;
1131 float det4_1234_1234 = mat[1][1] * det3_234_234 - mat[1][2] * det3_234_134 + mat[1][3] * det3_234_124 - mat[1][4] * det3_234_123;
1134 return mat[0][0] * det4_1234_1234 - mat[0][1] * det4_1234_0234 + mat[0][2] * det4_1234_0134 - mat[0][3] * det4_1234_0124 + mat[0][4] * det4_1234_0123;
1148 float det2_34_01 =
mat[3][0] *
mat[4][1] -
mat[3][1] *
mat[4][0];
1149 float det2_34_02 = mat[3][0] * mat[4][2] - mat[3][2] * mat[4][0];
1150 float det2_34_03 = mat[3][0] * mat[4][3] - mat[3][3] * mat[4][0];
1151 float det2_34_04 = mat[3][0] * mat[4][4] - mat[3][4] * mat[4][0];
1152 float det2_34_12 = mat[3][1] * mat[4][2] - mat[3][2] * mat[4][1];
1153 float det2_34_13 = mat[3][1] * mat[4][3] - mat[3][3] * mat[4][1];
1154 float det2_34_14 = mat[3][1] * mat[4][4] - mat[3][4] * mat[4][1];
1155 float det2_34_23 = mat[3][2] * mat[4][3] - mat[3][3] * mat[4][2];
1156 float det2_34_24 = mat[3][2] * mat[4][4] - mat[3][4] * mat[4][2];
1157 float det2_34_34 = mat[3][3] * mat[4][4] - mat[3][4] * mat[4][3];
1160 float det3_234_012 = mat[2][0] * det2_34_12 - mat[2][1] * det2_34_02 + mat[2][2] * det2_34_01;
1161 float det3_234_013 = mat[2][0] * det2_34_13 - mat[2][1] * det2_34_03 + mat[2][3] * det2_34_01;
1162 float det3_234_014 = mat[2][0] * det2_34_14 - mat[2][1] * det2_34_04 + mat[2][4] * det2_34_01;
1163 float det3_234_023 = mat[2][0] * det2_34_23 - mat[2][2] * det2_34_03 + mat[2][3] * det2_34_02;
1164 float det3_234_024 = mat[2][0] * det2_34_24 - mat[2][2] * det2_34_04 + mat[2][4] * det2_34_02;
1165 float det3_234_034 = mat[2][0] * det2_34_34 - mat[2][3] * det2_34_04 + mat[2][4] * det2_34_03;
1166 float det3_234_123 = mat[2][1] * det2_34_23 - mat[2][2] * det2_34_13 + mat[2][3] * det2_34_12;
1167 float det3_234_124 = mat[2][1] * det2_34_24 - mat[2][2] * det2_34_14 + mat[2][4] * det2_34_12;
1168 float det3_234_134 = mat[2][1] * det2_34_34 - mat[2][3] * det2_34_14 + mat[2][4] * det2_34_13;
1169 float det3_234_234 = mat[2][2] * det2_34_34 - mat[2][3] * det2_34_24 + mat[2][4] * det2_34_23;
1172 float det4_1234_0123 = mat[1][0] * det3_234_123 - mat[1][1] * det3_234_023 + mat[1][2] * det3_234_013 - mat[1][3] * det3_234_012;
1173 float det4_1234_0124 = mat[1][0] * det3_234_124 - mat[1][1] * det3_234_024 + mat[1][2] * det3_234_014 - mat[1][4] * det3_234_012;
1174 float det4_1234_0134 = mat[1][0] * det3_234_134 - mat[1][1] * det3_234_034 + mat[1][3] * det3_234_014 - mat[1][4] * det3_234_013;
1175 float det4_1234_0234 = mat[1][0] * det3_234_234 - mat[1][2] * det3_234_034 + mat[1][3] * det3_234_024 - mat[1][4] * det3_234_023;
1176 float det4_1234_1234 = mat[1][1] * det3_234_234 - mat[1][2] * det3_234_134 + mat[1][3] * det3_234_124 - mat[1][4] * det3_234_123;
1179 det = mat[0][0] * det4_1234_1234 - mat[0][1] * det4_1234_0234 + mat[0][2] * det4_1234_0134 - mat[0][3] * det4_1234_0124 + mat[0][4] * det4_1234_0123;
1185 invDet = 1.0f / det;
1188 float det2_23_01 = mat[2][0] * mat[3][1] - mat[2][1] * mat[3][0];
1189 float det2_23_02 = mat[2][0] * mat[3][2] - mat[2][2] * mat[3][0];
1190 float det2_23_03 = mat[2][0] * mat[3][3] - mat[2][3] * mat[3][0];
1191 float det2_23_04 = mat[2][0] * mat[3][4] - mat[2][4] * mat[3][0];
1192 float det2_23_12 = mat[2][1] * mat[3][2] - mat[2][2] * mat[3][1];
1193 float det2_23_13 = mat[2][1] * mat[3][3] - mat[2][3] * mat[3][1];
1194 float det2_23_14 = mat[2][1] * mat[3][4] - mat[2][4] * mat[3][1];
1195 float det2_23_23 = mat[2][2] * mat[3][3] - mat[2][3] * mat[3][2];
1196 float det2_23_24 = mat[2][2] * mat[3][4] - mat[2][4] * mat[3][2];
1197 float det2_23_34 = mat[2][3] * mat[3][4] - mat[2][4] * mat[3][3];
1198 float det2_24_01 = mat[2][0] * mat[4][1] - mat[2][1] * mat[4][0];
1199 float det2_24_02 = mat[2][0] * mat[4][2] - mat[2][2] * mat[4][0];
1200 float det2_24_03 = mat[2][0] * mat[4][3] - mat[2][3] * mat[4][0];
1201 float det2_24_04 = mat[2][0] * mat[4][4] - mat[2][4] * mat[4][0];
1202 float det2_24_12 = mat[2][1] * mat[4][2] - mat[2][2] * mat[4][1];
1203 float det2_24_13 = mat[2][1] * mat[4][3] - mat[2][3] * mat[4][1];
1204 float det2_24_14 = mat[2][1] * mat[4][4] - mat[2][4] * mat[4][1];
1205 float det2_24_23 = mat[2][2] * mat[4][3] - mat[2][3] * mat[4][2];
1206 float det2_24_24 = mat[2][2] * mat[4][4] - mat[2][4] * mat[4][2];
1207 float det2_24_34 = mat[2][3] * mat[4][4] - mat[2][4] * mat[4][3];
1210 float det3_123_012 = mat[1][0] * det2_23_12 - mat[1][1] * det2_23_02 + mat[1][2] * det2_23_01;
1211 float det3_123_013 = mat[1][0] * det2_23_13 - mat[1][1] * det2_23_03 + mat[1][3] * det2_23_01;
1212 float det3_123_014 = mat[1][0] * det2_23_14 - mat[1][1] * det2_23_04 + mat[1][4] * det2_23_01;
1213 float det3_123_023 = mat[1][0] * det2_23_23 - mat[1][2] * det2_23_03 + mat[1][3] * det2_23_02;
1214 float det3_123_024 = mat[1][0] * det2_23_24 - mat[1][2] * det2_23_04 + mat[1][4] * det2_23_02;
1215 float det3_123_034 = mat[1][0] * det2_23_34 - mat[1][3] * det2_23_04 + mat[1][4] * det2_23_03;
1216 float det3_123_123 = mat[1][1] * det2_23_23 - mat[1][2] * det2_23_13 + mat[1][3] * det2_23_12;
1217 float det3_123_124 = mat[1][1] * det2_23_24 - mat[1][2] * det2_23_14 + mat[1][4] * det2_23_12;
1218 float det3_123_134 = mat[1][1] * det2_23_34 - mat[1][3] * det2_23_14 + mat[1][4] * det2_23_13;
1219 float det3_123_234 = mat[1][2] * det2_23_34 - mat[1][3] * det2_23_24 + mat[1][4] * det2_23_23;
1220 float det3_124_012 = mat[1][0] * det2_24_12 - mat[1][1] * det2_24_02 + mat[1][2] * det2_24_01;
1221 float det3_124_013 = mat[1][0] * det2_24_13 - mat[1][1] * det2_24_03 + mat[1][3] * det2_24_01;
1222 float det3_124_014 = mat[1][0] * det2_24_14 - mat[1][1] * det2_24_04 + mat[1][4] * det2_24_01;
1223 float det3_124_023 = mat[1][0] * det2_24_23 - mat[1][2] * det2_24_03 + mat[1][3] * det2_24_02;
1224 float det3_124_024 = mat[1][0] * det2_24_24 - mat[1][2] * det2_24_04 + mat[1][4] * det2_24_02;
1225 float det3_124_034 = mat[1][0] * det2_24_34 - mat[1][3] * det2_24_04 + mat[1][4] * det2_24_03;
1226 float det3_124_123 = mat[1][1] * det2_24_23 - mat[1][2] * det2_24_13 + mat[1][3] * det2_24_12;
1227 float det3_124_124 = mat[1][1] * det2_24_24 - mat[1][2] * det2_24_14 + mat[1][4] * det2_24_12;
1228 float det3_124_134 = mat[1][1] * det2_24_34 - mat[1][3] * det2_24_14 + mat[1][4] * det2_24_13;
1229 float det3_124_234 = mat[1][2] * det2_24_34 - mat[1][3] * det2_24_24 + mat[1][4] * det2_24_23;
1230 float det3_134_012 = mat[1][0] * det2_34_12 - mat[1][1] * det2_34_02 + mat[1][2] * det2_34_01;
1231 float det3_134_013 = mat[1][0] * det2_34_13 - mat[1][1] * det2_34_03 + mat[1][3] * det2_34_01;
1232 float det3_134_014 = mat[1][0] * det2_34_14 - mat[1][1] * det2_34_04 + mat[1][4] * det2_34_01;
1233 float det3_134_023 = mat[1][0] * det2_34_23 - mat[1][2] * det2_34_03 + mat[1][3] * det2_34_02;
1234 float det3_134_024 = mat[1][0] * det2_34_24 - mat[1][2] * det2_34_04 + mat[1][4] * det2_34_02;
1235 float det3_134_034 = mat[1][0] * det2_34_34 - mat[1][3] * det2_34_04 + mat[1][4] * det2_34_03;
1236 float det3_134_123 = mat[1][1] * det2_34_23 - mat[1][2] * det2_34_13 + mat[1][3] * det2_34_12;
1237 float det3_134_124 = mat[1][1] * det2_34_24 - mat[1][2] * det2_34_14 + mat[1][4] * det2_34_12;
1238 float det3_134_134 = mat[1][1] * det2_34_34 - mat[1][3] * det2_34_14 + mat[1][4] * det2_34_13;
1239 float det3_134_234 = mat[1][2] * det2_34_34 - mat[1][3] * det2_34_24 + mat[1][4] * det2_34_23;
1242 float det4_0123_0123 = mat[0][0] * det3_123_123 - mat[0][1] * det3_123_023 + mat[0][2] * det3_123_013 - mat[0][3] * det3_123_012;
1243 float det4_0123_0124 = mat[0][0] * det3_123_124 - mat[0][1] * det3_123_024 + mat[0][2] * det3_123_014 - mat[0][4] * det3_123_012;
1244 float det4_0123_0134 = mat[0][0] * det3_123_134 - mat[0][1] * det3_123_034 + mat[0][3] * det3_123_014 - mat[0][4] * det3_123_013;
1245 float det4_0123_0234 = mat[0][0] * det3_123_234 - mat[0][2] * det3_123_034 + mat[0][3] * det3_123_024 - mat[0][4] * det3_123_023;
1246 float det4_0123_1234 = mat[0][1] * det3_123_234 - mat[0][2] * det3_123_134 + mat[0][3] * det3_123_124 - mat[0][4] * det3_123_123;
1247 float det4_0124_0123 = mat[0][0] * det3_124_123 - mat[0][1] * det3_124_023 + mat[0][2] * det3_124_013 - mat[0][3] * det3_124_012;
1248 float det4_0124_0124 = mat[0][0] * det3_124_124 - mat[0][1] * det3_124_024 + mat[0][2] * det3_124_014 - mat[0][4] * det3_124_012;
1249 float det4_0124_0134 = mat[0][0] * det3_124_134 - mat[0][1] * det3_124_034 + mat[0][3] * det3_124_014 - mat[0][4] * det3_124_013;
1250 float det4_0124_0234 = mat[0][0] * det3_124_234 - mat[0][2] * det3_124_034 + mat[0][3] * det3_124_024 - mat[0][4] * det3_124_023;
1251 float det4_0124_1234 = mat[0][1] * det3_124_234 - mat[0][2] * det3_124_134 + mat[0][3] * det3_124_124 - mat[0][4] * det3_124_123;
1252 float det4_0134_0123 = mat[0][0] * det3_134_123 - mat[0][1] * det3_134_023 + mat[0][2] * det3_134_013 - mat[0][3] * det3_134_012;
1253 float det4_0134_0124 = mat[0][0] * det3_134_124 - mat[0][1] * det3_134_024 + mat[0][2] * det3_134_014 - mat[0][4] * det3_134_012;
1254 float det4_0134_0134 = mat[0][0] * det3_134_134 - mat[0][1] * det3_134_034 + mat[0][3] * det3_134_014 - mat[0][4] * det3_134_013;
1255 float det4_0134_0234 = mat[0][0] * det3_134_234 - mat[0][2] * det3_134_034 + mat[0][3] * det3_134_024 - mat[0][4] * det3_134_023;
1256 float det4_0134_1234 = mat[0][1] * det3_134_234 - mat[0][2] * det3_134_134 + mat[0][3] * det3_134_124 - mat[0][4] * det3_134_123;
1257 float det4_0234_0123 = mat[0][0] * det3_234_123 - mat[0][1] * det3_234_023 + mat[0][2] * det3_234_013 - mat[0][3] * det3_234_012;
1258 float det4_0234_0124 = mat[0][0] * det3_234_124 - mat[0][1] * det3_234_024 + mat[0][2] * det3_234_014 - mat[0][4] * det3_234_012;
1259 float det4_0234_0134 = mat[0][0] * det3_234_134 - mat[0][1] * det3_234_034 + mat[0][3] * det3_234_014 - mat[0][4] * det3_234_013;
1260 float det4_0234_0234 = mat[0][0] * det3_234_234 - mat[0][2] * det3_234_034 + mat[0][3] * det3_234_024 - mat[0][4] * det3_234_023;
1261 float det4_0234_1234 = mat[0][1] * det3_234_234 - mat[0][2] * det3_234_134 + mat[0][3] * det3_234_124 - mat[0][4] * det3_234_123;
1263 mat[0][0] = det4_1234_1234 * invDet;
1264 mat[0][1] = -det4_0234_1234 * invDet;
1265 mat[0][2] = det4_0134_1234 * invDet;
1266 mat[0][3] = -det4_0124_1234 * invDet;
1267 mat[0][4] = det4_0123_1234 * invDet;
1269 mat[1][0] = -det4_1234_0234 * invDet;
1270 mat[1][1] = det4_0234_0234 * invDet;
1271 mat[1][2] = -det4_0134_0234 * invDet;
1272 mat[1][3] = det4_0124_0234 * invDet;
1273 mat[1][4] = -det4_0123_0234 * invDet;
1275 mat[2][0] = det4_1234_0134 * invDet;
1276 mat[2][1] = -det4_0234_0134 * invDet;
1277 mat[2][2] = det4_0134_0134 * invDet;
1278 mat[2][3] = -det4_0124_0134 * invDet;
1279 mat[2][4] = det4_0123_0134 * invDet;
1281 mat[3][0] = -det4_1234_0124 * invDet;
1282 mat[3][1] = det4_0234_0124 * invDet;
1283 mat[3][2] = -det4_0134_0124 * invDet;
1284 mat[3][3] = det4_0124_0124 * invDet;
1285 mat[3][4] = -det4_0123_0124 * invDet;
1287 mat[4][0] = det4_1234_0123 * invDet;
1288 mat[4][1] = -det4_0234_0123 * invDet;
1289 mat[4][2] = det4_0134_0123 * invDet;
1290 mat[4][3] = -det4_0124_0123 * invDet;
1291 mat[4][4] = det4_0123_0123 * invDet;
1308 float det2_34_01 =
mat[3][0] *
mat[4][1] -
mat[3][1] *
mat[4][0];
1309 float det2_34_02 = mat[3][0] * mat[4][2] - mat[3][2] * mat[4][0];
1310 float det2_34_03 = mat[3][0] * mat[4][3] - mat[3][3] * mat[4][0];
1311 float det2_34_04 = mat[3][0] * mat[4][4] - mat[3][4] * mat[4][0];
1312 float det2_34_12 = mat[3][1] * mat[4][2] - mat[3][2] * mat[4][1];
1313 float det2_34_13 = mat[3][1] * mat[4][3] - mat[3][3] * mat[4][1];
1314 float det2_34_14 = mat[3][1] * mat[4][4] - mat[3][4] * mat[4][1];
1315 float det2_34_23 = mat[3][2] * mat[4][3] - mat[3][3] * mat[4][2];
1316 float det2_34_24 = mat[3][2] * mat[4][4] - mat[3][4] * mat[4][2];
1317 float det2_34_34 = mat[3][3] * mat[4][4] - mat[3][4] * mat[4][3];
1320 float det3_234_012 = mat[2][0] * det2_34_12 - mat[2][1] * det2_34_02 + mat[2][2] * det2_34_01;
1321 float det3_234_013 = mat[2][0] * det2_34_13 - mat[2][1] * det2_34_03 + mat[2][3] * det2_34_01;
1322 float det3_234_014 = mat[2][0] * det2_34_14 - mat[2][1] * det2_34_04 + mat[2][4] * det2_34_01;
1323 float det3_234_023 = mat[2][0] * det2_34_23 - mat[2][2] * det2_34_03 + mat[2][3] * det2_34_02;
1324 float det3_234_024 = mat[2][0] * det2_34_24 - mat[2][2] * det2_34_04 + mat[2][4] * det2_34_02;
1325 float det3_234_034 = mat[2][0] * det2_34_34 - mat[2][3] * det2_34_04 + mat[2][4] * det2_34_03;
1326 float det3_234_123 = mat[2][1] * det2_34_23 - mat[2][2] * det2_34_13 + mat[2][3] * det2_34_12;
1327 float det3_234_124 = mat[2][1] * det2_34_24 - mat[2][2] * det2_34_14 + mat[2][4] * det2_34_12;
1328 float det3_234_134 = mat[2][1] * det2_34_34 - mat[2][3] * det2_34_14 + mat[2][4] * det2_34_13;
1329 float det3_234_234 = mat[2][2] * det2_34_34 - mat[2][3] * det2_34_24 + mat[2][4] * det2_34_23;
1332 float det4_1234_0123 = mat[1][0] * det3_234_123 - mat[1][1] * det3_234_023 + mat[1][2] * det3_234_013 - mat[1][3] * det3_234_012;
1333 float det4_1234_0124 = mat[1][0] * det3_234_124 - mat[1][1] * det3_234_024 + mat[1][2] * det3_234_014 - mat[1][4] * det3_234_012;
1334 float det4_1234_0134 = mat[1][0] * det3_234_134 - mat[1][1] * det3_234_034 + mat[1][3] * det3_234_014 - mat[1][4] * det3_234_013;
1335 float det4_1234_0234 = mat[1][0] * det3_234_234 - mat[1][2] * det3_234_034 + mat[1][3] * det3_234_024 - mat[1][4] * det3_234_023;
1336 float det4_1234_1234 = mat[1][1] * det3_234_234 - mat[1][2] * det3_234_134 + mat[1][3] * det3_234_124 - mat[1][4] * det3_234_123;
1339 det = mat[0][0] * det4_1234_1234 - mat[0][1] * det4_1234_0234 + mat[0][2] * det4_1234_0134 - mat[0][3] * det4_1234_0124 + mat[0][4] * det4_1234_0123;
1345 invDet = 1.0f / det;
1348 float det2_23_01 = mat[2][0] * mat[3][1] - mat[2][1] * mat[3][0];
1349 float det2_23_02 = mat[2][0] * mat[3][2] - mat[2][2] * mat[3][0];
1350 float det2_23_03 = mat[2][0] * mat[3][3] - mat[2][3] * mat[3][0];
1351 float det2_23_04 = mat[2][0] * mat[3][4] - mat[2][4] * mat[3][0];
1352 float det2_23_12 = mat[2][1] * mat[3][2] - mat[2][2] * mat[3][1];
1353 float det2_23_13 = mat[2][1] * mat[3][3] - mat[2][3] * mat[3][1];
1354 float det2_23_14 = mat[2][1] * mat[3][4] - mat[2][4] * mat[3][1];
1355 float det2_23_23 = mat[2][2] * mat[3][3] - mat[2][3] * mat[3][2];
1356 float det2_23_24 = mat[2][2] * mat[3][4] - mat[2][4] * mat[3][2];
1357 float det2_23_34 = mat[2][3] * mat[3][4] - mat[2][4] * mat[3][3];
1358 float det2_24_01 = mat[2][0] * mat[4][1] - mat[2][1] * mat[4][0];
1359 float det2_24_02 = mat[2][0] * mat[4][2] - mat[2][2] * mat[4][0];
1360 float det2_24_03 = mat[2][0] * mat[4][3] - mat[2][3] * mat[4][0];
1361 float det2_24_04 = mat[2][0] * mat[4][4] - mat[2][4] * mat[4][0];
1362 float det2_24_12 = mat[2][1] * mat[4][2] - mat[2][2] * mat[4][1];
1363 float det2_24_13 = mat[2][1] * mat[4][3] - mat[2][3] * mat[4][1];
1364 float det2_24_14 = mat[2][1] * mat[4][4] - mat[2][4] * mat[4][1];
1365 float det2_24_23 = mat[2][2] * mat[4][3] - mat[2][3] * mat[4][2];
1366 float det2_24_24 = mat[2][2] * mat[4][4] - mat[2][4] * mat[4][2];
1367 float det2_24_34 = mat[2][3] * mat[4][4] - mat[2][4] * mat[4][3];
1370 float det3_123_012 = mat[1][0] * det2_23_12 - mat[1][1] * det2_23_02 + mat[1][2] * det2_23_01;
1371 float det3_123_013 = mat[1][0] * det2_23_13 - mat[1][1] * det2_23_03 + mat[1][3] * det2_23_01;
1372 float det3_123_014 = mat[1][0] * det2_23_14 - mat[1][1] * det2_23_04 + mat[1][4] * det2_23_01;
1373 float det3_123_023 = mat[1][0] * det2_23_23 - mat[1][2] * det2_23_03 + mat[1][3] * det2_23_02;
1374 float det3_123_024 = mat[1][0] * det2_23_24 - mat[1][2] * det2_23_04 + mat[1][4] * det2_23_02;
1375 float det3_123_034 = mat[1][0] * det2_23_34 - mat[1][3] * det2_23_04 + mat[1][4] * det2_23_03;
1376 float det3_123_123 = mat[1][1] * det2_23_23 - mat[1][2] * det2_23_13 + mat[1][3] * det2_23_12;
1377 float det3_123_124 = mat[1][1] * det2_23_24 - mat[1][2] * det2_23_14 + mat[1][4] * det2_23_12;
1378 float det3_123_134 = mat[1][1] * det2_23_34 - mat[1][3] * det2_23_14 + mat[1][4] * det2_23_13;
1379 float det3_123_234 = mat[1][2] * det2_23_34 - mat[1][3] * det2_23_24 + mat[1][4] * det2_23_23;
1380 float det3_124_012 = mat[1][0] * det2_24_12 - mat[1][1] * det2_24_02 + mat[1][2] * det2_24_01;
1381 float det3_124_013 = mat[1][0] * det2_24_13 - mat[1][1] * det2_24_03 + mat[1][3] * det2_24_01;
1382 float det3_124_014 = mat[1][0] * det2_24_14 - mat[1][1] * det2_24_04 + mat[1][4] * det2_24_01;
1383 float det3_124_023 = mat[1][0] * det2_24_23 - mat[1][2] * det2_24_03 + mat[1][3] * det2_24_02;
1384 float det3_124_024 = mat[1][0] * det2_24_24 - mat[1][2] * det2_24_04 + mat[1][4] * det2_24_02;
1385 float det3_124_034 = mat[1][0] * det2_24_34 - mat[1][3] * det2_24_04 + mat[1][4] * det2_24_03;
1386 float det3_124_123 = mat[1][1] * det2_24_23 - mat[1][2] * det2_24_13 + mat[1][3] * det2_24_12;
1387 float det3_124_124 = mat[1][1] * det2_24_24 - mat[1][2] * det2_24_14 + mat[1][4] * det2_24_12;
1388 float det3_124_134 = mat[1][1] * det2_24_34 - mat[1][3] * det2_24_14 + mat[1][4] * det2_24_13;
1389 float det3_124_234 = mat[1][2] * det2_24_34 - mat[1][3] * det2_24_24 + mat[1][4] * det2_24_23;
1390 float det3_134_012 = mat[1][0] * det2_34_12 - mat[1][1] * det2_34_02 + mat[1][2] * det2_34_01;
1391 float det3_134_013 = mat[1][0] * det2_34_13 - mat[1][1] * det2_34_03 + mat[1][3] * det2_34_01;
1392 float det3_134_014 = mat[1][0] * det2_34_14 - mat[1][1] * det2_34_04 + mat[1][4] * det2_34_01;
1393 float det3_134_023 = mat[1][0] * det2_34_23 - mat[1][2] * det2_34_03 + mat[1][3] * det2_34_02;
1394 float det3_134_024 = mat[1][0] * det2_34_24 - mat[1][2] * det2_34_04 + mat[1][4] * det2_34_02;
1395 float det3_134_034 = mat[1][0] * det2_34_34 - mat[1][3] * det2_34_04 + mat[1][4] * det2_34_03;
1396 float det3_134_123 = mat[1][1] * det2_34_23 - mat[1][2] * det2_34_13 + mat[1][3] * det2_34_12;
1397 float det3_134_124 = mat[1][1] * det2_34_24 - mat[1][2] * det2_34_14 + mat[1][4] * det2_34_12;
1398 float det3_134_134 = mat[1][1] * det2_34_34 - mat[1][3] * det2_34_14 + mat[1][4] * det2_34_13;
1399 float det3_134_234 = mat[1][2] * det2_34_34 - mat[1][3] * det2_34_24 + mat[1][4] * det2_34_23;
1402 float det4_0123_0123 = mat[0][0] * det3_123_123 - mat[0][1] * det3_123_023 + mat[0][2] * det3_123_013 - mat[0][3] * det3_123_012;
1403 float det4_0123_0124 = mat[0][0] * det3_123_124 - mat[0][1] * det3_123_024 + mat[0][2] * det3_123_014 - mat[0][4] * det3_123_012;
1404 float det4_0123_0134 = mat[0][0] * det3_123_134 - mat[0][1] * det3_123_034 + mat[0][3] * det3_123_014 - mat[0][4] * det3_123_013;
1405 float det4_0123_0234 = mat[0][0] * det3_123_234 - mat[0][2] * det3_123_034 + mat[0][3] * det3_123_024 - mat[0][4] * det3_123_023;
1406 float det4_0123_1234 = mat[0][1] * det3_123_234 - mat[0][2] * det3_123_134 + mat[0][3] * det3_123_124 - mat[0][4] * det3_123_123;
1407 float det4_0124_0123 = mat[0][0] * det3_124_123 - mat[0][1] * det3_124_023 + mat[0][2] * det3_124_013 - mat[0][3] * det3_124_012;
1408 float det4_0124_0124 = mat[0][0] * det3_124_124 - mat[0][1] * det3_124_024 + mat[0][2] * det3_124_014 - mat[0][4] * det3_124_012;
1409 float det4_0124_0134 = mat[0][0] * det3_124_134 - mat[0][1] * det3_124_034 + mat[0][3] * det3_124_014 - mat[0][4] * det3_124_013;
1410 float det4_0124_0234 = mat[0][0] * det3_124_234 - mat[0][2] * det3_124_034 + mat[0][3] * det3_124_024 - mat[0][4] * det3_124_023;
1411 float det4_0124_1234 = mat[0][1] * det3_124_234 - mat[0][2] * det3_124_134 + mat[0][3] * det3_124_124 - mat[0][4] * det3_124_123;
1412 float det4_0134_0123 = mat[0][0] * det3_134_123 - mat[0][1] * det3_134_023 + mat[0][2] * det3_134_013 - mat[0][3] * det3_134_012;
1413 float det4_0134_0124 = mat[0][0] * det3_134_124 - mat[0][1] * det3_134_024 + mat[0][2] * det3_134_014 - mat[0][4] * det3_134_012;
1414 float det4_0134_0134 = mat[0][0] * det3_134_134 - mat[0][1] * det3_134_034 + mat[0][3] * det3_134_014 - mat[0][4] * det3_134_013;
1415 float det4_0134_0234 = mat[0][0] * det3_134_234 - mat[0][2] * det3_134_034 + mat[0][3] * det3_134_024 - mat[0][4] * det3_134_023;
1416 float det4_0134_1234 = mat[0][1] * det3_134_234 - mat[0][2] * det3_134_134 + mat[0][3] * det3_134_124 - mat[0][4] * det3_134_123;
1417 float det4_0234_0123 = mat[0][0] * det3_234_123 - mat[0][1] * det3_234_023 + mat[0][2] * det3_234_013 - mat[0][3] * det3_234_012;
1418 float det4_0234_0124 = mat[0][0] * det3_234_124 - mat[0][1] * det3_234_024 + mat[0][2] * det3_234_014 - mat[0][4] * det3_234_012;
1419 float det4_0234_0134 = mat[0][0] * det3_234_134 - mat[0][1] * det3_234_034 + mat[0][3] * det3_234_014 - mat[0][4] * det3_234_013;
1420 float det4_0234_0234 = mat[0][0] * det3_234_234 - mat[0][2] * det3_234_034 + mat[0][3] * det3_234_024 - mat[0][4] * det3_234_023;
1421 float det4_0234_1234 = mat[0][1] * det3_234_234 - mat[0][2] * det3_234_134 + mat[0][3] * det3_234_124 - mat[0][4] * det3_234_123;
1423 mat[0][0] = det4_1234_1234 * invDet;
1424 mat[0][1] = -det4_0234_1234 * invDet;
1425 mat[0][2] = det4_0134_1234 * invDet;
1426 mat[0][3] = -det4_0124_1234 * invDet;
1427 mat[0][4] = det4_0123_1234 * invDet;
1429 mat[1][0] = -det4_1234_0234 * invDet;
1430 mat[1][1] = det4_0234_0234 * invDet;
1431 mat[1][2] = -det4_0134_0234 * invDet;
1432 mat[1][3] = det4_0124_0234 * invDet;
1433 mat[1][4] = -det4_0123_0234 * invDet;
1435 mat[2][0] = det4_1234_0134 * invDet;
1436 mat[2][1] = -det4_0234_0134 * invDet;
1437 mat[2][2] = det4_0134_0134 * invDet;
1438 mat[2][3] = -det4_0124_0134 * invDet;
1439 mat[2][4] = det4_0123_0134 * invDet;
1441 mat[3][0] = -det4_1234_0124 * invDet;
1442 mat[3][1] = det4_0234_0124 * invDet;
1443 mat[3][2] = -det4_0134_0124 * invDet;
1444 mat[3][3] = det4_0124_0124 * invDet;
1445 mat[3][4] = -det4_0123_0124 * invDet;
1447 mat[4][0] = det4_1234_0123 * invDet;
1448 mat[4][1] = -det4_0234_0123 * invDet;
1449 mat[4][2] = det4_0134_0123 * invDet;
1450 mat[4][3] = -det4_0124_0123 * invDet;
1451 mat[4][4] = det4_0123_0123 * invDet;
1457 float *mat =
reinterpret_cast<float *
>(
this);
1463 mat[0] = d = 1.0f / di;
1474 mat[6] += mat[1] * d;
1475 mat[7] += mat[2] * d;
1476 mat[8] += mat[3] * d;
1477 mat[9] += mat[4] * d;
1479 mat[11] += mat[1] * d;
1480 mat[12] += mat[2] * d;
1481 mat[13] += mat[3] * d;
1482 mat[14] += mat[4] * d;
1484 mat[16] += mat[1] * d;
1485 mat[17] += mat[2] * d;
1486 mat[18] += mat[3] * d;
1487 mat[19] += mat[4] * d;
1489 mat[21] += mat[1] * d;
1490 mat[22] += mat[2] * d;
1491 mat[23] += mat[3] * d;
1492 mat[24] += mat[4] * d;
1495 mat[6] = d = 1.0f / di;
1506 mat[0] += mat[5] * d;
1507 mat[2] += mat[7] * d;
1508 mat[3] += mat[8] * d;
1509 mat[4] += mat[9] * d;
1511 mat[10] += mat[5] * d;
1512 mat[12] += mat[7] * d;
1513 mat[13] += mat[8] * d;
1514 mat[14] += mat[9] * d;
1516 mat[15] += mat[5] * d;
1517 mat[17] += mat[7] * d;
1518 mat[18] += mat[8] * d;
1519 mat[19] += mat[9] * d;
1521 mat[20] += mat[5] * d;
1522 mat[22] += mat[7] * d;
1523 mat[23] += mat[8] * d;
1524 mat[24] += mat[9] * d;
1527 mat[12] = d = 1.0f / di;
1538 mat[0] += mat[10] * d;
1539 mat[1] += mat[11] * d;
1540 mat[3] += mat[13] * d;
1541 mat[4] += mat[14] * d;
1543 mat[5] += mat[10] * d;
1544 mat[6] += mat[11] * d;
1545 mat[8] += mat[13] * d;
1546 mat[9] += mat[14] * d;
1548 mat[15] += mat[10] * d;
1549 mat[16] += mat[11] * d;
1550 mat[18] += mat[13] * d;
1551 mat[19] += mat[14] * d;
1553 mat[20] += mat[10] * d;
1554 mat[21] += mat[11] * d;
1555 mat[23] += mat[13] * d;
1556 mat[24] += mat[14] * d;
1559 mat[18] = d = 1.0f / di;
1570 mat[0] += mat[15] * d;
1571 mat[1] += mat[16] * d;
1572 mat[2] += mat[17] * d;
1573 mat[4] += mat[19] * d;
1575 mat[5] += mat[15] * d;
1576 mat[6] += mat[16] * d;
1577 mat[7] += mat[17] * d;
1578 mat[9] += mat[19] * d;
1580 mat[10] += mat[15] * d;
1581 mat[11] += mat[16] * d;
1582 mat[12] += mat[17] * d;
1583 mat[14] += mat[19] * d;
1585 mat[20] += mat[15] * d;
1586 mat[21] += mat[16] * d;
1587 mat[22] += mat[17] * d;
1588 mat[24] += mat[19] * d;
1591 mat[24] = d = 1.0f / di;
1602 mat[0] += mat[20] * d;
1603 mat[1] += mat[21] * d;
1604 mat[2] += mat[22] * d;
1605 mat[3] += mat[23] * d;
1607 mat[5] += mat[20] * d;
1608 mat[6] += mat[21] * d;
1609 mat[7] += mat[22] * d;
1610 mat[8] += mat[23] * d;
1612 mat[10] += mat[20] * d;
1613 mat[11] += mat[21] * d;
1614 mat[12] += mat[22] * d;
1615 mat[13] += mat[23] * d;
1617 mat[15] += mat[20] * d;
1618 mat[16] += mat[21] * d;
1619 mat[17] += mat[22] * d;
1620 mat[18] += mat[23] * d;
1627 float c0, c1, c2, det, invDet;
1628 float *mat =
reinterpret_cast<float *
>(
this);
1631 c0 = mat[1*5+1] * mat[2*5+2] - mat[1*5+2] * mat[2*5+1];
1632 c1 = mat[1*5+2] * mat[2*5+0] - mat[1*5+0] * mat[2*5+2];
1633 c2 = mat[1*5+0] * mat[2*5+1] - mat[1*5+1] * mat[2*5+0];
1635 det = mat[0*5+0] * c0 + mat[0*5+1] * c1 + mat[0*5+2] * c2;
1641 invDet = 1.0f / det;
1643 r0[0][0] = c0 * invDet;
1644 r0[0][1] = ( mat[0*5+2] * mat[2*5+1] - mat[0*5+1] * mat[2*5+2] ) * invDet;
1645 r0[0][2] = ( mat[0*5+1] * mat[1*5+2] - mat[0*5+2] * mat[1*5+1] ) * invDet;
1646 r0[1][0] = c1 * invDet;
1647 r0[1][1] = ( mat[0*5+0] * mat[2*5+2] - mat[0*5+2] * mat[2*5+0] ) * invDet;
1648 r0[1][2] = ( mat[0*5+2] * mat[1*5+0] - mat[0*5+0] * mat[1*5+2] ) * invDet;
1649 r0[2][0] = c2 * invDet;
1650 r0[2][1] = ( mat[0*5+1] * mat[2*5+0] - mat[0*5+0] * mat[2*5+1] ) * invDet;
1651 r0[2][2] = ( mat[0*5+0] * mat[1*5+1] - mat[0*5+1] * mat[1*5+0] ) * invDet;
1654 r1[0][0] = r0[0][0] * mat[0*5+3] + r0[0][1] * mat[1*5+3] + r0[0][2] * mat[2*5+3];
1655 r1[0][1] = r0[0][0] * mat[0*5+4] + r0[0][1] * mat[1*5+4] + r0[0][2] * mat[2*5+4];
1656 r1[1][0] = r0[1][0] * mat[0*5+3] + r0[1][1] * mat[1*5+3] + r0[1][2] * mat[2*5+3];
1657 r1[1][1] = r0[1][0] * mat[0*5+4] + r0[1][1] * mat[1*5+4] + r0[1][2] * mat[2*5+4];
1658 r1[2][0] = r0[2][0] * mat[0*5+3] + r0[2][1] * mat[1*5+3] + r0[2][2] * mat[2*5+3];
1659 r1[2][1] = r0[2][0] * mat[0*5+4] + r0[2][1] * mat[1*5+4] + r0[2][2] * mat[2*5+4];
1662 r2[0][0] = mat[3*5+0] * r1[0][0] + mat[3*5+1] * r1[1][0] + mat[3*5+2] * r1[2][0];
1663 r2[0][1] = mat[3*5+0] * r1[0][1] + mat[3*5+1] * r1[1][1] + mat[3*5+2] * r1[2][1];
1664 r2[1][0] = mat[4*5+0] * r1[0][0] + mat[4*5+1] * r1[1][0] + mat[4*5+2] * r1[2][0];
1665 r2[1][1] = mat[4*5+0] * r1[0][1] + mat[4*5+1] * r1[1][1] + mat[4*5+2] * r1[2][1];
1668 r3[0][0] = r2[0][0] - mat[3*5+3];
1669 r3[0][1] = r2[0][1] - mat[3*5+4];
1670 r3[1][0] = r2[1][0] - mat[4*5+3];
1671 r3[1][1] = r2[1][1] - mat[4*5+4];
1674 det = r3[0][0] * r3[1][1] - r3[0][1] * r3[1][0];
1680 invDet = 1.0f / det;
1683 r3[0][0] = r3[1][1] * invDet;
1684 r3[0][1] = - r3[0][1] * invDet;
1685 r3[1][0] = - r3[1][0] * invDet;
1686 r3[1][1] = c0 * invDet;
1689 r2[0][0] = mat[3*5+0] * r0[0][0] + mat[3*5+1] * r0[1][0] + mat[3*5+2] * r0[2][0];
1690 r2[0][1] = mat[3*5+0] * r0[0][1] + mat[3*5+1] * r0[1][1] + mat[3*5+2] * r0[2][1];
1691 r2[0][2] = mat[3*5+0] * r0[0][2] + mat[3*5+1] * r0[1][2] + mat[3*5+2] * r0[2][2];
1692 r2[1][0] = mat[4*5+0] * r0[0][0] + mat[4*5+1] * r0[1][0] + mat[4*5+2] * r0[2][0];
1693 r2[1][1] = mat[4*5+0] * r0[0][1] + mat[4*5+1] * r0[1][1] + mat[4*5+2] * r0[2][1];
1694 r2[1][2] = mat[4*5+0] * r0[0][2] + mat[4*5+1] * r0[1][2] + mat[4*5+2] * r0[2][2];
1697 mat[3*5+0] = r3[0][0] * r2[0][0] + r3[0][1] * r2[1][0];
1698 mat[3*5+1] = r3[0][0] * r2[0][1] + r3[0][1] * r2[1][1];
1699 mat[3*5+2] = r3[0][0] * r2[0][2] + r3[0][1] * r2[1][2];
1700 mat[4*5+0] = r3[1][0] * r2[0][0] + r3[1][1] * r2[1][0];
1701 mat[4*5+1] = r3[1][0] * r2[0][1] + r3[1][1] * r2[1][1];
1702 mat[4*5+2] = r3[1][0] * r2[0][2] + r3[1][1] * r2[1][2];
1705 mat[0*5+0] = r0[0][0] - r1[0][0] * mat[3*5+0] - r1[0][1] * mat[4*5+0];
1706 mat[0*5+1] = r0[0][1] - r1[0][0] * mat[3*5+1] - r1[0][1] * mat[4*5+1];
1707 mat[0*5+2] = r0[0][2] - r1[0][0] * mat[3*5+2] - r1[0][1] * mat[4*5+2];
1708 mat[1*5+0] = r0[1][0] - r1[1][0] * mat[3*5+0] - r1[1][1] * mat[4*5+0];
1709 mat[1*5+1] = r0[1][1] - r1[1][0] * mat[3*5+1] - r1[1][1] * mat[4*5+1];
1710 mat[1*5+2] = r0[1][2] - r1[1][0] * mat[3*5+2] - r1[1][1] * mat[4*5+2];
1711 mat[2*5+0] = r0[2][0] - r1[2][0] * mat[3*5+0] - r1[2][1] * mat[4*5+0];
1712 mat[2*5+1] = r0[2][1] - r1[2][0] * mat[3*5+1] - r1[2][1] * mat[4*5+1];
1713 mat[2*5+2] = r0[2][2] - r1[2][0] * mat[3*5+2] - r1[2][1] * mat[4*5+2];
1716 mat[0*5+3] = r1[0][0] * r3[0][0] + r1[0][1] * r3[1][0];
1717 mat[0*5+4] = r1[0][0] * r3[0][1] + r1[0][1] * r3[1][1];
1718 mat[1*5+3] = r1[1][0] * r3[0][0] + r1[1][1] * r3[1][0];
1719 mat[1*5+4] = r1[1][0] * r3[0][1] + r1[1][1] * r3[1][1];
1720 mat[2*5+3] = r1[2][0] * r3[0][0] + r1[2][1] * r3[1][0];
1721 mat[2*5+4] = r1[2][0] * r3[0][1] + r1[2][1] * r3[1][1];
1724 mat[3*5+3] = -r3[0][0];
1725 mat[3*5+4] = -r3[0][1];
1726 mat[4*5+3] = -r3[1][0];
1727 mat[4*5+4] = -r3[1][1];
1749 idMat6 mat6_zero(
idVec6( 0, 0, 0, 0, 0, 0 ),
idVec6( 0, 0, 0, 0, 0, 0 ),
idVec6( 0, 0, 0, 0, 0, 0 ),
idVec6( 0, 0, 0, 0, 0, 0 ),
idVec6( 0, 0, 0, 0, 0, 0 ),
idVec6( 0, 0, 0, 0, 0, 0 ) );
1750 idMat6 mat6_identity(
idVec6( 1, 0, 0, 0, 0, 0 ),
idVec6( 0, 1, 0, 0, 0, 0 ),
idVec6( 0, 0, 1, 0, 0, 0 ),
idVec6( 0, 0, 0, 1, 0, 0 ),
idVec6( 0, 0, 0, 0, 1, 0 ),
idVec6( 0, 0, 0, 0, 0, 1 ) );
1761 for( i = 0; i < 6; i++ ) {
1762 for( j = 0; j < 6; j++ ) {
1763 transpose[
i ][
j ] =
mat[
j ][
i ];
1778 for( i = 0; i < 6; i++ ) {
1779 for( j = i + 1; j < 6; j++ ) {
1780 temp =
mat[
i ][
j ];
1782 mat[
j ][
i ] = temp;
1796 float det2_45_01 =
mat[4][0] *
mat[5][1] -
mat[4][1] *
mat[5][0];
1797 float det2_45_02 = mat[4][0] * mat[5][2] - mat[4][2] * mat[5][0];
1798 float det2_45_03 = mat[4][0] * mat[5][3] - mat[4][3] * mat[5][0];
1799 float det2_45_04 = mat[4][0] * mat[5][4] - mat[4][4] * mat[5][0];
1800 float det2_45_05 = mat[4][0] * mat[5][5] - mat[4][5] * mat[5][0];
1801 float det2_45_12 = mat[4][1] * mat[5][2] - mat[4][2] * mat[5][1];
1802 float det2_45_13 = mat[4][1] * mat[5][3] - mat[4][3] * mat[5][1];
1803 float det2_45_14 = mat[4][1] * mat[5][4] - mat[4][4] * mat[5][1];
1804 float det2_45_15 = mat[4][1] * mat[5][5] - mat[4][5] * mat[5][1];
1805 float det2_45_23 = mat[4][2] * mat[5][3] - mat[4][3] * mat[5][2];
1806 float det2_45_24 = mat[4][2] * mat[5][4] - mat[4][4] * mat[5][2];
1807 float det2_45_25 = mat[4][2] * mat[5][5] - mat[4][5] * mat[5][2];
1808 float det2_45_34 = mat[4][3] * mat[5][4] - mat[4][4] * mat[5][3];
1809 float det2_45_35 = mat[4][3] * mat[5][5] - mat[4][5] * mat[5][3];
1810 float det2_45_45 = mat[4][4] * mat[5][5] - mat[4][5] * mat[5][4];
1813 float det3_345_012 = mat[3][0] * det2_45_12 - mat[3][1] * det2_45_02 + mat[3][2] * det2_45_01;
1814 float det3_345_013 = mat[3][0] * det2_45_13 - mat[3][1] * det2_45_03 + mat[3][3] * det2_45_01;
1815 float det3_345_014 = mat[3][0] * det2_45_14 - mat[3][1] * det2_45_04 + mat[3][4] * det2_45_01;
1816 float det3_345_015 = mat[3][0] * det2_45_15 - mat[3][1] * det2_45_05 + mat[3][5] * det2_45_01;
1817 float det3_345_023 = mat[3][0] * det2_45_23 - mat[3][2] * det2_45_03 + mat[3][3] * det2_45_02;
1818 float det3_345_024 = mat[3][0] * det2_45_24 - mat[3][2] * det2_45_04 + mat[3][4] * det2_45_02;
1819 float det3_345_025 = mat[3][0] * det2_45_25 - mat[3][2] * det2_45_05 + mat[3][5] * det2_45_02;
1820 float det3_345_034 = mat[3][0] * det2_45_34 - mat[3][3] * det2_45_04 + mat[3][4] * det2_45_03;
1821 float det3_345_035 = mat[3][0] * det2_45_35 - mat[3][3] * det2_45_05 + mat[3][5] * det2_45_03;
1822 float det3_345_045 = mat[3][0] * det2_45_45 - mat[3][4] * det2_45_05 + mat[3][5] * det2_45_04;
1823 float det3_345_123 = mat[3][1] * det2_45_23 - mat[3][2] * det2_45_13 + mat[3][3] * det2_45_12;
1824 float det3_345_124 = mat[3][1] * det2_45_24 - mat[3][2] * det2_45_14 + mat[3][4] * det2_45_12;
1825 float det3_345_125 = mat[3][1] * det2_45_25 - mat[3][2] * det2_45_15 + mat[3][5] * det2_45_12;
1826 float det3_345_134 = mat[3][1] * det2_45_34 - mat[3][3] * det2_45_14 + mat[3][4] * det2_45_13;
1827 float det3_345_135 = mat[3][1] * det2_45_35 - mat[3][3] * det2_45_15 + mat[3][5] * det2_45_13;
1828 float det3_345_145 = mat[3][1] * det2_45_45 - mat[3][4] * det2_45_15 + mat[3][5] * det2_45_14;
1829 float det3_345_234 = mat[3][2] * det2_45_34 - mat[3][3] * det2_45_24 + mat[3][4] * det2_45_23;
1830 float det3_345_235 = mat[3][2] * det2_45_35 - mat[3][3] * det2_45_25 + mat[3][5] * det2_45_23;
1831 float det3_345_245 = mat[3][2] * det2_45_45 - mat[3][4] * det2_45_25 + mat[3][5] * det2_45_24;
1832 float det3_345_345 = mat[3][3] * det2_45_45 - mat[3][4] * det2_45_35 + mat[3][5] * det2_45_34;
1835 float det4_2345_0123 = mat[2][0] * det3_345_123 - mat[2][1] * det3_345_023 + mat[2][2] * det3_345_013 - mat[2][3] * det3_345_012;
1836 float det4_2345_0124 = mat[2][0] * det3_345_124 - mat[2][1] * det3_345_024 + mat[2][2] * det3_345_014 - mat[2][4] * det3_345_012;
1837 float det4_2345_0125 = mat[2][0] * det3_345_125 - mat[2][1] * det3_345_025 + mat[2][2] * det3_345_015 - mat[2][5] * det3_345_012;
1838 float det4_2345_0134 = mat[2][0] * det3_345_134 - mat[2][1] * det3_345_034 + mat[2][3] * det3_345_014 - mat[2][4] * det3_345_013;
1839 float det4_2345_0135 = mat[2][0] * det3_345_135 - mat[2][1] * det3_345_035 + mat[2][3] * det3_345_015 - mat[2][5] * det3_345_013;
1840 float det4_2345_0145 = mat[2][0] * det3_345_145 - mat[2][1] * det3_345_045 + mat[2][4] * det3_345_015 - mat[2][5] * det3_345_014;
1841 float det4_2345_0234 = mat[2][0] * det3_345_234 - mat[2][2] * det3_345_034 + mat[2][3] * det3_345_024 - mat[2][4] * det3_345_023;
1842 float det4_2345_0235 = mat[2][0] * det3_345_235 - mat[2][2] * det3_345_035 + mat[2][3] * det3_345_025 - mat[2][5] * det3_345_023;
1843 float det4_2345_0245 = mat[2][0] * det3_345_245 - mat[2][2] * det3_345_045 + mat[2][4] * det3_345_025 - mat[2][5] * det3_345_024;
1844 float det4_2345_0345 = mat[2][0] * det3_345_345 - mat[2][3] * det3_345_045 + mat[2][4] * det3_345_035 - mat[2][5] * det3_345_034;
1845 float det4_2345_1234 = mat[2][1] * det3_345_234 - mat[2][2] * det3_345_134 + mat[2][3] * det3_345_124 - mat[2][4] * det3_345_123;
1846 float det4_2345_1235 = mat[2][1] * det3_345_235 - mat[2][2] * det3_345_135 + mat[2][3] * det3_345_125 - mat[2][5] * det3_345_123;
1847 float det4_2345_1245 = mat[2][1] * det3_345_245 - mat[2][2] * det3_345_145 + mat[2][4] * det3_345_125 - mat[2][5] * det3_345_124;
1848 float det4_2345_1345 = mat[2][1] * det3_345_345 - mat[2][3] * det3_345_145 + mat[2][4] * det3_345_135 - mat[2][5] * det3_345_134;
1849 float det4_2345_2345 = mat[2][2] * det3_345_345 - mat[2][3] * det3_345_245 + mat[2][4] * det3_345_235 - mat[2][5] * det3_345_234;
1852 float det5_12345_01234 = mat[1][0] * det4_2345_1234 - mat[1][1] * det4_2345_0234 + mat[1][2] * det4_2345_0134 - mat[1][3] * det4_2345_0124 + mat[1][4] * det4_2345_0123;
1853 float det5_12345_01235 = mat[1][0] * det4_2345_1235 - mat[1][1] * det4_2345_0235 + mat[1][2] * det4_2345_0135 - mat[1][3] * det4_2345_0125 + mat[1][5] * det4_2345_0123;
1854 float det5_12345_01245 = mat[1][0] * det4_2345_1245 - mat[1][1] * det4_2345_0245 + mat[1][2] * det4_2345_0145 - mat[1][4] * det4_2345_0125 + mat[1][5] * det4_2345_0124;
1855 float det5_12345_01345 = mat[1][0] * det4_2345_1345 - mat[1][1] * det4_2345_0345 + mat[1][3] * det4_2345_0145 - mat[1][4] * det4_2345_0135 + mat[1][5] * det4_2345_0134;
1856 float det5_12345_02345 = mat[1][0] * det4_2345_2345 - mat[1][2] * det4_2345_0345 + mat[1][3] * det4_2345_0245 - mat[1][4] * det4_2345_0235 + mat[1][5] * det4_2345_0234;
1857 float det5_12345_12345 = mat[1][1] * det4_2345_2345 - mat[1][2] * det4_2345_1345 + mat[1][3] * det4_2345_1245 - mat[1][4] * det4_2345_1235 + mat[1][5] * det4_2345_1234;
1860 return mat[0][0] * det5_12345_12345 - mat[0][1] * det5_12345_02345 + mat[0][2] * det5_12345_01345 -
1861 mat[0][3] * det5_12345_01245 + mat[0][4] * det5_12345_01235 - mat[0][5] * det5_12345_01234;
1875 float det2_45_01 =
mat[4][0] *
mat[5][1] -
mat[4][1] *
mat[5][0];
1876 float det2_45_02 = mat[4][0] * mat[5][2] - mat[4][2] * mat[5][0];
1877 float det2_45_03 = mat[4][0] * mat[5][3] - mat[4][3] * mat[5][0];
1878 float det2_45_04 = mat[4][0] * mat[5][4] - mat[4][4] * mat[5][0];
1879 float det2_45_05 = mat[4][0] * mat[5][5] - mat[4][5] * mat[5][0];
1880 float det2_45_12 = mat[4][1] * mat[5][2] - mat[4][2] * mat[5][1];
1881 float det2_45_13 = mat[4][1] * mat[5][3] - mat[4][3] * mat[5][1];
1882 float det2_45_14 = mat[4][1] * mat[5][4] - mat[4][4] * mat[5][1];
1883 float det2_45_15 = mat[4][1] * mat[5][5] - mat[4][5] * mat[5][1];
1884 float det2_45_23 = mat[4][2] * mat[5][3] - mat[4][3] * mat[5][2];
1885 float det2_45_24 = mat[4][2] * mat[5][4] - mat[4][4] * mat[5][2];
1886 float det2_45_25 = mat[4][2] * mat[5][5] - mat[4][5] * mat[5][2];
1887 float det2_45_34 = mat[4][3] * mat[5][4] - mat[4][4] * mat[5][3];
1888 float det2_45_35 = mat[4][3] * mat[5][5] - mat[4][5] * mat[5][3];
1889 float det2_45_45 = mat[4][4] * mat[5][5] - mat[4][5] * mat[5][4];
1892 float det3_345_012 = mat[3][0] * det2_45_12 - mat[3][1] * det2_45_02 + mat[3][2] * det2_45_01;
1893 float det3_345_013 = mat[3][0] * det2_45_13 - mat[3][1] * det2_45_03 + mat[3][3] * det2_45_01;
1894 float det3_345_014 = mat[3][0] * det2_45_14 - mat[3][1] * det2_45_04 + mat[3][4] * det2_45_01;
1895 float det3_345_015 = mat[3][0] * det2_45_15 - mat[3][1] * det2_45_05 + mat[3][5] * det2_45_01;
1896 float det3_345_023 = mat[3][0] * det2_45_23 - mat[3][2] * det2_45_03 + mat[3][3] * det2_45_02;
1897 float det3_345_024 = mat[3][0] * det2_45_24 - mat[3][2] * det2_45_04 + mat[3][4] * det2_45_02;
1898 float det3_345_025 = mat[3][0] * det2_45_25 - mat[3][2] * det2_45_05 + mat[3][5] * det2_45_02;
1899 float det3_345_034 = mat[3][0] * det2_45_34 - mat[3][3] * det2_45_04 + mat[3][4] * det2_45_03;
1900 float det3_345_035 = mat[3][0] * det2_45_35 - mat[3][3] * det2_45_05 + mat[3][5] * det2_45_03;
1901 float det3_345_045 = mat[3][0] * det2_45_45 - mat[3][4] * det2_45_05 + mat[3][5] * det2_45_04;
1902 float det3_345_123 = mat[3][1] * det2_45_23 - mat[3][2] * det2_45_13 + mat[3][3] * det2_45_12;
1903 float det3_345_124 = mat[3][1] * det2_45_24 - mat[3][2] * det2_45_14 + mat[3][4] * det2_45_12;
1904 float det3_345_125 = mat[3][1] * det2_45_25 - mat[3][2] * det2_45_15 + mat[3][5] * det2_45_12;
1905 float det3_345_134 = mat[3][1] * det2_45_34 - mat[3][3] * det2_45_14 + mat[3][4] * det2_45_13;
1906 float det3_345_135 = mat[3][1] * det2_45_35 - mat[3][3] * det2_45_15 + mat[3][5] * det2_45_13;
1907 float det3_345_145 = mat[3][1] * det2_45_45 - mat[3][4] * det2_45_15 + mat[3][5] * det2_45_14;
1908 float det3_345_234 = mat[3][2] * det2_45_34 - mat[3][3] * det2_45_24 + mat[3][4] * det2_45_23;
1909 float det3_345_235 = mat[3][2] * det2_45_35 - mat[3][3] * det2_45_25 + mat[3][5] * det2_45_23;
1910 float det3_345_245 = mat[3][2] * det2_45_45 - mat[3][4] * det2_45_25 + mat[3][5] * det2_45_24;
1911 float det3_345_345 = mat[3][3] * det2_45_45 - mat[3][4] * det2_45_35 + mat[3][5] * det2_45_34;
1914 float det4_2345_0123 = mat[2][0] * det3_345_123 - mat[2][1] * det3_345_023 + mat[2][2] * det3_345_013 - mat[2][3] * det3_345_012;
1915 float det4_2345_0124 = mat[2][0] * det3_345_124 - mat[2][1] * det3_345_024 + mat[2][2] * det3_345_014 - mat[2][4] * det3_345_012;
1916 float det4_2345_0125 = mat[2][0] * det3_345_125 - mat[2][1] * det3_345_025 + mat[2][2] * det3_345_015 - mat[2][5] * det3_345_012;
1917 float det4_2345_0134 = mat[2][0] * det3_345_134 - mat[2][1] * det3_345_034 + mat[2][3] * det3_345_014 - mat[2][4] * det3_345_013;
1918 float det4_2345_0135 = mat[2][0] * det3_345_135 - mat[2][1] * det3_345_035 + mat[2][3] * det3_345_015 - mat[2][5] * det3_345_013;
1919 float det4_2345_0145 = mat[2][0] * det3_345_145 - mat[2][1] * det3_345_045 + mat[2][4] * det3_345_015 - mat[2][5] * det3_345_014;
1920 float det4_2345_0234 = mat[2][0] * det3_345_234 - mat[2][2] * det3_345_034 + mat[2][3] * det3_345_024 - mat[2][4] * det3_345_023;
1921 float det4_2345_0235 = mat[2][0] * det3_345_235 - mat[2][2] * det3_345_035 + mat[2][3] * det3_345_025 - mat[2][5] * det3_345_023;
1922 float det4_2345_0245 = mat[2][0] * det3_345_245 - mat[2][2] * det3_345_045 + mat[2][4] * det3_345_025 - mat[2][5] * det3_345_024;
1923 float det4_2345_0345 = mat[2][0] * det3_345_345 - mat[2][3] * det3_345_045 + mat[2][4] * det3_345_035 - mat[2][5] * det3_345_034;
1924 float det4_2345_1234 = mat[2][1] * det3_345_234 - mat[2][2] * det3_345_134 + mat[2][3] * det3_345_124 - mat[2][4] * det3_345_123;
1925 float det4_2345_1235 = mat[2][1] * det3_345_235 - mat[2][2] * det3_345_135 + mat[2][3] * det3_345_125 - mat[2][5] * det3_345_123;
1926 float det4_2345_1245 = mat[2][1] * det3_345_245 - mat[2][2] * det3_345_145 + mat[2][4] * det3_345_125 - mat[2][5] * det3_345_124;
1927 float det4_2345_1345 = mat[2][1] * det3_345_345 - mat[2][3] * det3_345_145 + mat[2][4] * det3_345_135 - mat[2][5] * det3_345_134;
1928 float det4_2345_2345 = mat[2][2] * det3_345_345 - mat[2][3] * det3_345_245 + mat[2][4] * det3_345_235 - mat[2][5] * det3_345_234;
1931 float det5_12345_01234 = mat[1][0] * det4_2345_1234 - mat[1][1] * det4_2345_0234 + mat[1][2] * det4_2345_0134 - mat[1][3] * det4_2345_0124 + mat[1][4] * det4_2345_0123;
1932 float det5_12345_01235 = mat[1][0] * det4_2345_1235 - mat[1][1] * det4_2345_0235 + mat[1][2] * det4_2345_0135 - mat[1][3] * det4_2345_0125 + mat[1][5] * det4_2345_0123;
1933 float det5_12345_01245 = mat[1][0] * det4_2345_1245 - mat[1][1] * det4_2345_0245 + mat[1][2] * det4_2345_0145 - mat[1][4] * det4_2345_0125 + mat[1][5] * det4_2345_0124;
1934 float det5_12345_01345 = mat[1][0] * det4_2345_1345 - mat[1][1] * det4_2345_0345 + mat[1][3] * det4_2345_0145 - mat[1][4] * det4_2345_0135 + mat[1][5] * det4_2345_0134;
1935 float det5_12345_02345 = mat[1][0] * det4_2345_2345 - mat[1][2] * det4_2345_0345 + mat[1][3] * det4_2345_0245 - mat[1][4] * det4_2345_0235 + mat[1][5] * det4_2345_0234;
1936 float det5_12345_12345 = mat[1][1] * det4_2345_2345 - mat[1][2] * det4_2345_1345 + mat[1][3] * det4_2345_1245 - mat[1][4] * det4_2345_1235 + mat[1][5] * det4_2345_1234;
1939 det = mat[0][0] * det5_12345_12345 - mat[0][1] * det5_12345_02345 + mat[0][2] * det5_12345_01345 -
1940 mat[0][3] * det5_12345_01245 + mat[0][4] * det5_12345_01235 - mat[0][5] * det5_12345_01234;
1946 invDet = 1.0f / det;
1949 float det2_34_01 = mat[3][0] * mat[4][1] - mat[3][1] * mat[4][0];
1950 float det2_34_02 = mat[3][0] * mat[4][2] - mat[3][2] * mat[4][0];
1951 float det2_34_03 = mat[3][0] * mat[4][3] - mat[3][3] * mat[4][0];
1952 float det2_34_04 = mat[3][0] * mat[4][4] - mat[3][4] * mat[4][0];
1953 float det2_34_05 = mat[3][0] * mat[4][5] - mat[3][5] * mat[4][0];
1954 float det2_34_12 = mat[3][1] * mat[4][2] - mat[3][2] * mat[4][1];
1955 float det2_34_13 = mat[3][1] * mat[4][3] - mat[3][3] * mat[4][1];
1956 float det2_34_14 = mat[3][1] * mat[4][4] - mat[3][4] * mat[4][1];
1957 float det2_34_15 = mat[3][1] * mat[4][5] - mat[3][5] * mat[4][1];
1958 float det2_34_23 = mat[3][2] * mat[4][3] - mat[3][3] * mat[4][2];
1959 float det2_34_24 = mat[3][2] * mat[4][4] - mat[3][4] * mat[4][2];
1960 float det2_34_25 = mat[3][2] * mat[4][5] - mat[3][5] * mat[4][2];
1961 float det2_34_34 = mat[3][3] * mat[4][4] - mat[3][4] * mat[4][3];
1962 float det2_34_35 = mat[3][3] * mat[4][5] - mat[3][5] * mat[4][3];
1963 float det2_34_45 = mat[3][4] * mat[4][5] - mat[3][5] * mat[4][4];
1964 float det2_35_01 = mat[3][0] * mat[5][1] - mat[3][1] * mat[5][0];
1965 float det2_35_02 = mat[3][0] * mat[5][2] - mat[3][2] * mat[5][0];
1966 float det2_35_03 = mat[3][0] * mat[5][3] - mat[3][3] * mat[5][0];
1967 float det2_35_04 = mat[3][0] * mat[5][4] - mat[3][4] * mat[5][0];
1968 float det2_35_05 = mat[3][0] * mat[5][5] - mat[3][5] * mat[5][0];
1969 float det2_35_12 = mat[3][1] * mat[5][2] - mat[3][2] * mat[5][1];
1970 float det2_35_13 = mat[3][1] * mat[5][3] - mat[3][3] * mat[5][1];
1971 float det2_35_14 = mat[3][1] * mat[5][4] - mat[3][4] * mat[5][1];
1972 float det2_35_15 = mat[3][1] * mat[5][5] - mat[3][5] * mat[5][1];
1973 float det2_35_23 = mat[3][2] * mat[5][3] - mat[3][3] * mat[5][2];
1974 float det2_35_24 = mat[3][2] * mat[5][4] - mat[3][4] * mat[5][2];
1975 float det2_35_25 = mat[3][2] * mat[5][5] - mat[3][5] * mat[5][2];
1976 float det2_35_34 = mat[3][3] * mat[5][4] - mat[3][4] * mat[5][3];
1977 float det2_35_35 = mat[3][3] * mat[5][5] - mat[3][5] * mat[5][3];
1978 float det2_35_45 = mat[3][4] * mat[5][5] - mat[3][5] * mat[5][4];
1981 float det3_234_012 = mat[2][0] * det2_34_12 - mat[2][1] * det2_34_02 + mat[2][2] * det2_34_01;
1982 float det3_234_013 = mat[2][0] * det2_34_13 - mat[2][1] * det2_34_03 + mat[2][3] * det2_34_01;
1983 float det3_234_014 = mat[2][0] * det2_34_14 - mat[2][1] * det2_34_04 + mat[2][4] * det2_34_01;
1984 float det3_234_015 = mat[2][0] * det2_34_15 - mat[2][1] * det2_34_05 + mat[2][5] * det2_34_01;
1985 float det3_234_023 = mat[2][0] * det2_34_23 - mat[2][2] * det2_34_03 + mat[2][3] * det2_34_02;
1986 float det3_234_024 = mat[2][0] * det2_34_24 - mat[2][2] * det2_34_04 + mat[2][4] * det2_34_02;
1987 float det3_234_025 = mat[2][0] * det2_34_25 - mat[2][2] * det2_34_05 + mat[2][5] * det2_34_02;
1988 float det3_234_034 = mat[2][0] * det2_34_34 - mat[2][3] * det2_34_04 + mat[2][4] * det2_34_03;
1989 float det3_234_035 = mat[2][0] * det2_34_35 - mat[2][3] * det2_34_05 + mat[2][5] * det2_34_03;
1990 float det3_234_045 = mat[2][0] * det2_34_45 - mat[2][4] * det2_34_05 + mat[2][5] * det2_34_04;
1991 float det3_234_123 = mat[2][1] * det2_34_23 - mat[2][2] * det2_34_13 + mat[2][3] * det2_34_12;
1992 float det3_234_124 = mat[2][1] * det2_34_24 - mat[2][2] * det2_34_14 + mat[2][4] * det2_34_12;
1993 float det3_234_125 = mat[2][1] * det2_34_25 - mat[2][2] * det2_34_15 + mat[2][5] * det2_34_12;
1994 float det3_234_134 = mat[2][1] * det2_34_34 - mat[2][3] * det2_34_14 + mat[2][4] * det2_34_13;
1995 float det3_234_135 = mat[2][1] * det2_34_35 - mat[2][3] * det2_34_15 + mat[2][5] * det2_34_13;
1996 float det3_234_145 = mat[2][1] * det2_34_45 - mat[2][4] * det2_34_15 + mat[2][5] * det2_34_14;
1997 float det3_234_234 = mat[2][2] * det2_34_34 - mat[2][3] * det2_34_24 + mat[2][4] * det2_34_23;
1998 float det3_234_235 = mat[2][2] * det2_34_35 - mat[2][3] * det2_34_25 + mat[2][5] * det2_34_23;
1999 float det3_234_245 = mat[2][2] * det2_34_45 - mat[2][4] * det2_34_25 + mat[2][5] * det2_34_24;
2000 float det3_234_345 = mat[2][3] * det2_34_45 - mat[2][4] * det2_34_35 + mat[2][5] * det2_34_34;
2001 float det3_235_012 = mat[2][0] * det2_35_12 - mat[2][1] * det2_35_02 + mat[2][2] * det2_35_01;
2002 float det3_235_013 = mat[2][0] * det2_35_13 - mat[2][1] * det2_35_03 + mat[2][3] * det2_35_01;
2003 float det3_235_014 = mat[2][0] * det2_35_14 - mat[2][1] * det2_35_04 + mat[2][4] * det2_35_01;
2004 float det3_235_015 = mat[2][0] * det2_35_15 - mat[2][1] * det2_35_05 + mat[2][5] * det2_35_01;
2005 float det3_235_023 = mat[2][0] * det2_35_23 - mat[2][2] * det2_35_03 + mat[2][3] * det2_35_02;
2006 float det3_235_024 = mat[2][0] * det2_35_24 - mat[2][2] * det2_35_04 + mat[2][4] * det2_35_02;
2007 float det3_235_025 = mat[2][0] * det2_35_25 - mat[2][2] * det2_35_05 + mat[2][5] * det2_35_02;
2008 float det3_235_034 = mat[2][0] * det2_35_34 - mat[2][3] * det2_35_04 + mat[2][4] * det2_35_03;
2009 float det3_235_035 = mat[2][0] * det2_35_35 - mat[2][3] * det2_35_05 + mat[2][5] * det2_35_03;
2010 float det3_235_045 = mat[2][0] * det2_35_45 - mat[2][4] * det2_35_05 + mat[2][5] * det2_35_04;
2011 float det3_235_123 = mat[2][1] * det2_35_23 - mat[2][2] * det2_35_13 + mat[2][3] * det2_35_12;
2012 float det3_235_124 = mat[2][1] * det2_35_24 - mat[2][2] * det2_35_14 + mat[2][4] * det2_35_12;
2013 float det3_235_125 = mat[2][1] * det2_35_25 - mat[2][2] * det2_35_15 + mat[2][5] * det2_35_12;
2014 float det3_235_134 = mat[2][1] * det2_35_34 - mat[2][3] * det2_35_14 + mat[2][4] * det2_35_13;
2015 float det3_235_135 = mat[2][1] * det2_35_35 - mat[2][3] * det2_35_15 + mat[2][5] * det2_35_13;
2016 float det3_235_145 = mat[2][1] * det2_35_45 - mat[2][4] * det2_35_15 + mat[2][5] * det2_35_14;
2017 float det3_235_234 = mat[2][2] * det2_35_34 - mat[2][3] * det2_35_24 + mat[2][4] * det2_35_23;
2018 float det3_235_235 = mat[2][2] * det2_35_35 - mat[2][3] * det2_35_25 + mat[2][5] * det2_35_23;
2019 float det3_235_245 = mat[2][2] * det2_35_45 - mat[2][4] * det2_35_25 + mat[2][5] * det2_35_24;
2020 float det3_235_345 = mat[2][3] * det2_35_45 - mat[2][4] * det2_35_35 + mat[2][5] * det2_35_34;
2021 float det3_245_012 = mat[2][0] * det2_45_12 - mat[2][1] * det2_45_02 + mat[2][2] * det2_45_01;
2022 float det3_245_013 = mat[2][0] * det2_45_13 - mat[2][1] * det2_45_03 + mat[2][3] * det2_45_01;
2023 float det3_245_014 = mat[2][0] * det2_45_14 - mat[2][1] * det2_45_04 + mat[2][4] * det2_45_01;
2024 float det3_245_015 = mat[2][0] * det2_45_15 - mat[2][1] * det2_45_05 + mat[2][5] * det2_45_01;
2025 float det3_245_023 = mat[2][0] * det2_45_23 - mat[2][2] * det2_45_03 + mat[2][3] * det2_45_02;
2026 float det3_245_024 = mat[2][0] * det2_45_24 - mat[2][2] * det2_45_04 + mat[2][4] * det2_45_02;
2027 float det3_245_025 = mat[2][0] * det2_45_25 - mat[2][2] * det2_45_05 + mat[2][5] * det2_45_02;
2028 float det3_245_034 = mat[2][0] * det2_45_34 - mat[2][3] * det2_45_04 + mat[2][4] * det2_45_03;
2029 float det3_245_035 = mat[2][0] * det2_45_35 - mat[2][3] * det2_45_05 + mat[2][5] * det2_45_03;
2030 float det3_245_045 = mat[2][0] * det2_45_45 - mat[2][4] * det2_45_05 + mat[2][5] * det2_45_04;
2031 float det3_245_123 = mat[2][1] * det2_45_23 - mat[2][2] * det2_45_13 + mat[2][3] * det2_45_12;
2032 float det3_245_124 = mat[2][1] * det2_45_24 - mat[2][2] * det2_45_14 + mat[2][4] * det2_45_12;
2033 float det3_245_125 = mat[2][1] * det2_45_25 - mat[2][2] * det2_45_15 + mat[2][5] * det2_45_12;
2034 float det3_245_134 = mat[2][1] * det2_45_34 - mat[2][3] * det2_45_14 + mat[2][4] * det2_45_13;
2035 float det3_245_135 = mat[2][1] * det2_45_35 - mat[2][3] * det2_45_15 + mat[2][5] * det2_45_13;
2036 float det3_245_145 = mat[2][1] * det2_45_45 - mat[2][4] * det2_45_15 + mat[2][5] * det2_45_14;
2037 float det3_245_234 = mat[2][2] * det2_45_34 - mat[2][3] * det2_45_24 + mat[2][4] * det2_45_23;
2038 float det3_245_235 = mat[2][2] * det2_45_35 - mat[2][3] * det2_45_25 + mat[2][5] * det2_45_23;
2039 float det3_245_245 = mat[2][2] * det2_45_45 - mat[2][4] * det2_45_25 + mat[2][5] * det2_45_24;
2040 float det3_245_345 = mat[2][3] * det2_45_45 - mat[2][4] * det2_45_35 + mat[2][5] * det2_45_34;
2043 float det4_1234_0123 = mat[1][0] * det3_234_123 - mat[1][1] * det3_234_023 + mat[1][2] * det3_234_013 - mat[1][3] * det3_234_012;
2044 float det4_1234_0124 = mat[1][0] * det3_234_124 - mat[1][1] * det3_234_024 + mat[1][2] * det3_234_014 - mat[1][4] * det3_234_012;
2045 float det4_1234_0125 = mat[1][0] * det3_234_125 - mat[1][1] * det3_234_025 + mat[1][2] * det3_234_015 - mat[1][5] * det3_234_012;
2046 float det4_1234_0134 = mat[1][0] * det3_234_134 - mat[1][1] * det3_234_034 + mat[1][3] * det3_234_014 - mat[1][4] * det3_234_013;
2047 float det4_1234_0135 = mat[1][0] * det3_234_135 - mat[1][1] * det3_234_035 + mat[1][3] * det3_234_015 - mat[1][5] * det3_234_013;
2048 float det4_1234_0145 = mat[1][0] * det3_234_145 - mat[1][1] * det3_234_045 + mat[1][4] * det3_234_015 - mat[1][5] * det3_234_014;
2049 float det4_1234_0234 = mat[1][0] * det3_234_234 - mat[1][2] * det3_234_034 + mat[1][3] * det3_234_024 - mat[1][4] * det3_234_023;
2050 float det4_1234_0235 = mat[1][0] * det3_234_235 - mat[1][2] * det3_234_035 + mat[1][3] * det3_234_025 - mat[1][5] * det3_234_023;
2051 float det4_1234_0245 = mat[1][0] * det3_234_245 - mat[1][2] * det3_234_045 + mat[1][4] * det3_234_025 - mat[1][5] * det3_234_024;
2052 float det4_1234_0345 = mat[1][0] * det3_234_345 - mat[1][3] * det3_234_045 + mat[1][4] * det3_234_035 - mat[1][5] * det3_234_034;
2053 float det4_1234_1234 = mat[1][1] * det3_234_234 - mat[1][2] * det3_234_134 + mat[1][3] * det3_234_124 - mat[1][4] * det3_234_123;
2054 float det4_1234_1235 = mat[1][1] * det3_234_235 - mat[1][2] * det3_234_135 + mat[1][3] * det3_234_125 - mat[1][5] * det3_234_123;
2055 float det4_1234_1245 = mat[1][1] * det3_234_245 - mat[1][2] * det3_234_145 + mat[1][4] * det3_234_125 - mat[1][5] * det3_234_124;
2056 float det4_1234_1345 = mat[1][1] * det3_234_345 - mat[1][3] * det3_234_145 + mat[1][4] * det3_234_135 - mat[1][5] * det3_234_134;
2057 float det4_1234_2345 = mat[1][2] * det3_234_345 - mat[1][3] * det3_234_245 + mat[1][4] * det3_234_235 - mat[1][5] * det3_234_234;
2058 float det4_1235_0123 = mat[1][0] * det3_235_123 - mat[1][1] * det3_235_023 + mat[1][2] * det3_235_013 - mat[1][3] * det3_235_012;
2059 float det4_1235_0124 = mat[1][0] * det3_235_124 - mat[1][1] * det3_235_024 + mat[1][2] * det3_235_014 - mat[1][4] * det3_235_012;
2060 float det4_1235_0125 = mat[1][0] * det3_235_125 - mat[1][1] * det3_235_025 + mat[1][2] * det3_235_015 - mat[1][5] * det3_235_012;
2061 float det4_1235_0134 = mat[1][0] * det3_235_134 - mat[1][1] * det3_235_034 + mat[1][3] * det3_235_014 - mat[1][4] * det3_235_013;
2062 float det4_1235_0135 = mat[1][0] * det3_235_135 - mat[1][1] * det3_235_035 + mat[1][3] * det3_235_015 - mat[1][5] * det3_235_013;
2063 float det4_1235_0145 = mat[1][0] * det3_235_145 - mat[1][1] * det3_235_045 + mat[1][4] * det3_235_015 - mat[1][5] * det3_235_014;
2064 float det4_1235_0234 = mat[1][0] * det3_235_234 - mat[1][2] * det3_235_034 + mat[1][3] * det3_235_024 - mat[1][4] * det3_235_023;
2065 float det4_1235_0235 = mat[1][0] * det3_235_235 - mat[1][2] * det3_235_035 + mat[1][3] * det3_235_025 - mat[1][5] * det3_235_023;
2066 float det4_1235_0245 = mat[1][0] * det3_235_245 - mat[1][2] * det3_235_045 + mat[1][4] * det3_235_025 - mat[1][5] * det3_235_024;
2067 float det4_1235_0345 = mat[1][0] * det3_235_345 - mat[1][3] * det3_235_045 + mat[1][4] * det3_235_035 - mat[1][5] * det3_235_034;
2068 float det4_1235_1234 = mat[1][1] * det3_235_234 - mat[1][2] * det3_235_134 + mat[1][3] * det3_235_124 - mat[1][4] * det3_235_123;
2069 float det4_1235_1235 = mat[1][1] * det3_235_235 - mat[1][2] * det3_235_135 + mat[1][3] * det3_235_125 - mat[1][5] * det3_235_123;
2070 float det4_1235_1245 = mat[1][1] * det3_235_245 - mat[1][2] * det3_235_145 + mat[1][4] * det3_235_125 - mat[1][5] * det3_235_124;
2071 float det4_1235_1345 = mat[1][1] * det3_235_345 - mat[1][3] * det3_235_145 + mat[1][4] * det3_235_135 - mat[1][5] * det3_235_134;
2072 float det4_1235_2345 = mat[1][2] * det3_235_345 - mat[1][3] * det3_235_245 + mat[1][4] * det3_235_235 - mat[1][5] * det3_235_234;
2073 float det4_1245_0123 = mat[1][0] * det3_245_123 - mat[1][1] * det3_245_023 + mat[1][2] * det3_245_013 - mat[1][3] * det3_245_012;
2074 float det4_1245_0124 = mat[1][0] * det3_245_124 - mat[1][1] * det3_245_024 + mat[1][2] * det3_245_014 - mat[1][4] * det3_245_012;
2075 float det4_1245_0125 = mat[1][0] * det3_245_125 - mat[1][1] * det3_245_025 + mat[1][2] * det3_245_015 - mat[1][5] * det3_245_012;
2076 float det4_1245_0134 = mat[1][0] * det3_245_134 - mat[1][1] * det3_245_034 + mat[1][3] * det3_245_014 - mat[1][4] * det3_245_013;
2077 float det4_1245_0135 = mat[1][0] * det3_245_135 - mat[1][1] * det3_245_035 + mat[1][3] * det3_245_015 - mat[1][5] * det3_245_013;
2078 float det4_1245_0145 = mat[1][0] * det3_245_145 - mat[1][1] * det3_245_045 + mat[1][4] * det3_245_015 - mat[1][5] * det3_245_014;
2079 float det4_1245_0234 = mat[1][0] * det3_245_234 - mat[1][2] * det3_245_034 + mat[1][3] * det3_245_024 - mat[1][4] * det3_245_023;
2080 float det4_1245_0235 = mat[1][0] * det3_245_235 - mat[1][2] * det3_245_035 + mat[1][3] * det3_245_025 - mat[1][5] * det3_245_023;
2081 float det4_1245_0245 = mat[1][0] * det3_245_245 - mat[1][2] * det3_245_045 + mat[1][4] * det3_245_025 - mat[1][5] * det3_245_024;
2082 float det4_1245_0345 = mat[1][0] * det3_245_345 - mat[1][3] * det3_245_045 + mat[1][4] * det3_245_035 - mat[1][5] * det3_245_034;
2083 float det4_1245_1234 = mat[1][1] * det3_245_234 - mat[1][2] * det3_245_134 + mat[1][3] * det3_245_124 - mat[1][4] * det3_245_123;
2084 float det4_1245_1235 = mat[1][1] * det3_245_235 - mat[1][2] * det3_245_135 + mat[1][3] * det3_245_125 - mat[1][5] * det3_245_123;
2085 float det4_1245_1245 = mat[1][1] * det3_245_245 - mat[1][2] * det3_245_145 + mat[1][4] * det3_245_125 - mat[1][5] * det3_245_124;
2086 float det4_1245_1345 = mat[1][1] * det3_245_345 - mat[1][3] * det3_245_145 + mat[1][4] * det3_245_135 - mat[1][5] * det3_245_134;
2087 float det4_1245_2345 = mat[1][2] * det3_245_345 - mat[1][3] * det3_245_245 + mat[1][4] * det3_245_235 - mat[1][5] * det3_245_234;
2088 float det4_1345_0123 = mat[1][0] * det3_345_123 - mat[1][1] * det3_345_023 + mat[1][2] * det3_345_013 - mat[1][3] * det3_345_012;
2089 float det4_1345_0124 = mat[1][0] * det3_345_124 - mat[1][1] * det3_345_024 + mat[1][2] * det3_345_014 - mat[1][4] * det3_345_012;
2090 float det4_1345_0125 = mat[1][0] * det3_345_125 - mat[1][1] * det3_345_025 + mat[1][2] * det3_345_015 - mat[1][5] * det3_345_012;
2091 float det4_1345_0134 = mat[1][0] * det3_345_134 - mat[1][1] * det3_345_034 + mat[1][3] * det3_345_014 - mat[1][4] * det3_345_013;
2092 float det4_1345_0135 = mat[1][0] * det3_345_135 - mat[1][1] * det3_345_035 + mat[1][3] * det3_345_015 - mat[1][5] * det3_345_013;
2093 float det4_1345_0145 = mat[1][0] * det3_345_145 - mat[1][1] * det3_345_045 + mat[1][4] * det3_345_015 - mat[1][5] * det3_345_014;
2094 float det4_1345_0234 = mat[1][0] * det3_345_234 - mat[1][2] * det3_345_034 + mat[1][3] * det3_345_024 - mat[1][4] * det3_345_023;
2095 float det4_1345_0235 = mat[1][0] * det3_345_235 - mat[1][2] * det3_345_035 + mat[1][3] * det3_345_025 - mat[1][5] * det3_345_023;
2096 float det4_1345_0245 = mat[1][0] * det3_345_245 - mat[1][2] * det3_345_045 + mat[1][4] * det3_345_025 - mat[1][5] * det3_345_024;
2097 float det4_1345_0345 = mat[1][0] * det3_345_345 - mat[1][3] * det3_345_045 + mat[1][4] * det3_345_035 - mat[1][5] * det3_345_034;
2098 float det4_1345_1234 = mat[1][1] * det3_345_234 - mat[1][2] * det3_345_134 + mat[1][3] * det3_345_124 - mat[1][4] * det3_345_123;
2099 float det4_1345_1235 = mat[1][1] * det3_345_235 - mat[1][2] * det3_345_135 + mat[1][3] * det3_345_125 - mat[1][5] * det3_345_123;
2100 float det4_1345_1245 = mat[1][1] * det3_345_245 - mat[1][2] * det3_345_145 + mat[1][4] * det3_345_125 - mat[1][5] * det3_345_124;
2101 float det4_1345_1345 = mat[1][1] * det3_345_345 - mat[1][3] * det3_345_145 + mat[1][4] * det3_345_135 - mat[1][5] * det3_345_134;
2102 float det4_1345_2345 = mat[1][2] * det3_345_345 - mat[1][3] * det3_345_245 + mat[1][4] * det3_345_235 - mat[1][5] * det3_345_234;
2105 float det5_01234_01234 = mat[0][0] * det4_1234_1234 - mat[0][1] * det4_1234_0234 + mat[0][2] * det4_1234_0134 - mat[0][3] * det4_1234_0124 + mat[0][4] * det4_1234_0123;
2106 float det5_01234_01235 = mat[0][0] * det4_1234_1235 - mat[0][1] * det4_1234_0235 + mat[0][2] * det4_1234_0135 - mat[0][3] * det4_1234_0125 + mat[0][5] * det4_1234_0123;
2107 float det5_01234_01245 = mat[0][0] * det4_1234_1245 - mat[0][1] * det4_1234_0245 + mat[0][2] * det4_1234_0145 - mat[0][4] * det4_1234_0125 + mat[0][5] * det4_1234_0124;
2108 float det5_01234_01345 = mat[0][0] * det4_1234_1345 - mat[0][1] * det4_1234_0345 + mat[0][3] * det4_1234_0145 - mat[0][4] * det4_1234_0135 + mat[0][5] * det4_1234_0134;
2109 float det5_01234_02345 = mat[0][0] * det4_1234_2345 - mat[0][2] * det4_1234_0345 + mat[0][3] * det4_1234_0245 - mat[0][4] * det4_1234_0235 + mat[0][5] * det4_1234_0234;
2110 float det5_01234_12345 = mat[0][1] * det4_1234_2345 - mat[0][2] * det4_1234_1345 + mat[0][3] * det4_1234_1245 - mat[0][4] * det4_1234_1235 + mat[0][5] * det4_1234_1234;
2111 float det5_01235_01234 = mat[0][0] * det4_1235_1234 - mat[0][1] * det4_1235_0234 + mat[0][2] * det4_1235_0134 - mat[0][3] * det4_1235_0124 + mat[0][4] * det4_1235_0123;
2112 float det5_01235_01235 = mat[0][0] * det4_1235_1235 - mat[0][1] * det4_1235_0235 + mat[0][2] * det4_1235_0135 - mat[0][3] * det4_1235_0125 + mat[0][5] * det4_1235_0123;
2113 float det5_01235_01245 = mat[0][0] * det4_1235_1245 - mat[0][1] * det4_1235_0245 + mat[0][2] * det4_1235_0145 - mat[0][4] * det4_1235_0125 + mat[0][5] * det4_1235_0124;
2114 float det5_01235_01345 = mat[0][0] * det4_1235_1345 - mat[0][1] * det4_1235_0345 + mat[0][3] * det4_1235_0145 - mat[0][4] * det4_1235_0135 + mat[0][5] * det4_1235_0134;
2115 float det5_01235_02345 = mat[0][0] * det4_1235_2345 - mat[0][2] * det4_1235_0345 + mat[0][3] * det4_1235_0245 - mat[0][4] * det4_1235_0235 + mat[0][5] * det4_1235_0234;
2116 float det5_01235_12345 = mat[0][1] * det4_1235_2345 - mat[0][2] * det4_1235_1345 + mat[0][3] * det4_1235_1245 - mat[0][4] * det4_1235_1235 + mat[0][5] * det4_1235_1234;
2117 float det5_01245_01234 = mat[0][0] * det4_1245_1234 - mat[0][1] * det4_1245_0234 + mat[0][2] * det4_1245_0134 - mat[0][3] * det4_1245_0124 + mat[0][4] * det4_1245_0123;
2118 float det5_01245_01235 = mat[0][0] * det4_1245_1235 - mat[0][1] * det4_1245_0235 + mat[0][2] * det4_1245_0135 - mat[0][3] * det4_1245_0125 + mat[0][5] * det4_1245_0123;
2119 float det5_01245_01245 = mat[0][0] * det4_1245_1245 - mat[0][1] * det4_1245_0245 + mat[0][2] * det4_1245_0145 - mat[0][4] * det4_1245_0125 + mat[0][5] * det4_1245_0124;
2120 float det5_01245_01345 = mat[0][0] * det4_1245_1345 - mat[0][1] * det4_1245_0345 + mat[0][3] * det4_1245_0145 - mat[0][4] * det4_1245_0135 + mat[0][5] * det4_1245_0134;
2121 float det5_01245_02345 = mat[0][0] * det4_1245_2345 - mat[0][2] * det4_1245_0345 + mat[0][3] * det4_1245_0245 - mat[0][4] * det4_1245_0235 + mat[0][5] * det4_1245_0234;
2122 float det5_01245_12345 = mat[0][1] * det4_1245_2345 - mat[0][2] * det4_1245_1345 + mat[0][3] * det4_1245_1245 - mat[0][4] * det4_1245_1235 + mat[0][5] * det4_1245_1234;
2123 float det5_01345_01234 = mat[0][0] * det4_1345_1234 - mat[0][1] * det4_1345_0234 + mat[0][2] * det4_1345_0134 - mat[0][3] * det4_1345_0124 + mat[0][4] * det4_1345_0123;
2124 float det5_01345_01235 = mat[0][0] * det4_1345_1235 - mat[0][1] * det4_1345_0235 + mat[0][2] * det4_1345_0135 - mat[0][3] * det4_1345_0125 + mat[0][5] * det4_1345_0123;
2125 float det5_01345_01245 = mat[0][0] * det4_1345_1245 - mat[0][1] * det4_1345_0245 + mat[0][2] * det4_1345_0145 - mat[0][4] * det4_1345_0125 + mat[0][5] * det4_1345_0124;
2126 float det5_01345_01345 = mat[0][0] * det4_1345_1345 - mat[0][1] * det4_1345_0345 + mat[0][3] * det4_1345_0145 - mat[0][4] * det4_1345_0135 + mat[0][5] * det4_1345_0134;
2127 float det5_01345_02345 = mat[0][0] * det4_1345_2345 - mat[0][2] * det4_1345_0345 + mat[0][3] * det4_1345_0245 - mat[0][4] * det4_1345_0235 + mat[0][5] * det4_1345_0234;
2128 float det5_01345_12345 = mat[0][1] * det4_1345_2345 - mat[0][2] * det4_1345_1345 + mat[0][3] * det4_1345_1245 - mat[0][4] * det4_1345_1235 + mat[0][5] * det4_1345_1234;
2129 float det5_02345_01234 = mat[0][0] * det4_2345_1234 - mat[0][1] * det4_2345_0234 + mat[0][2] * det4_2345_0134 - mat[0][3] * det4_2345_0124 + mat[0][4] * det4_2345_0123;
2130 float det5_02345_01235 = mat[0][0] * det4_2345_1235 - mat[0][1] * det4_2345_0235 + mat[0][2] * det4_2345_0135 - mat[0][3] * det4_2345_0125 + mat[0][5] * det4_2345_0123;
2131 float det5_02345_01245 = mat[0][0] * det4_2345_1245 - mat[0][1] * det4_2345_0245 + mat[0][2] * det4_2345_0145 - mat[0][4] * det4_2345_0125 + mat[0][5] * det4_2345_0124;
2132 float det5_02345_01345 = mat[0][0] * det4_2345_1345 - mat[0][1] * det4_2345_0345 + mat[0][3] * det4_2345_0145 - mat[0][4] * det4_2345_0135 + mat[0][5] * det4_2345_0134;
2133 float det5_02345_02345 = mat[0][0] * det4_2345_2345 - mat[0][2] * det4_2345_0345 + mat[0][3] * det4_2345_0245 - mat[0][4] * det4_2345_0235 + mat[0][5] * det4_2345_0234;
2134 float det5_02345_12345 = mat[0][1] * det4_2345_2345 - mat[0][2] * det4_2345_1345 + mat[0][3] * det4_2345_1245 - mat[0][4] * det4_2345_1235 + mat[0][5] * det4_2345_1234;
2136 mat[0][0] = det5_12345_12345 * invDet;
2137 mat[0][1] = -det5_02345_12345 * invDet;
2138 mat[0][2] = det5_01345_12345 * invDet;
2139 mat[0][3] = -det5_01245_12345 * invDet;
2140 mat[0][4] = det5_01235_12345 * invDet;
2141 mat[0][5] = -det5_01234_12345 * invDet;
2143 mat[1][0] = -det5_12345_02345 * invDet;
2144 mat[1][1] = det5_02345_02345 * invDet;
2145 mat[1][2] = -det5_01345_02345 * invDet;
2146 mat[1][3] = det5_01245_02345 * invDet;
2147 mat[1][4] = -det5_01235_02345 * invDet;
2148 mat[1][5] = det5_01234_02345 * invDet;
2150 mat[2][0] = det5_12345_01345 * invDet;
2151 mat[2][1] = -det5_02345_01345 * invDet;
2152 mat[2][2] = det5_01345_01345 * invDet;
2153 mat[2][3] = -det5_01245_01345 * invDet;
2154 mat[2][4] = det5_01235_01345 * invDet;
2155 mat[2][5] = -det5_01234_01345 * invDet;
2157 mat[3][0] = -det5_12345_01245 * invDet;
2158 mat[3][1] = det5_02345_01245 * invDet;
2159 mat[3][2] = -det5_01345_01245 * invDet;
2160 mat[3][3] = det5_01245_01245 * invDet;
2161 mat[3][4] = -det5_01235_01245 * invDet;
2162 mat[3][5] = det5_01234_01245 * invDet;
2164 mat[4][0] = det5_12345_01235 * invDet;
2165 mat[4][1] = -det5_02345_01235 * invDet;
2166 mat[4][2] = det5_01345_01235 * invDet;
2167 mat[4][3] = -det5_01245_01235 * invDet;
2168 mat[4][4] = det5_01235_01235 * invDet;
2169 mat[4][5] = -det5_01234_01235 * invDet;
2171 mat[5][0] = -det5_12345_01234 * invDet;
2172 mat[5][1] = det5_02345_01234 * invDet;
2173 mat[5][2] = -det5_01345_01234 * invDet;
2174 mat[5][3] = det5_01245_01234 * invDet;
2175 mat[5][4] = -det5_01235_01234 * invDet;
2176 mat[5][5] = det5_01234_01234 * invDet;
2193 float det2_45_01 =
mat[4][0] *
mat[5][1] -
mat[4][1] *
mat[5][0];
2194 float det2_45_02 = mat[4][0] * mat[5][2] - mat[4][2] * mat[5][0];
2195 float det2_45_03 = mat[4][0] * mat[5][3] - mat[4][3] * mat[5][0];
2196 float det2_45_04 = mat[4][0] * mat[5][4] - mat[4][4] * mat[5][0];
2197 float det2_45_05 = mat[4][0] * mat[5][5] - mat[4][5] * mat[5][0];
2198 float det2_45_12 = mat[4][1] * mat[5][2] - mat[4][2] * mat[5][1];
2199 float det2_45_13 = mat[4][1] * mat[5][3] - mat[4][3] * mat[5][1];
2200 float det2_45_14 = mat[4][1] * mat[5][4] - mat[4][4] * mat[5][1];
2201 float det2_45_15 = mat[4][1] * mat[5][5] - mat[4][5] * mat[5][1];
2202 float det2_45_23 = mat[4][2] * mat[5][3] - mat[4][3] * mat[5][2];
2203 float det2_45_24 = mat[4][2] * mat[5][4] - mat[4][4] * mat[5][2];
2204 float det2_45_25 = mat[4][2] * mat[5][5] - mat[4][5] * mat[5][2];
2205 float det2_45_34 = mat[4][3] * mat[5][4] - mat[4][4] * mat[5][3];
2206 float det2_45_35 = mat[4][3] * mat[5][5] - mat[4][5] * mat[5][3];
2207 float det2_45_45 = mat[4][4] * mat[5][5] - mat[4][5] * mat[5][4];
2210 float det3_345_012 = mat[3][0] * det2_45_12 - mat[3][1] * det2_45_02 + mat[3][2] * det2_45_01;
2211 float det3_345_013 = mat[3][0] * det2_45_13 - mat[3][1] * det2_45_03 + mat[3][3] * det2_45_01;
2212 float det3_345_014 = mat[3][0] * det2_45_14 - mat[3][1] * det2_45_04 + mat[3][4] * det2_45_01;
2213 float det3_345_015 = mat[3][0] * det2_45_15 - mat[3][1] * det2_45_05 + mat[3][5] * det2_45_01;
2214 float det3_345_023 = mat[3][0] * det2_45_23 - mat[3][2] * det2_45_03 + mat[3][3] * det2_45_02;
2215 float det3_345_024 = mat[3][0] * det2_45_24 - mat[3][2] * det2_45_04 + mat[3][4] * det2_45_02;
2216 float det3_345_025 = mat[3][0] * det2_45_25 - mat[3][2] * det2_45_05 + mat[3][5] * det2_45_02;
2217 float det3_345_034 = mat[3][0] * det2_45_34 - mat[3][3] * det2_45_04 + mat[3][4] * det2_45_03;
2218 float det3_345_035 = mat[3][0] * det2_45_35 - mat[3][3] * det2_45_05 + mat[3][5] * det2_45_03;
2219 float det3_345_045 = mat[3][0] * det2_45_45 - mat[3][4] * det2_45_05 + mat[3][5] * det2_45_04;
2220 float det3_345_123 = mat[3][1] * det2_45_23 - mat[3][2] * det2_45_13 + mat[3][3] * det2_45_12;
2221 float det3_345_124 = mat[3][1] * det2_45_24 - mat[3][2] * det2_45_14 + mat[3][4] * det2_45_12;
2222 float det3_345_125 = mat[3][1] * det2_45_25 - mat[3][2] * det2_45_15 + mat[3][5] * det2_45_12;
2223 float det3_345_134 = mat[3][1] * det2_45_34 - mat[3][3] * det2_45_14 + mat[3][4] * det2_45_13;
2224 float det3_345_135 = mat[3][1] * det2_45_35 - mat[3][3] * det2_45_15 + mat[3][5] * det2_45_13;
2225 float det3_345_145 = mat[3][1] * det2_45_45 - mat[3][4] * det2_45_15 + mat[3][5] * det2_45_14;
2226 float det3_345_234 = mat[3][2] * det2_45_34 - mat[3][3] * det2_45_24 + mat[3][4] * det2_45_23;
2227 float det3_345_235 = mat[3][2] * det2_45_35 - mat[3][3] * det2_45_25 + mat[3][5] * det2_45_23;
2228 float det3_345_245 = mat[3][2] * det2_45_45 - mat[3][4] * det2_45_25 + mat[3][5] * det2_45_24;
2229 float det3_345_345 = mat[3][3] * det2_45_45 - mat[3][4] * det2_45_35 + mat[3][5] * det2_45_34;
2232 float det4_2345_0123 = mat[2][0] * det3_345_123 - mat[2][1] * det3_345_023 + mat[2][2] * det3_345_013 - mat[2][3] * det3_345_012;
2233 float det4_2345_0124 = mat[2][0] * det3_345_124 - mat[2][1] * det3_345_024 + mat[2][2] * det3_345_014 - mat[2][4] * det3_345_012;
2234 float det4_2345_0125 = mat[2][0] * det3_345_125 - mat[2][1] * det3_345_025 + mat[2][2] * det3_345_015 - mat[2][5] * det3_345_012;
2235 float det4_2345_0134 = mat[2][0] * det3_345_134 - mat[2][1] * det3_345_034 + mat[2][3] * det3_345_014 - mat[2][4] * det3_345_013;
2236 float det4_2345_0135 = mat[2][0] * det3_345_135 - mat[2][1] * det3_345_035 + mat[2][3] * det3_345_015 - mat[2][5] * det3_345_013;
2237 float det4_2345_0145 = mat[2][0] * det3_345_145 - mat[2][1] * det3_345_045 + mat[2][4] * det3_345_015 - mat[2][5] * det3_345_014;
2238 float det4_2345_0234 = mat[2][0] * det3_345_234 - mat[2][2] * det3_345_034 + mat[2][3] * det3_345_024 - mat[2][4] * det3_345_023;
2239 float det4_2345_0235 = mat[2][0] * det3_345_235 - mat[2][2] * det3_345_035 + mat[2][3] * det3_345_025 - mat[2][5] * det3_345_023;
2240 float det4_2345_0245 = mat[2][0] * det3_345_245 - mat[2][2] * det3_345_045 + mat[2][4] * det3_345_025 - mat[2][5] * det3_345_024;
2241 float det4_2345_0345 = mat[2][0] * det3_345_345 - mat[2][3] * det3_345_045 + mat[2][4] * det3_345_035 - mat[2][5] * det3_345_034;
2242 float det4_2345_1234 = mat[2][1] * det3_345_234 - mat[2][2] * det3_345_134 + mat[2][3] * det3_345_124 - mat[2][4] * det3_345_123;
2243 float det4_2345_1235 = mat[2][1] * det3_345_235 - mat[2][2] * det3_345_135 + mat[2][3] * det3_345_125 - mat[2][5] * det3_345_123;
2244 float det4_2345_1245 = mat[2][1] * det3_345_245 - mat[2][2] * det3_345_145 + mat[2][4] * det3_345_125 - mat[2][5] * det3_345_124;
2245 float det4_2345_1345 = mat[2][1] * det3_345_345 - mat[2][3] * det3_345_145 + mat[2][4] * det3_345_135 - mat[2][5] * det3_345_134;
2246 float det4_2345_2345 = mat[2][2] * det3_345_345 - mat[2][3] * det3_345_245 + mat[2][4] * det3_345_235 - mat[2][5] * det3_345_234;
2249 float det5_12345_01234 = mat[1][0] * det4_2345_1234 - mat[1][1] * det4_2345_0234 + mat[1][2] * det4_2345_0134 - mat[1][3] * det4_2345_0124 + mat[1][4] * det4_2345_0123;
2250 float det5_12345_01235 = mat[1][0] * det4_2345_1235 - mat[1][1] * det4_2345_0235 + mat[1][2] * det4_2345_0135 - mat[1][3] * det4_2345_0125 + mat[1][5] * det4_2345_0123;
2251 float det5_12345_01245 = mat[1][0] * det4_2345_1245 - mat[1][1] * det4_2345_0245 + mat[1][2] * det4_2345_0145 - mat[1][4] * det4_2345_0125 + mat[1][5] * det4_2345_0124;
2252 float det5_12345_01345 = mat[1][0] * det4_2345_1345 - mat[1][1] * det4_2345_0345 + mat[1][3] * det4_2345_0145 - mat[1][4] * det4_2345_0135 + mat[1][5] * det4_2345_0134;
2253 float det5_12345_02345 = mat[1][0] * det4_2345_2345 - mat[1][2] * det4_2345_0345 + mat[1][3] * det4_2345_0245 - mat[1][4] * det4_2345_0235 + mat[1][5] * det4_2345_0234;
2254 float det5_12345_12345 = mat[1][1] * det4_2345_2345 - mat[1][2] * det4_2345_1345 + mat[1][3] * det4_2345_1245 - mat[1][4] * det4_2345_1235 + mat[1][5] * det4_2345_1234;
2257 det = mat[0][0] * det5_12345_12345 - mat[0][1] * det5_12345_02345 + mat[0][2] * det5_12345_01345 -
2258 mat[0][3] * det5_12345_01245 + mat[0][4] * det5_12345_01235 - mat[0][5] * det5_12345_01234;
2264 invDet = 1.0f / det;
2267 float det2_34_01 = mat[3][0] * mat[4][1] - mat[3][1] * mat[4][0];
2268 float det2_34_02 = mat[3][0] * mat[4][2] - mat[3][2] * mat[4][0];
2269 float det2_34_03 = mat[3][0] * mat[4][3] - mat[3][3] * mat[4][0];
2270 float det2_34_04 = mat[3][0] * mat[4][4] - mat[3][4] * mat[4][0];
2271 float det2_34_05 = mat[3][0] * mat[4][5] - mat[3][5] * mat[4][0];
2272 float det2_34_12 = mat[3][1] * mat[4][2] - mat[3][2] * mat[4][1];
2273 float det2_34_13 = mat[3][1] * mat[4][3] - mat[3][3] * mat[4][1];
2274 float det2_34_14 = mat[3][1] * mat[4][4] - mat[3][4] * mat[4][1];
2275 float det2_34_15 = mat[3][1] * mat[4][5] - mat[3][5] * mat[4][1];
2276 float det2_34_23 = mat[3][2] * mat[4][3] - mat[3][3] * mat[4][2];
2277 float det2_34_24 = mat[3][2] * mat[4][4] - mat[3][4] * mat[4][2];
2278 float det2_34_25 = mat[3][2] * mat[4][5] - mat[3][5] * mat[4][2];
2279 float det2_34_34 = mat[3][3] * mat[4][4] - mat[3][4] * mat[4][3];
2280 float det2_34_35 = mat[3][3] * mat[4][5] - mat[3][5] * mat[4][3];
2281 float det2_34_45 = mat[3][4] * mat[4][5] - mat[3][5] * mat[4][4];
2282 float det2_35_01 = mat[3][0] * mat[5][1] - mat[3][1] * mat[5][0];
2283 float det2_35_02 = mat[3][0] * mat[5][2] - mat[3][2] * mat[5][0];
2284 float det2_35_03 = mat[3][0] * mat[5][3] - mat[3][3] * mat[5][0];
2285 float det2_35_04 = mat[3][0] * mat[5][4] - mat[3][4] * mat[5][0];
2286 float det2_35_05 = mat[3][0] * mat[5][5] - mat[3][5] * mat[5][0];
2287 float det2_35_12 = mat[3][1] * mat[5][2] - mat[3][2] * mat[5][1];
2288 float det2_35_13 = mat[3][1] * mat[5][3] - mat[3][3] * mat[5][1];
2289 float det2_35_14 = mat[3][1] * mat[5][4] - mat[3][4] * mat[5][1];
2290 float det2_35_15 = mat[3][1] * mat[5][5] - mat[3][5] * mat[5][1];
2291 float det2_35_23 = mat[3][2] * mat[5][3] - mat[3][3] * mat[5][2];
2292 float det2_35_24 = mat[3][2] * mat[5][4] - mat[3][4] * mat[5][2];
2293 float det2_35_25 = mat[3][2] * mat[5][5] - mat[3][5] * mat[5][2];
2294 float det2_35_34 = mat[3][3] * mat[5][4] - mat[3][4] * mat[5][3];
2295 float det2_35_35 = mat[3][3] * mat[5][5] - mat[3][5] * mat[5][3];
2296 float det2_35_45 = mat[3][4] * mat[5][5] - mat[3][5] * mat[5][4];
2299 float det3_234_012 = mat[2][0] * det2_34_12 - mat[2][1] * det2_34_02 + mat[2][2] * det2_34_01;
2300 float det3_234_013 = mat[2][0] * det2_34_13 - mat[2][1] * det2_34_03 + mat[2][3] * det2_34_01;
2301 float det3_234_014 = mat[2][0] * det2_34_14 - mat[2][1] * det2_34_04 + mat[2][4] * det2_34_01;
2302 float det3_234_015 = mat[2][0] * det2_34_15 - mat[2][1] * det2_34_05 + mat[2][5] * det2_34_01;
2303 float det3_234_023 = mat[2][0] * det2_34_23 - mat[2][2] * det2_34_03 + mat[2][3] * det2_34_02;
2304 float det3_234_024 = mat[2][0] * det2_34_24 - mat[2][2] * det2_34_04 + mat[2][4] * det2_34_02;
2305 float det3_234_025 = mat[2][0] * det2_34_25 - mat[2][2] * det2_34_05 + mat[2][5] * det2_34_02;
2306 float det3_234_034 = mat[2][0] * det2_34_34 - mat[2][3] * det2_34_04 + mat[2][4] * det2_34_03;
2307 float det3_234_035 = mat[2][0] * det2_34_35 - mat[2][3] * det2_34_05 + mat[2][5] * det2_34_03;
2308 float det3_234_045 = mat[2][0] * det2_34_45 - mat[2][4] * det2_34_05 + mat[2][5] * det2_34_04;
2309 float det3_234_123 = mat[2][1] * det2_34_23 - mat[2][2] * det2_34_13 + mat[2][3] * det2_34_12;
2310 float det3_234_124 = mat[2][1] * det2_34_24 - mat[2][2] * det2_34_14 + mat[2][4] * det2_34_12;
2311 float det3_234_125 = mat[2][1] * det2_34_25 - mat[2][2] * det2_34_15 + mat[2][5] * det2_34_12;
2312 float det3_234_134 = mat[2][1] * det2_34_34 - mat[2][3] * det2_34_14 + mat[2][4] * det2_34_13;
2313 float det3_234_135 = mat[2][1] * det2_34_35 - mat[2][3] * det2_34_15 + mat[2][5] * det2_34_13;
2314 float det3_234_145 = mat[2][1] * det2_34_45 - mat[2][4] * det2_34_15 + mat[2][5] * det2_34_14;
2315 float det3_234_234 = mat[2][2] * det2_34_34 - mat[2][3] * det2_34_24 + mat[2][4] * det2_34_23;
2316 float det3_234_235 = mat[2][2] * det2_34_35 - mat[2][3] * det2_34_25 + mat[2][5] * det2_34_23;
2317 float det3_234_245 = mat[2][2] * det2_34_45 - mat[2][4] * det2_34_25 + mat[2][5] * det2_34_24;
2318 float det3_234_345 = mat[2][3] * det2_34_45 - mat[2][4] * det2_34_35 + mat[2][5] * det2_34_34;
2319 float det3_235_012 = mat[2][0] * det2_35_12 - mat[2][1] * det2_35_02 + mat[2][2] * det2_35_01;
2320 float det3_235_013 = mat[2][0] * det2_35_13 - mat[2][1] * det2_35_03 + mat[2][3] * det2_35_01;
2321 float det3_235_014 = mat[2][0] * det2_35_14 - mat[2][1] * det2_35_04 + mat[2][4] * det2_35_01;
2322 float det3_235_015 = mat[2][0] * det2_35_15 - mat[2][1] * det2_35_05 + mat[2][5] * det2_35_01;
2323 float det3_235_023 = mat[2][0] * det2_35_23 - mat[2][2] * det2_35_03 + mat[2][3] * det2_35_02;
2324 float det3_235_024 = mat[2][0] * det2_35_24 - mat[2][2] * det2_35_04 + mat[2][4] * det2_35_02;
2325 float det3_235_025 = mat[2][0] * det2_35_25 - mat[2][2] * det2_35_05 + mat[2][5] * det2_35_02;
2326 float det3_235_034 = mat[2][0] * det2_35_34 - mat[2][3] * det2_35_04 + mat[2][4] * det2_35_03;
2327 float det3_235_035 = mat[2][0] * det2_35_35 - mat[2][3] * det2_35_05 + mat[2][5] * det2_35_03;
2328 float det3_235_045 = mat[2][0] * det2_35_45 - mat[2][4] * det2_35_05 + mat[2][5] * det2_35_04;
2329 float det3_235_123 = mat[2][1] * det2_35_23 - mat[2][2] * det2_35_13 + mat[2][3] * det2_35_12;
2330 float det3_235_124 = mat[2][1] * det2_35_24 - mat[2][2] * det2_35_14 + mat[2][4] * det2_35_12;
2331 float det3_235_125 = mat[2][1] * det2_35_25 - mat[2][2] * det2_35_15 + mat[2][5] * det2_35_12;
2332 float det3_235_134 = mat[2][1] * det2_35_34 - mat[2][3] * det2_35_14 + mat[2][4] * det2_35_13;
2333 float det3_235_135 = mat[2][1] * det2_35_35 - mat[2][3] * det2_35_15 + mat[2][5] * det2_35_13;
2334 float det3_235_145 = mat[2][1] * det2_35_45 - mat[2][4] * det2_35_15 + mat[2][5] * det2_35_14;
2335 float det3_235_234 = mat[2][2] * det2_35_34 - mat[2][3] * det2_35_24 + mat[2][4] * det2_35_23;
2336 float det3_235_235 = mat[2][2] * det2_35_35 - mat[2][3] * det2_35_25 + mat[2][5] * det2_35_23;
2337 float det3_235_245 = mat[2][2] * det2_35_45 - mat[2][4] * det2_35_25 + mat[2][5] * det2_35_24;
2338 float det3_235_345 = mat[2][3] * det2_35_45 - mat[2][4] * det2_35_35 + mat[2][5] * det2_35_34;
2339 float det3_245_012 = mat[2][0] * det2_45_12 - mat[2][1] * det2_45_02 + mat[2][2] * det2_45_01;
2340 float det3_245_013 = mat[2][0] * det2_45_13 - mat[2][1] * det2_45_03 + mat[2][3] * det2_45_01;
2341 float det3_245_014 = mat[2][0] * det2_45_14 - mat[2][1] * det2_45_04 + mat[2][4] * det2_45_01;
2342 float det3_245_015 = mat[2][0] * det2_45_15 - mat[2][1] * det2_45_05 + mat[2][5] * det2_45_01;
2343 float det3_245_023 = mat[2][0] * det2_45_23 - mat[2][2] * det2_45_03 + mat[2][3] * det2_45_02;
2344 float det3_245_024 = mat[2][0] * det2_45_24 - mat[2][2] * det2_45_04 + mat[2][4] * det2_45_02;
2345 float det3_245_025 = mat[2][0] * det2_45_25 - mat[2][2] * det2_45_05 + mat[2][5] * det2_45_02;
2346 float det3_245_034 = mat[2][0] * det2_45_34 - mat[2][3] * det2_45_04 + mat[2][4] * det2_45_03;
2347 float det3_245_035 = mat[2][0] * det2_45_35 - mat[2][3] * det2_45_05 + mat[2][5] * det2_45_03;
2348 float det3_245_045 = mat[2][0] * det2_45_45 - mat[2][4] * det2_45_05 + mat[2][5] * det2_45_04;
2349 float det3_245_123 = mat[2][1] * det2_45_23 - mat[2][2] * det2_45_13 + mat[2][3] * det2_45_12;
2350 float det3_245_124 = mat[2][1] * det2_45_24 - mat[2][2] * det2_45_14 + mat[2][4] * det2_45_12;
2351 float det3_245_125 = mat[2][1] * det2_45_25 - mat[2][2] * det2_45_15 + mat[2][5] * det2_45_12;
2352 float det3_245_134 = mat[2][1] * det2_45_34 - mat[2][3] * det2_45_14 + mat[2][4] * det2_45_13;
2353 float det3_245_135 = mat[2][1] * det2_45_35 - mat[2][3] * det2_45_15 + mat[2][5] * det2_45_13;
2354 float det3_245_145 = mat[2][1] * det2_45_45 - mat[2][4] * det2_45_15 + mat[2][5] * det2_45_14;
2355 float det3_245_234 = mat[2][2] * det2_45_34 - mat[2][3] * det2_45_24 + mat[2][4] * det2_45_23;
2356 float det3_245_235 = mat[2][2] * det2_45_35 - mat[2][3] * det2_45_25 + mat[2][5] * det2_45_23;
2357 float det3_245_245 = mat[2][2] * det2_45_45 - mat[2][4] * det2_45_25 + mat[2][5] * det2_45_24;
2358 float det3_245_345 = mat[2][3] * det2_45_45 - mat[2][4] * det2_45_35 + mat[2][5] * det2_45_34;
2361 float det4_1234_0123 = mat[1][0] * det3_234_123 - mat[1][1] * det3_234_023 + mat[1][2] * det3_234_013 - mat[1][3] * det3_234_012;
2362 float det4_1234_0124 = mat[1][0] * det3_234_124 - mat[1][1] * det3_234_024 + mat[1][2] * det3_234_014 - mat[1][4] * det3_234_012;
2363 float det4_1234_0125 = mat[1][0] * det3_234_125 - mat[1][1] * det3_234_025 + mat[1][2] * det3_234_015 - mat[1][5] * det3_234_012;
2364 float det4_1234_0134 = mat[1][0] * det3_234_134 - mat[1][1] * det3_234_034 + mat[1][3] * det3_234_014 - mat[1][4] * det3_234_013;
2365 float det4_1234_0135 = mat[1][0] * det3_234_135 - mat[1][1] * det3_234_035 + mat[1][3] * det3_234_015 - mat[1][5] * det3_234_013;
2366 float det4_1234_0145 = mat[1][0] * det3_234_145 - mat[1][1] * det3_234_045 + mat[1][4] * det3_234_015 - mat[1][5] * det3_234_014;
2367 float det4_1234_0234 = mat[1][0] * det3_234_234 - mat[1][2] * det3_234_034 + mat[1][3] * det3_234_024 - mat[1][4] * det3_234_023;
2368 float det4_1234_0235 = mat[1][0] * det3_234_235 - mat[1][2] * det3_234_035 + mat[1][3] * det3_234_025 - mat[1][5] * det3_234_023;
2369 float det4_1234_0245 = mat[1][0] * det3_234_245 - mat[1][2] * det3_234_045 + mat[1][4] * det3_234_025 - mat[1][5] * det3_234_024;
2370 float det4_1234_0345 = mat[1][0] * det3_234_345 - mat[1][3] * det3_234_045 + mat[1][4] * det3_234_035 - mat[1][5] * det3_234_034;
2371 float det4_1234_1234 = mat[1][1] * det3_234_234 - mat[1][2] * det3_234_134 + mat[1][3] * det3_234_124 - mat[1][4] * det3_234_123;
2372 float det4_1234_1235 = mat[1][1] * det3_234_235 - mat[1][2] * det3_234_135 + mat[1][3] * det3_234_125 - mat[1][5] * det3_234_123;
2373 float det4_1234_1245 = mat[1][1] * det3_234_245 - mat[1][2] * det3_234_145 + mat[1][4] * det3_234_125 - mat[1][5] * det3_234_124;
2374 float det4_1234_1345 = mat[1][1] * det3_234_345 - mat[1][3] * det3_234_145 + mat[1][4] * det3_234_135 - mat[1][5] * det3_234_134;
2375 float det4_1234_2345 = mat[1][2] * det3_234_345 - mat[1][3] * det3_234_245 + mat[1][4] * det3_234_235 - mat[1][5] * det3_234_234;
2376 float det4_1235_0123 = mat[1][0] * det3_235_123 - mat[1][1] * det3_235_023 + mat[1][2] * det3_235_013 - mat[1][3] * det3_235_012;
2377 float det4_1235_0124 = mat[1][0] * det3_235_124 - mat[1][1] * det3_235_024 + mat[1][2] * det3_235_014 - mat[1][4] * det3_235_012;
2378 float det4_1235_0125 = mat[1][0] * det3_235_125 - mat[1][1] * det3_235_025 + mat[1][2] * det3_235_015 - mat[1][5] * det3_235_012;
2379 float det4_1235_0134 = mat[1][0] * det3_235_134 - mat[1][1] * det3_235_034 + mat[1][3] * det3_235_014 - mat[1][4] * det3_235_013;
2380 float det4_1235_0135 = mat[1][0] * det3_235_135 - mat[1][1] * det3_235_035 + mat[1][3] * det3_235_015 - mat[1][5] * det3_235_013;
2381 float det4_1235_0145 = mat[1][0] * det3_235_145 - mat[1][1] * det3_235_045 + mat[1][4] * det3_235_015 - mat[1][5] * det3_235_014;
2382 float det4_1235_0234 = mat[1][0] * det3_235_234 - mat[1][2] * det3_235_034 + mat[1][3] * det3_235_024 - mat[1][4] * det3_235_023;
2383 float det4_1235_0235 = mat[1][0] * det3_235_235 - mat[1][2] * det3_235_035 + mat[1][3] * det3_235_025 - mat[1][5] * det3_235_023;
2384 float det4_1235_0245 = mat[1][0] * det3_235_245 - mat[1][2] * det3_235_045 + mat[1][4] * det3_235_025 - mat[1][5] * det3_235_024;
2385 float det4_1235_0345 = mat[1][0] * det3_235_345 - mat[1][3] * det3_235_045 + mat[1][4] * det3_235_035 - mat[1][5] * det3_235_034;
2386 float det4_1235_1234 = mat[1][1] * det3_235_234 - mat[1][2] * det3_235_134 + mat[1][3] * det3_235_124 - mat[1][4] * det3_235_123;
2387 float det4_1235_1235 = mat[1][1] * det3_235_235 - mat[1][2] * det3_235_135 + mat[1][3] * det3_235_125 - mat[1][5] * det3_235_123;
2388 float det4_1235_1245 = mat[1][1] * det3_235_245 - mat[1][2] * det3_235_145 + mat[1][4] * det3_235_125 - mat[1][5] * det3_235_124;
2389 float det4_1235_1345 = mat[1][1] * det3_235_345 - mat[1][3] * det3_235_145 + mat[1][4] * det3_235_135 - mat[1][5] * det3_235_134;
2390 float det4_1235_2345 = mat[1][2] * det3_235_345 - mat[1][3] * det3_235_245 + mat[1][4] * det3_235_235 - mat[1][5] * det3_235_234;
2391 float det4_1245_0123 = mat[1][0] * det3_245_123 - mat[1][1] * det3_245_023 + mat[1][2] * det3_245_013 - mat[1][3] * det3_245_012;
2392 float det4_1245_0124 = mat[1][0] * det3_245_124 - mat[1][1] * det3_245_024 + mat[1][2] * det3_245_014 - mat[1][4] * det3_245_012;
2393 float det4_1245_0125 = mat[1][0] * det3_245_125 - mat[1][1] * det3_245_025 + mat[1][2] * det3_245_015 - mat[1][5] * det3_245_012;
2394 float det4_1245_0134 = mat[1][0] * det3_245_134 - mat[1][1] * det3_245_034 + mat[1][3] * det3_245_014 - mat[1][4] * det3_245_013;
2395 float det4_1245_0135 = mat[1][0] * det3_245_135 - mat[1][1] * det3_245_035 + mat[1][3] * det3_245_015 - mat[1][5] * det3_245_013;
2396 float det4_1245_0145 = mat[1][0] * det3_245_145 - mat[1][1] * det3_245_045 + mat[1][4] * det3_245_015 - mat[1][5] * det3_245_014;
2397 float det4_1245_0234 = mat[1][0] * det3_245_234 - mat[1][2] * det3_245_034 + mat[1][3] * det3_245_024 - mat[1][4] * det3_245_023;
2398 float det4_1245_0235 = mat[1][0] * det3_245_235 - mat[1][2] * det3_245_035 + mat[1][3] * det3_245_025 - mat[1][5] * det3_245_023;
2399 float det4_1245_0245 = mat[1][0] * det3_245_245 - mat[1][2] * det3_245_045 + mat[1][4] * det3_245_025 - mat[1][5] * det3_245_024;
2400 float det4_1245_0345 = mat[1][0] * det3_245_345 - mat[1][3] * det3_245_045 + mat[1][4] * det3_245_035 - mat[1][5] * det3_245_034;
2401 float det4_1245_1234 = mat[1][1] * det3_245_234 - mat[1][2] * det3_245_134 + mat[1][3] * det3_245_124 - mat[1][4] * det3_245_123;
2402 float det4_1245_1235 = mat[1][1] * det3_245_235 - mat[1][2] * det3_245_135 + mat[1][3] * det3_245_125 - mat[1][5] * det3_245_123;
2403 float det4_1245_1245 = mat[1][1] * det3_245_245 - mat[1][2] * det3_245_145 + mat[1][4] * det3_245_125 - mat[1][5] * det3_245_124;
2404 float det4_1245_1345 = mat[1][1] * det3_245_345 - mat[1][3] * det3_245_145 + mat[1][4] * det3_245_135 - mat[1][5] * det3_245_134;
2405 float det4_1245_2345 = mat[1][2] * det3_245_345 - mat[1][3] * det3_245_245 + mat[1][4] * det3_245_235 - mat[1][5] * det3_245_234;
2406 float det4_1345_0123 = mat[1][0] * det3_345_123 - mat[1][1] * det3_345_023 + mat[1][2] * det3_345_013 - mat[1][3] * det3_345_012;
2407 float det4_1345_0124 = mat[1][0] * det3_345_124 - mat[1][1] * det3_345_024 + mat[1][2] * det3_345_014 - mat[1][4] * det3_345_012;
2408 float det4_1345_0125 = mat[1][0] * det3_345_125 - mat[1][1] * det3_345_025 + mat[1][2] * det3_345_015 - mat[1][5] * det3_345_012;
2409 float det4_1345_0134 = mat[1][0] * det3_345_134 - mat[1][1] * det3_345_034 + mat[1][3] * det3_345_014 - mat[1][4] * det3_345_013;
2410 float det4_1345_0135 = mat[1][0] * det3_345_135 - mat[1][1] * det3_345_035 + mat[1][3] * det3_345_015 - mat[1][5] * det3_345_013;
2411 float det4_1345_0145 = mat[1][0] * det3_345_145 - mat[1][1] * det3_345_045 + mat[1][4] * det3_345_015 - mat[1][5] * det3_345_014;
2412 float det4_1345_0234 = mat[1][0] * det3_345_234 - mat[1][2] * det3_345_034 + mat[1][3] * det3_345_024 - mat[1][4] * det3_345_023;
2413 float det4_1345_0235 = mat[1][0] * det3_345_235 - mat[1][2] * det3_345_035 + mat[1][3] * det3_345_025 - mat[1][5] * det3_345_023;
2414 float det4_1345_0245 = mat[1][0] * det3_345_245 - mat[1][2] * det3_345_045 + mat[1][4] * det3_345_025 - mat[1][5] * det3_345_024;
2415 float det4_1345_0345 = mat[1][0] * det3_345_345 - mat[1][3] * det3_345_045 + mat[1][4] * det3_345_035 - mat[1][5] * det3_345_034;
2416 float det4_1345_1234 = mat[1][1] * det3_345_234 - mat[1][2] * det3_345_134 + mat[1][3] * det3_345_124 - mat[1][4] * det3_345_123;
2417 float det4_1345_1235 = mat[1][1] * det3_345_235 - mat[1][2] * det3_345_135 + mat[1][3] * det3_345_125 - mat[1][5] * det3_345_123;
2418 float det4_1345_1245 = mat[1][1] * det3_345_245 - mat[1][2] * det3_345_145 + mat[1][4] * det3_345_125 - mat[1][5] * det3_345_124;
2419 float det4_1345_1345 = mat[1][1] * det3_345_345 - mat[1][3] * det3_345_145 + mat[1][4] * det3_345_135 - mat[1][5] * det3_345_134;
2420 float det4_1345_2345 = mat[1][2] * det3_345_345 - mat[1][3] * det3_345_245 + mat[1][4] * det3_345_235 - mat[1][5] * det3_345_234;
2423 float det5_01234_01234 = mat[0][0] * det4_1234_1234 - mat[0][1] * det4_1234_0234 + mat[0][2] * det4_1234_0134 - mat[0][3] * det4_1234_0124 + mat[0][4] * det4_1234_0123;
2424 float det5_01234_01235 = mat[0][0] * det4_1234_1235 - mat[0][1] * det4_1234_0235 + mat[0][2] * det4_1234_0135 - mat[0][3] * det4_1234_0125 + mat[0][5] * det4_1234_0123;
2425 float det5_01234_01245 = mat[0][0] * det4_1234_1245 - mat[0][1] * det4_1234_0245 + mat[0][2] * det4_1234_0145 - mat[0][4] * det4_1234_0125 + mat[0][5] * det4_1234_0124;
2426 float det5_01234_01345 = mat[0][0] * det4_1234_1345 - mat[0][1] * det4_1234_0345 + mat[0][3] * det4_1234_0145 - mat[0][4] * det4_1234_0135 + mat[0][5] * det4_1234_0134;
2427 float det5_01234_02345 = mat[0][0] * det4_1234_2345 - mat[0][2] * det4_1234_0345 + mat[0][3] * det4_1234_0245 - mat[0][4] * det4_1234_0235 + mat[0][5] * det4_1234_0234;
2428 float det5_01234_12345 = mat[0][1] * det4_1234_2345 - mat[0][2] * det4_1234_1345 + mat[0][3] * det4_1234_1245 - mat[0][4] * det4_1234_1235 + mat[0][5] * det4_1234_1234;
2429 float det5_01235_01234 = mat[0][0] * det4_1235_1234 - mat[0][1] * det4_1235_0234 + mat[0][2] * det4_1235_0134 - mat[0][3] * det4_1235_0124 + mat[0][4] * det4_1235_0123;
2430 float det5_01235_01235 = mat[0][0] * det4_1235_1235 - mat[0][1] * det4_1235_0235 + mat[0][2] * det4_1235_0135 - mat[0][3] * det4_1235_0125 + mat[0][5] * det4_1235_0123;
2431 float det5_01235_01245 = mat[0][0] * det4_1235_1245 - mat[0][1] * det4_1235_0245 + mat[0][2] * det4_1235_0145 - mat[0][4] * det4_1235_0125 + mat[0][5] * det4_1235_0124;
2432 float det5_01235_01345 = mat[0][0] * det4_1235_1345 - mat[0][1] * det4_1235_0345 + mat[0][3] * det4_1235_0145 - mat[0][4] * det4_1235_0135 + mat[0][5] * det4_1235_0134;
2433 float det5_01235_02345 = mat[0][0] * det4_1235_2345 - mat[0][2] * det4_1235_0345 + mat[0][3] * det4_1235_0245 - mat[0][4] * det4_1235_0235 + mat[0][5] * det4_1235_0234;
2434 float det5_01235_12345 = mat[0][1] * det4_1235_2345 - mat[0][2] * det4_1235_1345 + mat[0][3] * det4_1235_1245 - mat[0][4] * det4_1235_1235 + mat[0][5] * det4_1235_1234;
2435 float det5_01245_01234 = mat[0][0] * det4_1245_1234 - mat[0][1] * det4_1245_0234 + mat[0][2] * det4_1245_0134 - mat[0][3] * det4_1245_0124 + mat[0][4] * det4_1245_0123;
2436 float det5_01245_01235 = mat[0][0] * det4_1245_1235 - mat[0][1] * det4_1245_0235 + mat[0][2] * det4_1245_0135 - mat[0][3] * det4_1245_0125 + mat[0][5] * det4_1245_0123;
2437 float det5_01245_01245 = mat[0][0] * det4_1245_1245 - mat[0][1] * det4_1245_0245 + mat[0][2] * det4_1245_0145 - mat[0][4] * det4_1245_0125 + mat[0][5] * det4_1245_0124;
2438 float det5_01245_01345 = mat[0][0] * det4_1245_1345 - mat[0][1] * det4_1245_0345 + mat[0][3] * det4_1245_0145 - mat[0][4] * det4_1245_0135 + mat[0][5] * det4_1245_0134;
2439 float det5_01245_02345 = mat[0][0] * det4_1245_2345 - mat[0][2] * det4_1245_0345 + mat[0][3] * det4_1245_0245 - mat[0][4] * det4_1245_0235 + mat[0][5] * det4_1245_0234;
2440 float det5_01245_12345 = mat[0][1] * det4_1245_2345 - mat[0][2] * det4_1245_1345 + mat[0][3] * det4_1245_1245 - mat[0][4] * det4_1245_1235 + mat[0][5] * det4_1245_1234;
2441 float det5_01345_01234 = mat[0][0] * det4_1345_1234 - mat[0][1] * det4_1345_0234 + mat[0][2] * det4_1345_0134 - mat[0][3] * det4_1345_0124 + mat[0][4] * det4_1345_0123;
2442 float det5_01345_01235 = mat[0][0] * det4_1345_1235 - mat[0][1] * det4_1345_0235 + mat[0][2] * det4_1345_0135 - mat[0][3] * det4_1345_0125 + mat[0][5] * det4_1345_0123;
2443 float det5_01345_01245 = mat[0][0] * det4_1345_1245 - mat[0][1] * det4_1345_0245 + mat[0][2] * det4_1345_0145 - mat[0][4] * det4_1345_0125 + mat[0][5] * det4_1345_0124;
2444 float det5_01345_01345 = mat[0][0] * det4_1345_1345 - mat[0][1] * det4_1345_0345 + mat[0][3] * det4_1345_0145 - mat[0][4] * det4_1345_0135 + mat[0][5] * det4_1345_0134;
2445 float det5_01345_02345 = mat[0][0] * det4_1345_2345 - mat[0][2] * det4_1345_0345 + mat[0][3] * det4_1345_0245 - mat[0][4] * det4_1345_0235 + mat[0][5] * det4_1345_0234;
2446 float det5_01345_12345 = mat[0][1] * det4_1345_2345 - mat[0][2] * det4_1345_1345 + mat[0][3] * det4_1345_1245 - mat[0][4] * det4_1345_1235 + mat[0][5] * det4_1345_1234;
2447 float det5_02345_01234 = mat[0][0] * det4_2345_1234 - mat[0][1] * det4_2345_0234 + mat[0][2] * det4_2345_0134 - mat[0][3] * det4_2345_0124 + mat[0][4] * det4_2345_0123;
2448 float det5_02345_01235 = mat[0][0] * det4_2345_1235 - mat[0][1] * det4_2345_0235 + mat[0][2] * det4_2345_0135 - mat[0][3] * det4_2345_0125 + mat[0][5] * det4_2345_0123;
2449 float det5_02345_01245 = mat[0][0] * det4_2345_1245 - mat[0][1] * det4_2345_0245 + mat[0][2] * det4_2345_0145 - mat[0][4] * det4_2345_0125 + mat[0][5] * det4_2345_0124;
2450 float det5_02345_01345 = mat[0][0] * det4_2345_1345 - mat[0][1] * det4_2345_0345 + mat[0][3] * det4_2345_0145 - mat[0][4] * det4_2345_0135 + mat[0][5] * det4_2345_0134;
2451 float det5_02345_02345 = mat[0][0] * det4_2345_2345 - mat[0][2] * det4_2345_0345 + mat[0][3] * det4_2345_0245 - mat[0][4] * det4_2345_0235 + mat[0][5] * det4_2345_0234;
2452 float det5_02345_12345 = mat[0][1] * det4_2345_2345 - mat[0][2] * det4_2345_1345 + mat[0][3] * det4_2345_1245 - mat[0][4] * det4_2345_1235 + mat[0][5] * det4_2345_1234;
2454 mat[0][0] = det5_12345_12345 * invDet;
2455 mat[0][1] = -det5_02345_12345 * invDet;
2456 mat[0][2] = det5_01345_12345 * invDet;
2457 mat[0][3] = -det5_01245_12345 * invDet;
2458 mat[0][4] = det5_01235_12345 * invDet;
2459 mat[0][5] = -det5_01234_12345 * invDet;
2461 mat[1][0] = -det5_12345_02345 * invDet;
2462 mat[1][1] = det5_02345_02345 * invDet;
2463 mat[1][2] = -det5_01345_02345 * invDet;
2464 mat[1][3] = det5_01245_02345 * invDet;
2465 mat[1][4] = -det5_01235_02345 * invDet;
2466 mat[1][5] = det5_01234_02345 * invDet;
2468 mat[2][0] = det5_12345_01345 * invDet;
2469 mat[2][1] = -det5_02345_01345 * invDet;
2470 mat[2][2] = det5_01345_01345 * invDet;
2471 mat[2][3] = -det5_01245_01345 * invDet;
2472 mat[2][4] = det5_01235_01345 * invDet;
2473 mat[2][5] = -det5_01234_01345 * invDet;
2475 mat[3][0] = -det5_12345_01245 * invDet;
2476 mat[3][1] = det5_02345_01245 * invDet;
2477 mat[3][2] = -det5_01345_01245 * invDet;
2478 mat[3][3] = det5_01245_01245 * invDet;
2479 mat[3][4] = -det5_01235_01245 * invDet;
2480 mat[3][5] = det5_01234_01245 * invDet;
2482 mat[4][0] = det5_12345_01235 * invDet;
2483 mat[4][1] = -det5_02345_01235 * invDet;
2484 mat[4][2] = det5_01345_01235 * invDet;
2485 mat[4][3] = -det5_01245_01235 * invDet;
2486 mat[4][4] = det5_01235_01235 * invDet;
2487 mat[4][5] = -det5_01234_01235 * invDet;
2489 mat[5][0] = -det5_12345_01234 * invDet;
2490 mat[5][1] = det5_02345_01234 * invDet;
2491 mat[5][2] = -det5_01345_01234 * invDet;
2492 mat[5][3] = det5_01245_01234 * invDet;
2493 mat[5][4] = -det5_01235_01234 * invDet;
2494 mat[5][5] = det5_01234_01234 * invDet;
2500 float *mat =
reinterpret_cast<float *
>(
this);
2506 mat[0] = d = 1.0f / di;
2519 mat[7] += mat[1] * d;
2520 mat[8] += mat[2] * d;
2521 mat[9] += mat[3] * d;
2522 mat[10] += mat[4] * d;
2523 mat[11] += mat[5] * d;
2525 mat[13] += mat[1] * d;
2526 mat[14] += mat[2] * d;
2527 mat[15] += mat[3] * d;
2528 mat[16] += mat[4] * d;
2529 mat[17] += mat[5] * d;
2531 mat[19] += mat[1] * d;
2532 mat[20] += mat[2] * d;
2533 mat[21] += mat[3] * d;
2534 mat[22] += mat[4] * d;
2535 mat[23] += mat[5] * d;
2537 mat[25] += mat[1] * d;
2538 mat[26] += mat[2] * d;
2539 mat[27] += mat[3] * d;
2540 mat[28] += mat[4] * d;
2541 mat[29] += mat[5] * d;
2543 mat[31] += mat[1] * d;
2544 mat[32] += mat[2] * d;
2545 mat[33] += mat[3] * d;
2546 mat[34] += mat[4] * d;
2547 mat[35] += mat[5] * d;
2550 mat[7] = d = 1.0f / di;
2563 mat[0] += mat[6] * d;
2564 mat[2] += mat[8] * d;
2565 mat[3] += mat[9] * d;
2566 mat[4] += mat[10] * d;
2567 mat[5] += mat[11] * d;
2569 mat[12] += mat[6] * d;
2570 mat[14] += mat[8] * d;
2571 mat[15] += mat[9] * d;
2572 mat[16] += mat[10] * d;
2573 mat[17] += mat[11] * d;
2575 mat[18] += mat[6] * d;
2576 mat[20] += mat[8] * d;
2577 mat[21] += mat[9] * d;
2578 mat[22] += mat[10] * d;
2579 mat[23] += mat[11] * d;
2581 mat[24] += mat[6] * d;
2582 mat[26] += mat[8] * d;
2583 mat[27] += mat[9] * d;
2584 mat[28] += mat[10] * d;
2585 mat[29] += mat[11] * d;
2587 mat[30] += mat[6] * d;
2588 mat[32] += mat[8] * d;
2589 mat[33] += mat[9] * d;
2590 mat[34] += mat[10] * d;
2591 mat[35] += mat[11] * d;
2594 mat[14] = d = 1.0f / di;
2607 mat[0] += mat[12] * d;
2608 mat[1] += mat[13] * d;
2609 mat[3] += mat[15] * d;
2610 mat[4] += mat[16] * d;
2611 mat[5] += mat[17] * d;
2613 mat[6] += mat[12] * d;
2614 mat[7] += mat[13] * d;
2615 mat[9] += mat[15] * d;
2616 mat[10] += mat[16] * d;
2617 mat[11] += mat[17] * d;
2619 mat[18] += mat[12] * d;
2620 mat[19] += mat[13] * d;
2621 mat[21] += mat[15] * d;
2622 mat[22] += mat[16] * d;
2623 mat[23] += mat[17] * d;
2625 mat[24] += mat[12] * d;
2626 mat[25] += mat[13] * d;
2627 mat[27] += mat[15] * d;
2628 mat[28] += mat[16] * d;
2629 mat[29] += mat[17] * d;
2631 mat[30] += mat[12] * d;
2632 mat[31] += mat[13] * d;
2633 mat[33] += mat[15] * d;
2634 mat[34] += mat[16] * d;
2635 mat[35] += mat[17] * d;
2638 mat[21] = d = 1.0f / di;
2651 mat[0] += mat[18] * d;
2652 mat[1] += mat[19] * d;
2653 mat[2] += mat[20] * d;
2654 mat[4] += mat[22] * d;
2655 mat[5] += mat[23] * d;
2657 mat[6] += mat[18] * d;
2658 mat[7] += mat[19] * d;
2659 mat[8] += mat[20] * d;
2660 mat[10] += mat[22] * d;
2661 mat[11] += mat[23] * d;
2663 mat[12] += mat[18] * d;
2664 mat[13] += mat[19] * d;
2665 mat[14] += mat[20] * d;
2666 mat[16] += mat[22] * d;
2667 mat[17] += mat[23] * d;
2669 mat[24] += mat[18] * d;
2670 mat[25] += mat[19] * d;
2671 mat[26] += mat[20] * d;
2672 mat[28] += mat[22] * d;
2673 mat[29] += mat[23] * d;
2675 mat[30] += mat[18] * d;
2676 mat[31] += mat[19] * d;
2677 mat[32] += mat[20] * d;
2678 mat[34] += mat[22] * d;
2679 mat[35] += mat[23] * d;
2682 mat[28] = d = 1.0f / di;
2695 mat[0] += mat[24] * d;
2696 mat[1] += mat[25] * d;
2697 mat[2] += mat[26] * d;
2698 mat[3] += mat[27] * d;
2699 mat[5] += mat[29] * d;
2701 mat[6] += mat[24] * d;
2702 mat[7] += mat[25] * d;
2703 mat[8] += mat[26] * d;
2704 mat[9] += mat[27] * d;
2705 mat[11] += mat[29] * d;
2707 mat[12] += mat[24] * d;
2708 mat[13] += mat[25] * d;
2709 mat[14] += mat[26] * d;
2710 mat[15] += mat[27] * d;
2711 mat[17] += mat[29] * d;
2713 mat[18] += mat[24] * d;
2714 mat[19] += mat[25] * d;
2715 mat[20] += mat[26] * d;
2716 mat[21] += mat[27] * d;
2717 mat[23] += mat[29] * d;
2719 mat[30] += mat[24] * d;
2720 mat[31] += mat[25] * d;
2721 mat[32] += mat[26] * d;
2722 mat[33] += mat[27] * d;
2723 mat[35] += mat[29] * d;
2726 mat[35] = d = 1.0f / di;
2739 mat[0] += mat[30] * d;
2740 mat[1] += mat[31] * d;
2741 mat[2] += mat[32] * d;
2742 mat[3] += mat[33] * d;
2743 mat[4] += mat[34] * d;
2745 mat[6] += mat[30] * d;
2746 mat[7] += mat[31] * d;
2747 mat[8] += mat[32] * d;
2748 mat[9] += mat[33] * d;
2749 mat[10] += mat[34] * d;
2751 mat[12] += mat[30] * d;
2752 mat[13] += mat[31] * d;
2753 mat[14] += mat[32] * d;
2754 mat[15] += mat[33] * d;
2755 mat[16] += mat[34] * d;
2757 mat[18] += mat[30] * d;
2758 mat[19] += mat[31] * d;
2759 mat[20] += mat[32] * d;
2760 mat[21] += mat[33] * d;
2761 mat[22] += mat[34] * d;
2763 mat[24] += mat[30] * d;
2764 mat[25] += mat[31] * d;
2765 mat[26] += mat[32] * d;
2766 mat[27] += mat[33] * d;
2767 mat[28] += mat[34] * d;
2774 float c0, c1, c2, det, invDet;
2775 float *mat =
reinterpret_cast<float *
>(
this);
2778 c0 = mat[1*6+1] * mat[2*6+2] - mat[1*6+2] * mat[2*6+1];
2779 c1 = mat[1*6+2] * mat[2*6+0] - mat[1*6+0] * mat[2*6+2];
2780 c2 = mat[1*6+0] * mat[2*6+1] - mat[1*6+1] * mat[2*6+0];
2782 det = mat[0*6+0] * c0 + mat[0*6+1] * c1 + mat[0*6+2] * c2;
2788 invDet = 1.0f / det;
2790 r0[0][0] = c0 * invDet;
2791 r0[0][1] = ( mat[0*6+2] * mat[2*6+1] - mat[0*6+1] * mat[2*6+2] ) * invDet;
2792 r0[0][2] = ( mat[0*6+1] * mat[1*6+2] - mat[0*6+2] * mat[1*6+1] ) * invDet;
2793 r0[1][0] = c1 * invDet;
2794 r0[1][1] = ( mat[0*6+0] * mat[2*6+2] - mat[0*6+2] * mat[2*6+0] ) * invDet;
2795 r0[1][2] = ( mat[0*6+2] * mat[1*6+0] - mat[0*6+0] * mat[1*6+2] ) * invDet;
2796 r0[2][0] = c2 * invDet;
2797 r0[2][1] = ( mat[0*6+1] * mat[2*6+0] - mat[0*6+0] * mat[2*6+1] ) * invDet;
2798 r0[2][2] = ( mat[0*6+0] * mat[1*6+1] - mat[0*6+1] * mat[1*6+0] ) * invDet;
2801 r1[0][0] = r0[0][0] * mat[0*6+3] + r0[0][1] * mat[1*6+3] + r0[0][2] * mat[2*6+3];
2802 r1[0][1] = r0[0][0] * mat[0*6+4] + r0[0][1] * mat[1*6+4] + r0[0][2] * mat[2*6+4];
2803 r1[0][2] = r0[0][0] * mat[0*6+5] + r0[0][1] * mat[1*6+5] + r0[0][2] * mat[2*6+5];
2804 r1[1][0] = r0[1][0] * mat[0*6+3] + r0[1][1] * mat[1*6+3] + r0[1][2] * mat[2*6+3];
2805 r1[1][1] = r0[1][0] * mat[0*6+4] + r0[1][1] * mat[1*6+4] + r0[1][2] * mat[2*6+4];
2806 r1[1][2] = r0[1][0] * mat[0*6+5] + r0[1][1] * mat[1*6+5] + r0[1][2] * mat[2*6+5];
2807 r1[2][0] = r0[2][0] * mat[0*6+3] + r0[2][1] * mat[1*6+3] + r0[2][2] * mat[2*6+3];
2808 r1[2][1] = r0[2][0] * mat[0*6+4] + r0[2][1] * mat[1*6+4] + r0[2][2] * mat[2*6+4];
2809 r1[2][2] = r0[2][0] * mat[0*6+5] + r0[2][1] * mat[1*6+5] + r0[2][2] * mat[2*6+5];
2812 r2[0][0] = mat[3*6+0] * r1[0][0] + mat[3*6+1] * r1[1][0] + mat[3*6+2] * r1[2][0];
2813 r2[0][1] = mat[3*6+0] * r1[0][1] + mat[3*6+1] * r1[1][1] + mat[3*6+2] * r1[2][1];
2814 r2[0][2] = mat[3*6+0] * r1[0][2] + mat[3*6+1] * r1[1][2] + mat[3*6+2] * r1[2][2];
2815 r2[1][0] = mat[4*6+0] * r1[0][0] + mat[4*6+1] * r1[1][0] + mat[4*6+2] * r1[2][0];
2816 r2[1][1] = mat[4*6+0] * r1[0][1] + mat[4*6+1] * r1[1][1] + mat[4*6+2] * r1[2][1];
2817 r2[1][2] = mat[4*6+0] * r1[0][2] + mat[4*6+1] * r1[1][2] + mat[4*6+2] * r1[2][2];
2818 r2[2][0] = mat[5*6+0] * r1[0][0] + mat[5*6+1] * r1[1][0] + mat[5*6+2] * r1[2][0];
2819 r2[2][1] = mat[5*6+0] * r1[0][1] + mat[5*6+1] * r1[1][1] + mat[5*6+2] * r1[2][1];
2820 r2[2][2] = mat[5*6+0] * r1[0][2] + mat[5*6+1] * r1[1][2] + mat[5*6+2] * r1[2][2];
2823 r3[0][0] = r2[0][0] - mat[3*6+3];
2824 r3[0][1] = r2[0][1] - mat[3*6+4];
2825 r3[0][2] = r2[0][2] - mat[3*6+5];
2826 r3[1][0] = r2[1][0] - mat[4*6+3];
2827 r3[1][1] = r2[1][1] - mat[4*6+4];
2828 r3[1][2] = r2[1][2] - mat[4*6+5];
2829 r3[2][0] = r2[2][0] - mat[5*6+3];
2830 r3[2][1] = r2[2][1] - mat[5*6+4];
2831 r3[2][2] = r2[2][2] - mat[5*6+5];
2834 r2[0][0] = r3[1][1] * r3[2][2] - r3[1][2] * r3[2][1];
2835 r2[1][0] = r3[1][2] * r3[2][0] - r3[1][0] * r3[2][2];
2836 r2[2][0] = r3[1][0] * r3[2][1] - r3[1][1] * r3[2][0];
2838 det = r3[0][0] * r2[0][0] + r3[0][1] * r2[1][0] + r3[0][2] * r2[2][0];
2844 invDet = 1.0f / det;
2846 r2[0][1] = r3[0][2] * r3[2][1] - r3[0][1] * r3[2][2];
2847 r2[0][2] = r3[0][1] * r3[1][2] - r3[0][2] * r3[1][1];
2848 r2[1][1] = r3[0][0] * r3[2][2] - r3[0][2] * r3[2][0];
2849 r2[1][2] = r3[0][2] * r3[1][0] - r3[0][0] * r3[1][2];
2850 r2[2][1] = r3[0][1] * r3[2][0] - r3[0][0] * r3[2][1];
2851 r2[2][2] = r3[0][0] * r3[1][1] - r3[0][1] * r3[1][0];
2853 r3[0][0] = r2[0][0] * invDet;
2854 r3[0][1] = r2[0][1] * invDet;
2855 r3[0][2] = r2[0][2] * invDet;
2856 r3[1][0] = r2[1][0] * invDet;
2857 r3[1][1] = r2[1][1] * invDet;
2858 r3[1][2] = r2[1][2] * invDet;
2859 r3[2][0] = r2[2][0] * invDet;
2860 r3[2][1] = r2[2][1] * invDet;
2861 r3[2][2] = r2[2][2] * invDet;
2864 r2[0][0] = mat[3*6+0] * r0[0][0] + mat[3*6+1] * r0[1][0] + mat[3*6+2] * r0[2][0];
2865 r2[0][1] = mat[3*6+0] * r0[0][1] + mat[3*6+1] * r0[1][1] + mat[3*6+2] * r0[2][1];
2866 r2[0][2] = mat[3*6+0] * r0[0][2] + mat[3*6+1] * r0[1][2] + mat[3*6+2] * r0[2][2];
2867 r2[1][0] = mat[4*6+0] * r0[0][0] + mat[4*6+1] * r0[1][0] + mat[4*6+2] * r0[2][0];
2868 r2[1][1] = mat[4*6+0] * r0[0][1] + mat[4*6+1] * r0[1][1] + mat[4*6+2] * r0[2][1];
2869 r2[1][2] = mat[4*6+0] * r0[0][2] + mat[4*6+1] * r0[1][2] + mat[4*6+2] * r0[2][2];
2870 r2[2][0] = mat[5*6+0] * r0[0][0] + mat[5*6+1] * r0[1][0] + mat[5*6+2] * r0[2][0];
2871 r2[2][1] = mat[5*6+0] * r0[0][1] + mat[5*6+1] * r0[1][1] + mat[5*6+2] * r0[2][1];
2872 r2[2][2] = mat[5*6+0] * r0[0][2] + mat[5*6+1] * r0[1][2] + mat[5*6+2] * r0[2][2];
2875 mat[3*6+0] = r3[0][0] * r2[0][0] + r3[0][1] * r2[1][0] + r3[0][2] * r2[2][0];
2876 mat[3*6+1] = r3[0][0] * r2[0][1] + r3[0][1] * r2[1][1] + r3[0][2] * r2[2][1];
2877 mat[3*6+2] = r3[0][0] * r2[0][2] + r3[0][1] * r2[1][2] + r3[0][2] * r2[2][2];
2878 mat[4*6+0] = r3[1][0] * r2[0][0] + r3[1][1] * r2[1][0] + r3[1][2] * r2[2][0];
2879 mat[4*6+1] = r3[1][0] * r2[0][1] + r3[1][1] * r2[1][1] + r3[1][2] * r2[2][1];
2880 mat[4*6+2] = r3[1][0] * r2[0][2] + r3[1][1] * r2[1][2] + r3[1][2] * r2[2][2];
2881 mat[5*6+0] = r3[2][0] * r2[0][0] + r3[2][1] * r2[1][0] + r3[2][2] * r2[2][0];
2882 mat[5*6+1] = r3[2][0] * r2[0][1] + r3[2][1] * r2[1][1] + r3[2][2] * r2[2][1];
2883 mat[5*6+2] = r3[2][0] * r2[0][2] + r3[2][1] * r2[1][2] + r3[2][2] * r2[2][2];
2886 mat[0*6+0] = r0[0][0] - r1[0][0] * mat[3*6+0] - r1[0][1] * mat[4*6+0] - r1[0][2] * mat[5*6+0];
2887 mat[0*6+1] = r0[0][1] - r1[0][0] * mat[3*6+1] - r1[0][1] * mat[4*6+1] - r1[0][2] * mat[5*6+1];
2888 mat[0*6+2] = r0[0][2] - r1[0][0] * mat[3*6+2] - r1[0][1] * mat[4*6+2] - r1[0][2] * mat[5*6+2];
2889 mat[1*6+0] = r0[1][0] - r1[1][0] * mat[3*6+0] - r1[1][1] * mat[4*6+0] - r1[1][2] * mat[5*6+0];
2890 mat[1*6+1] = r0[1][1] - r1[1][0] * mat[3*6+1] - r1[1][1] * mat[4*6+1] - r1[1][2] * mat[5*6+1];
2891 mat[1*6+2] = r0[1][2] - r1[1][0] * mat[3*6+2] - r1[1][1] * mat[4*6+2] - r1[1][2] * mat[5*6+2];
2892 mat[2*6+0] = r0[2][0] - r1[2][0] * mat[3*6+0] - r1[2][1] * mat[4*6+0] - r1[2][2] * mat[5*6+0];
2893 mat[2*6+1] = r0[2][1] - r1[2][0] * mat[3*6+1] - r1[2][1] * mat[4*6+1] - r1[2][2] * mat[5*6+1];
2894 mat[2*6+2] = r0[2][2] - r1[2][0] * mat[3*6+2] - r1[2][1] * mat[4*6+2] - r1[2][2] * mat[5*6+2];
2897 mat[0*6+3] = r1[0][0] * r3[0][0] + r1[0][1] * r3[1][0] + r1[0][2] * r3[2][0];
2898 mat[0*6+4] = r1[0][0] * r3[0][1] + r1[0][1] * r3[1][1] + r1[0][2] * r3[2][1];
2899 mat[0*6+5] = r1[0][0] * r3[0][2] + r1[0][1] * r3[1][2] + r1[0][2] * r3[2][2];
2900 mat[1*6+3] = r1[1][0] * r3[0][0] + r1[1][1] * r3[1][0] + r1[1][2] * r3[2][0];
2901 mat[1*6+4] = r1[1][0] * r3[0][1] + r1[1][1] * r3[1][1] + r1[1][2] * r3[2][1];
2902 mat[1*6+5] = r1[1][0] * r3[0][2] + r1[1][1] * r3[1][2] + r1[1][2] * r3[2][2];
2903 mat[2*6+3] = r1[2][0] * r3[0][0] + r1[2][1] * r3[1][0] + r1[2][2] * r3[2][0];
2904 mat[2*6+4] = r1[2][0] * r3[0][1] + r1[2][1] * r3[1][1] + r1[2][2] * r3[2][1];
2905 mat[2*6+5] = r1[2][0] * r3[0][2] + r1[2][1] * r3[1][2] + r1[2][2] * r3[2][2];
2908 mat[3*6+3] = -r3[0][0];
2909 mat[3*6+4] = -r3[0][1];
2910 mat[3*6+5] = -r3[0][2];
2911 mat[4*6+3] = -r3[1][0];
2912 mat[4*6+4] = -r3[1][1];
2913 mat[4*6+5] = -r3[1][2];
2914 mat[5*6+3] = -r3[2][0];
2915 mat[5*6+4] = -r3[2][1];
2916 mat[5*6+5] = -r3[2][2];
2939 float *
idMatX::tempPtr = (
float *) ( ( (
int) idMatX::temp + 15 ) & ~15 );
2949 int alloc = ( rows * columns + 3 ) & ~3;
2951 float *oldMat =
mat;
2954 memset(
mat, 0, alloc *
sizeof(
float ) );
2960 for (
int i = 0;
i < minRow;
i++ ) {
2961 for (
int j = 0;
j < minColumn;
j++ ) {
2970 for (
int i = 0;
i < minRow;
i++ ) {
2971 for (
int j = 0;
j < columns;
j++ ) {
2979 mat[
i * columns +
j ] = 0.0f;
2987 if ( makeZero && rows >
numRows ) {
2988 memset(
mat +
numRows * columns, 0, ( rows -
numRows ) * columns *
sizeof(
float ) );
3008 for ( i = r; i <
numRows; i++ ) {
3009 memcpy( &
mat[i *
numColumns], &
mat[( i + 1 ) * numColumns], numColumns *
sizeof(
float ) );
3027 for ( i = 0; i <
numRows - 1; i++ ) {
3049 for ( i = 0; i < r - 1; i++ ) {
3055 memcpy( &
mat[r *
numColumns], &
mat[( r + 1 ) * ( numColumns + 1 )], r *
sizeof(
float ) );
3057 for ( i = r; i <
numRows - 1; i++ ) {
3058 memcpy( &
mat[i * numColumns + r], &
mat[( i + 1 ) * ( numColumns + 1 ) + r + 1], numColumns *
sizeof(
float ) );
3060 memcpy( &
mat[i * numColumns + r], &
mat[( i + 1 ) * ( numColumns + 1 ) + r + 1], ( numColumns - r ) *
sizeof(
float ) );
3073 float *ptr1, *ptr2, sum;
3083 sum = ptr1[0] * ptr2[0] - (
float) (
i == j );
3086 sum += ptr1[
n] * ptr2[0];
3105 float *ptr1, *ptr2, sum;
3115 sum = ptr1[0] * ptr2[0] - (
float) (
i == j );
3118 sum += ptr1[
n] * ptr2[0];
3127 sum = ptr2[0] * ptr2[0] - 1.0f;
3128 for ( i = 1; i <
numRows; i++ ) {
3130 sum += ptr2[
i] * ptr2[
i];
3160 if ( (*
this)[0][0] <= epsilon ) {
3170 for ( i = 1; i <
numRows; i++ ) {
3172 m[i-1][j-1] = (*this)[
i][
j];
3180 for ( i = 1; i <
numRows; i++ ) {
3181 d = (*this)[
i][0] / (*this)[0][0];
3183 m[i-1][j-1] = (*this)[
i][
j] - d * (*this)[0][
j];
3209 for ( i = 0; i <
numRows; i++ ) {
3211 if ( (*
this)[i][j] > epsilon && i != j ) {
3242 for ( i = 0; i <
numRows; i++ ) {
3244 m[
i][
j] += (*this)[
j][
i];
3249 for ( i = 0; i <
numRows; i++ ) {
3252 if ( m[j][j] <= epsilon ) {
3261 for ( k = i + 1; k <
numRows; k++ ) {
3262 m[
j][k] -= s * m[
i][k];
3316 for ( i = 0; i <
numRows; i++ ) {
3318 m[
i][
j] += (*this)[
j][
i];
3323 for ( i = 0; i <
numRows; i++ ) {
3326 if ( m[j][j] < -epsilon ) {
3329 if ( m[j][j] > epsilon ) {
3332 for ( k = 0; k <
numRows; k++ ) {
3342 if ( m[i][i] <= epsilon ) {
3350 for ( k = i + 1; k <
numRows; k++ ) {
3351 m[
j][k] -= s * m[
i][k];
3387 for ( i = 0; i <
numRows; i++ ) {
3392 (*this)[
i][
i] = d = 1.0f / d;
3394 for ( j = 0; j <
i; j++ ) {
3396 for ( k = j; k <
i; k++ ) {
3397 sum -= (*this)[
i][k] * (*this)[k][
j];
3399 (*this)[
i][
j] = sum * d;
3416 for ( i =
numRows-1; i >= 0; i-- ) {
3421 (*this)[
i][
i] = d = 1.0f / d;
3423 for ( j =
numRows-1; j >
i; j-- ) {
3425 for ( k = j; k >
i; k-- ) {
3426 sum -= (*this)[
i][k] * (*this)[k][
j];
3428 (*this)[
i][
j] = sum * d;
3457 for ( i = 0; i <
numRows; i++ ) {
3460 (*this)[
i][
j] += s * w[
j];
3479 for ( i = 0; i <
numRows; i++ ) {
3482 (*this)[
i][
j] += s * v[
j];
3507 for ( i = 0; i <
numRows; i++ ) {
3508 (*this)[
i][
r] += v[
i];
3511 (*this)[
r][
i] += w[
i];
3534 for ( i = 0; i <
r; i++ ) {
3535 (*this)[
i][
r] += v[
i];
3536 (*this)[
r][
i] += v[
i];
3538 (*this)[
r][
r] += v[
r];
3539 for ( i = r+1; i <
numRows; i++ ) {
3540 (*this)[
i][
r] += v[
i];
3541 (*this)[
r][
i] += v[
i];
3566 for ( i = 0; i <
numRows; i++ ) {
3570 (*this)[numRows-1][
i] = w[
i];
3594 for ( i = 0; i <
numRows-1; i++ ) {
3598 (*this)[numRows-1][
i] = v[
i];
3626 int *columnIndex = (
int *) _alloca16(
numRows *
sizeof(
int ) );
3627 int *rowIndex = (
int *) _alloca16(
numRows *
sizeof(
int ) );
3628 bool *pivot = (
bool *) _alloca16(
numRows *
sizeof(
bool ) );
3630 memset( pivot, 0,
numRows *
sizeof(
bool ) );
3633 for ( i = 0; i <
numRows; i++ ) {
3638 for ( j = 0; j <
numRows; j++ ) {
3640 for ( k = 0; k <
numRows; k++ ) {
3653 if ( max == 0.0
f ) {
3670 d = 1.0f / (*this)[
c][
c];
3671 (*this)[
c][
c] = 1.0f;
3672 for ( k = 0; k <
numRows; k++ ) {
3677 for ( j = 0; j <
numRows; j++ ) {
3680 (*this)[
j][
c] = 0.0f;
3681 for ( k = 0; k <
numRows; k++ ) {
3682 (*this)[
j][k] -= (*this)[
c][k] * d;
3689 for ( j = numRows - 1; j >= 0; j-- ) {
3690 if ( rowIndex[j] != columnIndex[j] ) {
3691 for ( k = 0; k <
numRows; k++ ) {
3692 d = (*this)[k][rowIndex[
j]];
3693 (*this)[k][rowIndex[
j]] = (*this)[k][columnIndex[
j]];
3694 (*this)[k][columnIndex[
j]] = d;
3723 beta = 1.0f + ( w *
y );
3725 if ( beta == 0.0
f ) {
3731 for ( i = 0; i <
numRows; i++ ) {
3734 (*this)[
i][
j] -= s * z[
j];
3864 int i,
j, k, newi,
min;
3869 for ( i = 0; i <
numRows; i++ ) {
3876 for ( i = 0; i <
min; i++ ) {
3883 for ( j = i + 1; j <
numRows; j++ ) {
3902 index[
i] = index[newi];
3907 t = (*this)[newi][
j];
3908 (*this)[newi][
j] = (*this)[
i][
j];
3914 d = 1.0f / (*this)[
i][
i];
3915 for ( j = i + 1; j <
numRows; j++ ) {
3921 for ( j = i + 1; j <
numRows; j++ ) {
3924 (*this)[
j][k] -= d * (*this)[
i][k];
3931 for ( i = 0; i <
numRows; i++ ) {
3950 double diag, beta, p0, p1, d;
3955 y = (
float *) _alloca16( v.
GetSize() *
sizeof(
float ) );
3956 z = (
float *) _alloca16( w.
GetSize() *
sizeof(
float ) );
3958 if ( index !=
NULL ) {
3959 for ( i = 0; i <
numRows; i++ ) {
3960 y[
i] = alpha * v[index[
i]];
3963 for ( i = 0; i <
numRows; i++ ) {
3964 y[
i] = alpha * v[
i];
3971 for ( i = 0; i <
max; i++ ) {
3972 diag = (*this)[
i][
i];
3978 if ( diag == 0.0
f ) {
3984 (*this)[
i][
i] = diag;
3996 for ( j = i+1; j <
numRows; j++ ) {
4047 float *y0, *
y1, *z0, *z1;
4048 double diag, beta0, beta1, p0, p1, q0, q1, d;
4055 y0 = (
float *) _alloca16( v.
GetSize() *
sizeof(
float ) );
4056 z0 = (
float *) _alloca16( w.
GetSize() *
sizeof(
float ) );
4057 y1 = (
float *) _alloca16( v.
GetSize() *
sizeof(
float ) );
4058 z1 = (
float *) _alloca16( w.
GetSize() *
sizeof(
float ) );
4060 if ( index !=
NULL ) {
4061 for ( i = 0; i <
numRows; i++ ) {
4062 y0[
i] = v[index[
i]];
4065 for ( i = 0; i <
numRows; i++ ) {
4066 if ( index[i] == r ) {
4086 for ( i = 0; i <
min; i++ ) {
4088 beta1 = z1[
i] / (*this)[
i][
i];
4090 (*this)[
i][
r] += p0;
4092 z1[
j] -= beta1 * (*this)[
i][
j];
4094 for ( j = i+1; j <
numRows; j++ ) {
4095 y0[
j] -= p0 * (*this)[
j][
i];
4097 (*this)[rp][
i] += beta1;
4102 for ( i = min; i <
max; i++ ) {
4103 diag = (*this)[
i][
i];
4109 if ( diag == 0.0
f ) {
4119 if ( diag == 0.0
f ) {
4125 (*this)[
i][
i] = diag;
4140 for ( j = i+1; j <
numRows; j++ ) {
4181 for ( i = 0; i <
numRows - 1; i++ ) {
4183 for ( j = 0; j <
i; j++ ) {
4184 sum -= (*this)[numRows - 1][
j] * (*this)[
j][
i];
4186 (*this)[numRows - 1 ][
i] = sum / (*this)[
i][
i];
4190 if ( index !=
NULL ) {
4191 index[numRows - 1] = numRows - 1;
4195 for ( i = 0; i <
numRows; i++ ) {
4196 if ( index !=
NULL ) {
4201 for ( j = 0; j <
i; j++ ) {
4202 sum -= (*this)[
i][
j] * (*this)[
j][numRows - 1];
4204 (*this)[
i][numRows - 1] = sum;
4231 if ( index !=
NULL ) {
4234 for ( p = i = 0; i <
numRows; i++ ) {
4235 if ( index[i] == r ) {
4246 idSwap( v1[index[r]], v1[index[p]] );
4247 idSwap( index[r], index[p] );
4265 v1[index[
p]] = 1.0f;
4274 for ( i = r; i < numRows - 1; i++ ) {
4275 index[
i] = index[i+1];
4277 for ( i = 0; i < numRows - 1; i++ ) {
4278 if ( index[i] > r ) {
4315 for ( i = 0; i <
numRows; i++ ) {
4316 if ( index !=
NULL ) {
4321 for ( j = 0; j <
i; j++ ) {
4322 sum -= (*this)[
i][
j] * x[
j];
4328 for ( i = numRows - 1; i >= 0; i-- ) {
4330 for ( j = i + 1; j <
numRows; j++ ) {
4331 sum -= (*this)[
i][
j] * x[
j];
4333 x[
i] = sum / (*this)[
i][
i];
4355 for ( i = 0; i <
numRows; i++ ) {
4359 for ( j = 0; j <
numRows; j++ ) {
4378 for ( i = 0; i <
numRows; i++ ) {
4379 for ( j = 0; j <
i; j++ ) {
4380 L[
i][
j] = (*this)[
i][
j];
4384 U[
i][
j] = (*this)[
i][
j];
4402 for ( r = 0; r <
numRows; r++ ) {
4404 if ( index !=
NULL ) {
4413 sum = (*this)[
r][
i];
4417 for ( j = 0; j <= i && j <
r; j++ ) {
4418 sum += (*this)[
r][
j] * (*this)[
j][
i];
4438 bool singular =
false;
4443 for ( k = 0; k <
numRows-1; k++ ) {
4446 for ( i = k; i <
numRows; i++ ) {
4452 if ( scale == 0.0
f ) {
4458 for ( i = k; i <
numRows; i++ ) {
4463 for ( i = k; i <
numRows; i++ ) {
4469 if ( (*
this)[k][k] < 0.0
f ) {
4473 c[k] = s * (*this)[k][k];
4476 for ( j = k+1; j <
numRows; j++ ) {
4479 for ( i = k; i <
numRows; i++ ) {
4480 sum += (*this)[
i][k] * (*this)[
i][
j];
4483 for ( i = k; i <
numRows; i++ ) {
4484 (*this)[
i][
j] -= t * (*this)[
i][k];
4489 d[numRows-1] = (*this)[ (numRows-1) ][ (numRows-1) ];
4490 if ( d[numRows-1] == 0.0
f ) {
4506 float f,
c,
s,
w,
y;
4510 s = ( b >= 0.0f ) ? 1.0f : -1.0f;
4526 for ( j = i; j <
numRows; j++ ) {
4529 R[
i][
j] = c * y - s *
w;
4530 R[i+1][
j] = s * y + c *
w;
4532 for ( j = 0; j <
numRows; j++ ) {
4534 w = (*this)[
j][i+1];
4535 (*this)[
j][
i] = c * y - s *
w;
4536 (*this)[
j][i+1] = s * y + c *
w;
4559 for ( k = v.
GetSize()-1; k > 0; k-- ) {
4560 if ( u[k] != 0.0f ) {
4564 for ( i = k-1; i >= 0; i-- ) {
4566 if ( u[i] == 0.0f ) {
4576 for ( i = 0; i < v.
GetSize(); i++ ) {
4577 R[0][
i] += u[0] * w[
i];
4579 for ( i = 0; i < k; i++ ) {
4702 for ( i = 0; i <
numRows; i++ ) {
4707 for ( i = 0; i < numRows-1; i++ ) {
4710 for ( j = i; j <
numRows; j++ ) {
4711 sum += (*this)[
j][
i] * x[
j];
4714 for ( j = i; j <
numRows; j++ ) {
4715 x[
j] -= t * (*this)[
j][
i];
4720 for ( i = numRows-1; i >= 0; i-- ) {
4723 for ( j = i + 1; j <
numRows; j++ ) {
4724 sum -= (*this)[
i][
j] * x[
j];
4747 for ( i =
numRows-1; i >= 0; i-- ) {
4750 for ( j = i + 1; j <
numRows; j++ ) {
4751 sum -= R[
i][
j] * x[
j];
4753 x[
i] = sum / R[
i][
i];
4775 for ( i = 0; i <
numRows; i++ ) {
4779 for ( j = 0; j <
numRows; j++ ) {
4799 if ( c[i] == 0.0
f ) {
4802 for ( j = 0; j <
numRows; j++ ) {
4805 sum += (*this)[k][
i] * Q[
j][k];
4809 Q[
j][k] -= sum * (*this)[k][
i];
4815 for ( i = 0; i <
numRows; i++ ) {
4818 R[
i][
j] = (*this)[
i][
j];
4837 if ( c[i] == 0.0
f ) {
4840 for ( j = 0; j <
numRows; j++ ) {
4843 sum += (*this)[k][
i] * Q[
j][k];
4847 Q[
j][k] -= sum * (*this)[k][
i];
4852 for ( i = 0; i <
numRows; i++ ) {
4854 sum = Q[
i][
j] * d[
i];
4855 for ( k = 0; k <
i; k++ ) {
4856 sum += Q[
i][k] * (*this)[
j][k];
4898 g = s = scale = 0.0f;
4902 g = s = scale = 0.0f;
4904 for ( k = i; k <
numRows; k++ ) {
4908 for ( k = i; k <
numRows; k++ ) {
4910 s += (*this)[k][
i] * (*this)[k][
i];
4918 (*this)[
i][
i] = f -
g;
4919 if ( i != (numColumns-1) ) {
4921 for ( s = 0.0f, k = i; k <
numRows; k++ ) {
4922 s += (*this)[k][
i] * (*this)[k][
j];
4925 for ( k = i; k <
numRows; k++ ) {
4926 (*this)[k][
j] += f * (*this)[k][
i];
4930 for ( k = i; k <
numRows; k++ ) {
4936 g = s = scale = 0.0f;
4937 if ( i <
numRows && i != (numColumns-1) ) {
4944 s += (*this)[
i][k] * (*this)[
i][k];
4951 h = 1.0f / ( f * g -
s );
4952 (*this)[
i][
l] = f -
g;
4954 rv1[k] = (*this)[
i][k] * h;
4957 for ( j = l; j <
numRows; j++ ) {
4958 for ( s = 0.0f, k = l; k <
numColumns; k++ ) {
4959 s += (*this)[
j][k] * (*this)[
i][k];
4962 (*this)[
j][k] += s * rv1[k];
4993 V[
j][
i] = ((*this)[
i][
j] / (*this)[
i][
l]) / g;
4997 for ( s = 0.0f, k = l; k <
numColumns; k++ ) {
4998 s += (*this)[
i][k] * V[k][
j];
5001 V[k][
j] += s * V[k][
i];
5006 V[
i][
j] = V[
j][
i] = 0.0f;
5017 (*this)[
i][
j] = 0.0f;
5024 for ( s = 0.0f, k = l; k <
numRows; k++ ) {
5025 s += (*this)[k][
i] * (*this)[k][
j];
5027 f = (s / (*this)[
i][
i]) * g;
5028 for ( k = i; k <
numRows; k++ ) {
5029 (*this)[k][
j] += f * (*this)[k][
i];
5033 for ( j = i; j <
numRows; j++ ) {
5038 for ( j = i; j <
numRows; j++ ) {
5039 (*this)[
j][
i] = 0.0f;
5042 (*this)[
i][
i] += 1.0f;
5058 int flag,
i, its,
j, jj, k,
l, nm;
5059 double c,
f, h,
s,
x,
y,
z,
r,
g = 0.0f;
5076 for ( its = 1; its <= 30; its++ ) {
5079 for ( l = k; l >= 0; l-- ) {
5092 for ( i = l; i <= k; i++ ) {
5102 for ( j = 0; j <
numRows; j++ ) {
5105 (*this)[
j][nm] = y * c + z *
s;
5106 (*this)[
j][
i] = z * c - y *
s;
5129 f = ( ( y -
z ) * ( y + z ) + ( g - h ) * ( g + h ) ) / ( 2.0f * h * y );
5131 r = ( f >= 0.0f ? g : -
g );
5132 f= ( ( x -
z ) * ( x + z ) + h * ( ( y / ( f +
r ) ) - h ) ) /
x;
5134 for ( j = l; j <= nm; j++ ) {
5151 V[jj][
j] = x * c + z *
s;
5152 V[jj][
i] = z * c - x *
s;
5161 f = ( c *
g ) + ( s * y );
5162 x = ( c *
y ) - ( s * g );
5163 for ( jj = 0; jj <
numRows; jj++ ) {
5166 (*this)[jj][
j] = y * c + z *
s;
5167 (*this)[jj][
i] = z * c - y *
s;
5200 for ( j = 0; j <
numRows; j++ ) {
5201 sum += (*this)[
j][
i] * b[
j];
5210 sum += V[
i][
j] * tmp[
j];
5233 for ( i = 0; i <
numRows; i++ ) {
5242 for ( i = 0; i <
numRows; i++ ) {
5244 sum = V2[
i][0] * (*this)[
j][0];
5246 sum += V2[
i][k] * (*this)[
j][k];
5266 for ( r = 0; r <
numRows; r++ ) {
5272 sum += (*this)[
r][
j] * V[
i][
j];
5274 m[
r][
i] = sum * w[
r];
5301 invSqrt = (
float *) _alloca16(
numRows *
sizeof(
float ) );
5303 for ( i = 0; i <
numRows; i++ ) {
5305 for ( j = 0; j <
i; j++ ) {
5307 sum = (*this)[
i][
j];
5308 for ( k = 0; k <
j; k++ ) {
5309 sum -= (*this)[
i][k] * (*this)[
j][k];
5311 (*this)[
i][
j] = sum * invSqrt[
j];
5314 sum = (*this)[
i][
i];
5315 for ( k = 0; k <
i; k++ ) {
5316 sum -= (*this)[
i][k] * (*this)[
i][k];
5319 if ( sum <= 0.0
f ) {
5324 (*this)[
i][
i] = invSqrt[
i] * sum;
5340 double diag, invDiag, diagSqr, newDiag, newDiagSqr, beta,
p, d;
5346 y = (
float *) _alloca16( v.
GetSize() *
sizeof(
float ) );
5351 diag = (*this)[
i][
i];
5352 invDiag = 1.0f / diag;
5353 diagSqr = diag * diag;
5354 newDiagSqr = diagSqr + alpha * p *
p;
5356 if ( newDiagSqr <= 0.0
f ) {
5362 alpha /= newDiagSqr;
5366 for ( j = i+1; j <
numRows; j++ ) {
5368 d = (*this)[
j][
i] * invDiag;
5373 (*this)[
j][
i] = d * newDiag;
5395 float *original, *
y;
5408 sum = (*this)[0][0];
5411 if ( sum <= 0.0
f ) {
5423 original = (
float *) _alloca16(
numColumns *
sizeof(
float ) );
5424 y = (
float *) _alloca16(
numColumns *
sizeof(
float ) );
5427 for ( i = 0; i <
numRows; i++ ) {
5429 for ( j = 0; j <=
i; j++ ) {
5430 sum += (*this)[
r][
j] * (*this)[
i][
j];
5436 for ( i = 0; i <
r; i++ ) {
5437 sum = original[
i] + v[
i];
5438 for ( j = 0; j <
i; j++ ) {
5439 sum -= (*this)[
r][
j] * (*this)[
i][
j];
5441 (*this)[
r][
i] = sum / (*this)[
i][
i];
5447 sum = original[
r] + v[
r];
5448 for ( j = 0; j <
r; j++) {
5449 sum -= (*this)[
r][
j] * (*this)[
r][
j];
5451 if ( sum <= 0.0
f ) {
5461 for ( j = 0; j <=
r; j++ ) {
5462 sum += (*this)[
r][
j] * (*this)[
i][
j];
5464 addSub[
i] = v[
i] - ( sum - original[
i] );
5479 v1[
r] = ( 0.5f * addSub[
r] + 1.0f ) * d;
5480 v2[
r] = ( 0.5f * addSub[
r] - 1.0f ) * d;
5482 v1[
i] = v2[
i] = addSub[
i] * d;
5497 double diag, invDiag, diagSqr, newDiag, newDiagSqr;
5498 double alpha1, alpha2, beta1, beta2, p1, p2, d;
5500 v1 = (
float *) _alloca16( numColumns *
sizeof(
float ) );
5501 v2 = (
float *) _alloca16( numColumns *
sizeof(
float ) );
5504 v1[
r] = ( 0.5f * addSub[
r] + 1.0f ) * d;
5505 v2[
r] = ( 0.5f * addSub[
r] - 1.0f ) * d;
5507 v1[
i] = v2[
i] = addSub[
i] * d;
5516 diag = (*this)[
i][
i];
5517 invDiag = 1.0f / diag;
5518 diagSqr = diag * diag;
5519 newDiagSqr = diagSqr + alpha1 * p1 * p1;
5521 if ( newDiagSqr <= 0.0
f ) {
5525 alpha1 /= newDiagSqr;
5526 beta1 = p1 * alpha1;
5530 diagSqr = newDiagSqr;
5531 newDiagSqr = diagSqr + alpha2 * p2 * p2;
5533 if ( newDiagSqr <= 0.0
f ) {
5539 alpha2 /= newDiagSqr;
5540 beta2 = p2 * alpha2;
5543 for ( j = i+1; j <
numRows; j++ ) {
5545 d = (*this)[
j][
i] * invDiag;
5553 (*this)[
j][
i] = d * newDiag;
5584 x = (
float *) _alloca16(
numRows *
sizeof(
float ) );
5587 for ( i = 0; i <
numRows - 1; i++ ) {
5589 for ( j = 0; j <
i; j++ ) {
5590 sum -= (*this)[
i][
j] * x[
j];
5592 x[
i] = sum / (*this)[
i][
i];
5596 sum = v[numRows - 1];
5597 for ( i = 0; i < numRows - 1; i++ ) {
5598 (*this)[numRows - 1][
i] = x[
i];
5602 if ( sum <= 0.0
f ) {
5607 (*this)[numRows - 1][numRows - 1] =
idMath::Sqrt( sum );
5665 for ( i = 0; i <
numRows; i++ ) {
5667 for ( j = 0; j <
i; j++ ) {
5668 sum -= (*this)[
i][
j] * x[
j];
5670 x[
i] = sum / (*this)[
i][
i];
5674 for ( i = numRows - 1; i >= 0; i-- ) {
5676 for ( j = i + 1; j <
numRows; j++ ) {
5677 sum -= (*this)[
j][
i] * x[
j];
5679 x[
i] = sum / (*this)[
i][
i];
5701 for ( i = 0; i <
numRows; i++ ) {
5705 for ( j = 0; j <
numRows; j++ ) {
5725 for ( r = 0; r <
numRows; r++ ) {
5728 for ( i = 0; i <
numRows; i++ ) {
5730 for ( j = 0; j <= i && j <=
r; j++ ) {
5731 sum += (*this)[
r][
j] * (*this)[
i][
j];
5757 v = (
float *) _alloca16(
numRows *
sizeof(
float ) );
5759 for ( i = 0; i <
numRows; i++ ) {
5761 sum = (*this)[
i][
i];
5762 for ( j = 0; j <
i; j++ ) {
5764 v[
j] = (*this)[
j][
j] * d;
5768 if ( sum == 0.0
f ) {
5772 (*this)[
i][
i] = sum;
5775 for ( j = i + 1; j <
numRows; j++ ) {
5776 sum = (*this)[
j][
i];
5777 for ( k = 0; k <
i; k++ ) {
5778 sum -= (*this)[
j][k] * v[k];
5780 (*this)[
j][
i] = sum * d;
5798 double diag, newDiag, beta,
p, d;
5804 y = (
float *) _alloca16( v.
GetSize() *
sizeof(
float ) );
5809 diag = (*this)[
i][
i];
5810 (*this)[
i][
i] = newDiag = diag + alpha * p *
p;
5812 if ( newDiag == 0.0
f ) {
5820 for ( j = i+1; j <
numRows; j++ ) {
5850 float *original, *
y;
5862 (*this)[0][0] += v[0];
5871 original = (
float *) _alloca16(
numColumns *
sizeof(
float ) );
5872 y = (
float *) _alloca16(
numColumns *
sizeof(
float ) );
5875 for ( i = 0; i <
r; i++ ) {
5876 y[
i] = (*this)[
r][
i] * (*this)[
i][
i];
5880 sum = (*this)[
i][
i] * (*this)[
r][
i];
5881 }
else if ( i == r ) {
5882 sum = (*this)[
r][
r];
5884 sum = (*this)[
r][
r] * (*this)[
i][
r];
5886 for ( j = 0; j < i && j <
r; j++ ) {
5887 sum += (*this)[
i][
j] * y[
j];
5893 for ( i = 0; i <
r; i++ ) {
5894 sum = original[
i] + v[
i];
5895 for ( j = 0; j <
i; j++ ) {
5896 sum -= (*this)[
i][
j] * y[
j];
5902 for ( i = 0; i <
r; i++ ) {
5903 (*this)[
r][
i] = y[
i] / (*this)[
i][
i];
5907 if ( r == numColumns - 1 ) {
5909 sum = original[
r] + v[
r];
5910 for ( j = 0; j <
r; j++ ) {
5911 sum -= (*this)[
r][
j] * y[
j];
5913 if ( sum == 0.0
f ) {
5916 (*this)[
r][
r] = sum;
5921 for ( i = 0; i <
r; i++ ) {
5922 y[
i] = (*this)[
r][
i] * (*this)[
i][
i];
5926 sum = (*this)[
r][
r];
5928 sum = (*this)[
r][
r] * (*this)[
i][
r];
5930 for ( j = 0; j <
r; j++ ) {
5931 sum += (*this)[
i][
j] * y[
j];
5933 addSub[
i] = v[
i] - ( sum - original[
i] );
5948 v1[
r] = ( 0.5f * addSub[
r] + 1.0f ) * d;
5949 v2[
r] = ( 0.5f * addSub[
r] - 1.0f ) * d;
5951 v1[
i] = v2[
i] = addSub[
i] * d;
5966 double d, diag, newDiag, p1, p2, alpha1, alpha2, beta1, beta2;
5968 v1 = (
float *) _alloca16( numColumns *
sizeof(
float ) );
5969 v2 = (
float *) _alloca16( numColumns *
sizeof(
float ) );
5972 v1[
r] = ( 0.5f * addSub[
r] + 1.0f ) * d;
5973 v2[
r] = ( 0.5f * addSub[
r] - 1.0f ) * d;
5975 v1[
i] = v2[
i] = addSub[
i] * d;
5984 diag = (*this)[
i][
i];
5986 newDiag = diag + alpha1 * p1 * p1;
5988 if ( newDiag == 0.0
f ) {
5993 beta1 = p1 * alpha1;
5998 newDiag = diag + alpha2 * p2 * p2;
6000 if ( newDiag == 0.0
f ) {
6005 beta2 = p2 * alpha2;
6008 (*this)[
i][
i] = newDiag;
6010 for ( j = i+1; j <
numRows; j++ ) {
6051 x = (
float *) _alloca16(
numRows *
sizeof(
float ) );
6054 for ( i = 0; i <
numRows - 1; i++ ) {
6056 for ( j = 0; j <
i; j++ ) {
6057 sum -= (*this)[
i][
j] * x[
j];
6063 sum = v[numRows - 1];
6064 for ( i = 0; i < numRows - 1; i++ ) {
6065 (*this)[numRows - 1][
i] = d = x[
i] / (*this)[
i][
i];
6069 if ( sum == 0.0
f ) {
6074 (*this)[numRows - 1][numRows - 1] = sum;
6132 for ( i = 0; i <
numRows; i++ ) {
6134 for ( j = 0; j <
i; j++ ) {
6135 sum -= (*this)[
i][
j] * x[
j];
6141 for ( i = 0; i <
numRows; i++ ) {
6142 x[
i] /= (*this)[
i][
i];
6146 for ( i = numRows - 2; i >= 0; i-- ) {
6148 for ( j = i + 1; j <
numRows; j++ ) {
6149 sum -= (*this)[
j][
i] * x[
j];
6173 for ( i = 0; i <
numRows; i++ ) {
6177 for ( j = 0; j <
numRows; j++ ) {
6196 for ( i = 0; i <
numRows; i++ ) {
6197 for ( j = 0; j <
i; j++ ) {
6198 L[
i][
j] = (*this)[
i][
j];
6201 D[
i][
i] = (*this)[
i][
i];
6217 v = (
float *) _alloca16(
numRows *
sizeof(
float ) );
6220 for ( r = 0; r <
numRows; r++ ) {
6223 for ( i = 0; i <
r; i++ ) {
6224 v[
i] = (*this)[
r][
i] * (*this)[
i][
i];
6228 sum = (*this)[
i][
i] * (*this)[
r][
i];
6229 }
else if ( i == r ) {
6230 sum = (*this)[
r][
r];
6232 sum = (*this)[
r][
r] * (*this)[
i][
r];
6234 for ( j = 0; j < i && j <
r; j++ ) {
6235 sum += (*this)[
i][
j] * v[
j];
6251 for ( i = 0; i <
numRows-2; i++ ) {
6253 (*this)[
i][
j] = 0.0f;
6254 (*this)[
j][
i] = 0.0f;
6282 for ( i = 1; i <
numRows; i++ ) {
6283 tmp[
i] = (*this)[i-1][
i] * d;
6284 d = (*this)[
i][
i] - (*this)[
i][i-1] * tmp[
i];
6289 x[
i] = ( b[
i] - (*this)[
i][i-1] * x[i-1] ) * d;
6291 for ( i = numRows - 2; i >= 0; i-- ) {
6292 x[
i] -= tmp[i+1] * x[i+1];
6315 for ( i = 0; i <
numRows; i++ ) {
6319 for ( j = 0; j <
numRows; j++ ) {
6339 float h,
f,
g, invH, halfFdivH,
scale, invScale, sum;
6351 for ( i2 = 0; i2 <= i3; i2++ ) {
6355 subd[i0] = (*this)[i0][i3];
6357 invScale = 1.0f /
scale;
6358 for (i2 = 0; i2 <= i3; i2++)
6360 (*this)[i0][
i2] *= invScale;
6361 h += (*this)[i0][
i2] * (*this)[i0][
i2];
6363 f = (*this)[i0][i3];
6368 subd[i0] = scale *
g;
6370 (*this)[i0][i3] = f -
g;
6373 for (i1 = 0; i1 <= i3; i1++) {
6374 (*this)[
i1][i0] = (*this)[i0][
i1] * invH;
6376 for (i2 = 0; i2 <=
i1; i2++) {
6377 g += (*this)[
i1][
i2] * (*this)[i0][
i2];
6379 for (i2 = i1+1; i2 <= i3; i2++) {
6380 g += (*this)[
i2][
i1] * (*this)[i0][
i2];
6382 subd[
i1] = g * invH;
6383 f += subd[
i1] * (*this)[i0][
i1];
6385 halfFdivH = 0.5f * f * invH;
6386 for ( i1 = 0; i1 <= i3; i1++ ) {
6387 f = (*this)[i0][
i1];
6388 g = subd[
i1] - halfFdivH *
f;
6390 for ( i2 = 0; i2 <=
i1; i2++ ) {
6391 (*this)[
i1][
i2] -= f * subd[
i2] + g * (*this)[i0][
i2];
6396 subd[i0] = (*this)[i0][i3];
6404 for ( i0 = 0, i3 = -1; i0 <=
numRows-1; i0++, i3++ ) {
6406 for ( i1 = 0; i1 <= i3; i1++ ) {
6408 for (i2 = 0; i2 <= i3; i2++) {
6409 sum += (*this)[i0][
i2] * (*this)[
i2][
i1];
6411 for ( i2 = 0; i2 <= i3; i2++ ) {
6412 (*this)[
i2][
i1] -= sum * (*this)[
i2][i0];
6416 diag[i0] = (*this)[i0][i0];
6417 (*this)[i0][i0] = 1.0f;
6418 for ( i1 = 0; i1 <= i3; i1++ ) {
6419 (*this)[
i1][i0] = 0.0f;
6420 (*this)[i0][
i1] = 0.0f;
6425 for ( i0 = 1, i3 = 0; i0 <
numRows; i0++, i3++ ) {
6426 subd[i3] = subd[i0];
6428 subd[numRows-1] = 0.0f;
6443 const int maxIter = 32;
6449 for ( i0 = 0; i0 <
numRows; i0++ ) {
6450 for ( i1 = 0; i1 < maxIter; i1++ ) {
6451 for ( i2 = i0; i2 <= numRows - 2; i2++ ) {
6461 g = ( diag[i0+1] - diag[i0] ) / ( 2.0f * subd[i0] );
6464 g = diag[
i2] - diag[i0] + subd[i0] / ( g -
r );
6466 g = diag[
i2] - diag[i0] + subd[i0] / ( g +
r );
6471 for ( i3 = i2 - 1; i3 >= i0; i3-- ) {
6488 r = ( diag[i3] -
g ) * s + 2.0f * b * c;
6493 for (
int i4 = 0; i4 <
numRows; i4++ ) {
6494 f = (*this)[i4][i3+1];
6495 (*this)[i4][i3+1] = s * (*this)[i4][i3] + c *
f;
6496 (*this)[i4][i3] = c * (*this)[i4][i3] - s *
f;
6503 if ( i1 == maxIter ) {
6529 for ( i = 0; i <
numRows-1; i++ ) {
6530 eigenValues[
i] = (*this)[
i][
i];
6531 subd[
i] = (*this)[i+1][
i];
6533 eigenValues[numRows-1] = (*this)[numRows-1][numRows-1];
6537 return QL( eigenValues, subd );
6559 return QL( eigenValues, subd );
6578 for ( m = low + 1; m <= high - 1; m++ ) {
6581 for ( i = m; i <= high; i++ ) {
6584 if ( scale != 0.0f ) {
6588 for ( i = high; i >= m; i-- ) {
6593 if ( v[m] > 0.0f ) {
6601 for ( j = m; j <
numRows; j++) {
6603 for ( i = high; i >= m; i-- ) {
6604 f += v[
i] * H[
i][
j];
6607 for ( i = m; i <= high; i++ ) {
6608 H[
i][
j] -= f * v[
i];
6612 for ( i = 0; i <= high; i++ ) {
6614 for ( j = high; j >= m; j-- ) {
6615 f += v[
j] * H[
i][
j];
6618 for ( j = m; j <= high; j++ ) {
6619 H[
i][
j] -= f * v[
j];
6622 v[m] = scale * v[m];
6623 H[m][m-1] = scale *
g;
6629 for (
int m = high - 1; m >= low + 1; m-- ) {
6630 if ( H[m][m-1] != 0.0f ) {
6631 for ( i = m + 1; i <= high; i++ ) {
6634 for ( j = m; j <= high; j++ ) {
6636 for ( i = m; i <= high; i++ ) {
6637 g += v[
i] * (*this)[
i][
j];
6640 g = ( g / v[m] ) / H[m][m-1];
6641 for ( i = m; i <= high; i++ ) {
6642 (*this)[
i][
j] += g * v[
i];
6661 cdivr = ( xr + r * xi ) / d;
6662 cdivi = ( xi - r * xr ) / d;
6666 cdivr = ( r * xr + xi ) / d;
6667 cdivi = ( r * xi - xr ) / d;
6683 float eps = 2e-16
f, exshift = 0.0f;
6684 float p = 0.0f,
q = 0.0f, r = 0.0f,
s = 0.0f,
z = 0.0f,
t,
w,
x,
y;
6688 for ( i = 0; i <
numRows; i++ ) {
6689 if ( i < low || i > high ) {
6690 realEigenValues[
i] = H[
i][
i];
6691 imaginaryEigenValues[
i] = 0.0f;
6693 for ( j =
Max( i - 1, 0 ); j <
numRows; j++ ) {
6716 H[
n][
n] = H[
n][
n] + exshift;
6717 realEigenValues[
n] = H[
n][
n];
6718 imaginaryEigenValues[
n] = 0.0f;
6721 }
else if ( l == n-1 ) {
6722 w = H[
n][n-1] * H[n-1][
n];
6723 p = ( H[n-1][n-1] - H[
n][
n] ) / 2.0f;
6726 H[
n][
n] = H[
n][
n] + exshift;
6727 H[n-1][n-1] = H[n-1][n-1] + exshift;
6736 realEigenValues[n-1] = x +
z;
6737 realEigenValues[
n] = realEigenValues[n-1];
6739 realEigenValues[
n] = x - w /
z;
6741 imaginaryEigenValues[n-1] = 0.0f;
6742 imaginaryEigenValues[
n] = 0.0f;
6752 for ( j = n-1; j <
numRows; j++ ) {
6754 H[n-1][
j] = q * z + p * H[
n][
j];
6755 H[
n][
j] = q * H[
n][
j] - p *
z;
6759 for ( i = 0; i <=
n; i++ ) {
6761 H[
i][n-1] = q * z + p * H[
i][
n];
6762 H[
i][
n] = q * H[
i][
n] - p *
z;
6766 for ( i = low; i <= high; i++ ) {
6767 z = (*this)[
i][n-1];
6768 (*this)[
i][n-1] = q * z + p * (*this)[
i][
n];
6769 (*this)[
i][
n] = q * (*this)[
i][
n] - p *
z;
6772 realEigenValues[n-1] = x +
p;
6773 realEigenValues[
n] = x +
p;
6774 imaginaryEigenValues[n-1] =
z;
6775 imaginaryEigenValues[
n] = -
z;
6788 w = H[
n][n-1] * H[n-1][
n];
6794 for ( i = low; i <=
n; i++ ) {
6799 w = -0.4375f *
s *
s;
6804 s = ( y -
x ) / 2.0f;
6811 s = x - w / ( ( y -
x ) / 2.0f +
s );
6812 for ( i = low; i <=
n; i++ ) {
6824 for( m = n-2; m >=
l; m-- ) {
6828 p = ( r *
s -
w ) / H[m+1][m] + H[m][m+1];
6829 q = H[m+1][m+1] - z - r -
s;
6844 for ( i = m+2; i <=
n; i++ ) {
6852 for ( k = m; k <= n-1; k++ ) {
6853 bool notlast = ( k != n-1 );
6857 r = ( notlast ? H[k+2][k-1] : 0.0f );
6875 }
else if ( l != m ) {
6876 H[k][k-1] = -H[k][k-1];
6886 for ( j = k; j <
numRows; j++ ) {
6887 p = H[k][
j] +
q * H[k+1][
j];
6889 p = p + r * H[k+2][
j];
6890 H[k+2][
j] = H[k+2][
j] - p *
z;
6892 H[k][
j] = H[k][
j] - p *
x;
6893 H[k+1][
j] = H[k+1][
j] - p *
y;
6897 for ( i = 0; i <=
Min( n, k + 3 ); i++ ) {
6898 p = x * H[
i][k] + y * H[
i][k+1];
6900 p = p +
z * H[
i][k+2];
6901 H[
i][k+2] = H[
i][k+2] - p *
r;
6903 H[
i][k] = H[
i][k] -
p;
6904 H[
i][k+1] = H[
i][k+1] - p *
q;
6908 for ( i = low; i <= high; i++ ) {
6909 p = x * (*this)[
i][k] + y * (*this)[
i][k+1];
6911 p = p +
z * (*this)[
i][k+2];
6912 (*this)[
i][k+2] = (*this)[
i][k+2] - p *
r;
6914 (*this)[
i][k] = (*this)[
i][k] -
p;
6915 (*this)[
i][k+1] = (*this)[
i][k+1] - p *
q;
6923 if ( norm == 0.0f ) {
6927 for ( n = numRows-1; n >= 0; n-- ) {
6928 p = realEigenValues[
n];
6929 q = imaginaryEigenValues[
n];
6934 for ( i = n-1; i >= 0; i-- ) {
6937 for ( j = l; j <=
n; j++ ) {
6938 r = r + H[
i][
j] * H[
j][
n];
6940 if ( imaginaryEigenValues[i] < 0.0f ) {
6945 if ( imaginaryEigenValues[i] == 0.0f ) {
6949 H[
i][
n] = -r / ( eps * norm );
6954 q = ( realEigenValues[
i] -
p ) * ( realEigenValues[i] - p ) + imaginaryEigenValues[
i] * imaginaryEigenValues[
i];
6955 t = ( x *
s -
z *
r ) /
q;
6958 H[i+1][
n] = ( -r - w *
t ) / x;
6960 H[i+1][
n] = ( -
s - y *
t ) /
z;
6966 if ( ( eps *
t ) * t > 1 ) {
6967 for ( j = i; j <=
n; j++ ) {
6968 H[
j][
n] = H[
j][
n] /
t;
6973 }
else if (
q < 0.0f ) {
6978 H[n-1][n-1] =
q / H[
n][n-1];
6979 H[n-1][
n] = -( H[
n][
n] -
p ) / H[n][n-1];
6981 ComplexDivision( 0.0f, -H[n-1][n], H[n-1][n-1]-p,
q, H[n-1][n-1], H[n-1][n] );
6985 for ( i = n-2; i >= 0; i-- ) {
6986 float ra, sa, vr, vi;
6989 for ( j = l; j <=
n; j++ ) {
6990 ra = ra + H[
i][
j] * H[
j][n-1];
6991 sa = sa + H[
i][
j] * H[
j][
n];
6995 if ( imaginaryEigenValues[i] < 0.0f ) {
7001 if ( imaginaryEigenValues[i] == 0.0f ) {
7007 vr = ( realEigenValues[
i] -
p ) * ( realEigenValues[i] - p ) + imaginaryEigenValues[
i] * imaginaryEigenValues[
i] -
q *
q;
7008 vi = ( realEigenValues[
i] -
p ) * 2.0f * q;
7009 if ( vr == 0.0f && vi == 0.0f ) {
7012 ComplexDivision( x * r -
z * ra + q * sa, x *
s -
z * sa - q * ra, vr, vi, H[i][n-1], H[i][n] );
7014 H[i+1][n-1] = ( -ra - w * H[
i][n-1] + q * H[
i][
n] ) / x;
7015 H[i+1][
n] = ( -sa - w * H[
i][
n] - q * H[
i][n-1] ) / x;
7017 ComplexDivision( -r - y * H[i][n-1], -
s - y * H[i][n],
z, q, H[i+1][n-1], H[i+1][n] );
7023 if ( ( eps *
t ) * t > 1 ) {
7024 for ( j = i; j <=
n; j++ ) {
7025 H[
j][n-1] = H[
j][n-1] /
t;
7026 H[
j][
n] = H[
j][
n] /
t;
7035 for ( i = 0; i <
numRows; i++ ) {
7036 if ( i < low || i > high ) {
7037 for ( j = i; j <
numRows; j++ ) {
7038 (*this)[
i][
j] = H[
i][
j];
7044 for ( j = numRows - 1; j >= low; j-- ) {
7045 for ( i = low; i <= high; i++ ) {
7047 for ( k = low; k <=
Min( j, high ); k++ ) {
7048 z =
z + (*this)[
i][k] * H[k][
j];
7092 for ( i = 0, j; i <=
numRows - 2; i++ ) {
7094 min = eigenValues[
j];
7095 for ( k = i + 1; k <
numRows; k++ ) {
7096 if ( eigenValues[k] < min ) {
7098 min = eigenValues[
j];
7117 for ( i = 0, j; i <=
numRows - 2; i++ ) {
7119 max = eigenValues[
j];
7120 for ( k = i + 1; k <
numRows; k++ ) {
7121 if ( eigenValues[k] > max ) {
7123 max = eigenValues[
j];
7143 index = (
int *) _alloca16(
numRows *
sizeof(
int ) );
7164 index = (
int *) _alloca16(
numRows *
sizeof(
int ) );
7176 for ( i = 0; i <
numRows; i++ ) {
7180 for ( j = 0; j <
numRows; j++ ) {
7181 (*this)[
j][
i] = x[
j];
7194 idMatX original, m1, m2, m3, q1, q2, r1, r2;
7199 original.
Random( size, size, 0 );
7200 original = original * original.
Transpose();
7202 index1 = (
int *) _alloca16( ( size + 1 ) *
sizeof( index1[0] ) );
7203 index2 = (
int *) _alloca16( ( size + 1 ) *
sizeof( index2[0] ) );
7278 for ( offset = 0; offset <
size; offset++ ) {
7334 for ( offset = 0; offset <
size; offset++ ) {
7340 for (
int i = 0;
i <
size;
i++ ) {
7372 if ( !original.
Compare( m1, 1e-4
f ) ) {
7410 for ( offset = 0; offset <
size; offset++ ) {
7474 for ( offset = 0; offset <
size; offset++ ) {
7480 for (
int i = 0;
i <
size;
i++ ) {
7497 for (
int i = 0;
i <
size;
i++ ) {
7498 u[
i] = original[index1[
offset]][
i];
7538 if ( !original.
Compare( m1, 1e-4
f ) ) {
7579 for ( offset = 0; offset <
size; offset++ ) {
7649 for ( offset = 0; offset <
size; offset++ ) {
7658 for (
int i = 0;
i <
size;
i++ ) {
7703 m3.
Zero( size, size );
7711 if ( !original.
Compare( m1, 1e-4
f ) ) {
7738 if ( !original.
Compare( m2, 1e-4
f ) ) {
7773 for ( offset = 0; offset <
size; offset++ ) {
7781 int pdtable[] = { 1, 0, 1, 0, 0, 0 };
7782 w.
Random( size, pdtable[offset] );
7804 m1.
Random( size + 1, size + 1, 0 );
7811 for (
int i = 0;
i < size + 1;
i++ ) {
7838 for ( offset = 0; offset <
size; offset += size - 1 ) {
7843 for (
int i = 0;
i <
size;
i++ ) {
7887 if ( !original.
Compare( m2, 1e-4
f ) ) {
7894 if ( !original.
Compare( m2, 1e-4
f ) ) {
7929 for ( offset = 0; offset <
size; offset++ ) {
7958 m1.
Random( size + 1, size + 1, 0 );
7965 for (
int i = 0;
i < size + 1;
i++ ) {
7992 for ( offset = 0; offset <
size; offset++ ) {
7997 for (
int i = 0;
i <
size;
i++ ) {
8044 m3.TransposeMultiply( m2, m1 );
8046 for (
int i = 0;
i <
size;
i++ ) {
8047 for (
int j = 0;
j <
size;
j++ ) {
8067 m3.TransposeMultiply( m2, m1 );
8069 for (
int i = 0;
i <
size;
i++ ) {
8070 for (
int j = 0;
j <
size;
j++ ) {
8091 m3.TransposeMultiply( m2, m1 );
8093 for (
int i = 0;
i <
size;
i++ ) {
8094 for (
int j = 0;
j <
size;
j++ ) {
GLdouble GLdouble GLdouble GLdouble q
idCQuat ToCQuat(void) const
idVecX TransposeMultiply(const idVecX &vec) const
void ComplexDivision(float xr, float xi, float yr, float yi, float &cdivr, float &cdivi)
void Cholesky_Solve(idVecX &x, const idVecX &b) const
bool IsSymmetric(const float epsilon=MATRIX_EPSILON) const
bool Eigen_SolveSymmetric(idVecX &eigenValues)
void LU_Inverse(idMatX &inv, const int *index) const
const float * ToFloatPtr(void) const
assert(prefInfo.fullscreenBtn)
idMat3 mat3_identity(idVec3(1, 0, 0), idVec3(0, 1, 0), idVec3(0, 0, 1))
bool Cholesky_UpdateRowColumn(const idVecX &v, int r)
bool IsSquare(void) const
idMat4 mat4_zero(idVec4(0, 0, 0, 0), idVec4(0, 0, 0, 0), idVec4(0, 0, 0, 0), idVec4(0, 0, 0, 0))
void QR_Rotate(idMatX &R, int i, float a, float b)
bool Cholesky_UpdateIncrement(const idVecX &v)
bool QR_UpdateRankOne(idMatX &R, const idVecX &v, const idVecX &w, float alpha)
float DeterminantGeneric(void) 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
const float * ToFloatPtr(void) const
bool Inverse_UpdateIncrement(const idVecX &v, const idVecX &w)
bool SVD_Factor(idVecX &w, idMatX &V)
idMatX & SwapRows(int r1, int r2)
ID_INLINE T Max(T x, T y)
bool Inverse_UpdateRankOne(const idVecX &v, const idVecX &w, float alpha)
bool Inverse_GaussJordan(void)
GLenum GLenum GLenum GLenum GLenum scale
idMat3 Transpose(void) const
void LDLT_MultiplyFactors(idMatX &m) const
idMatX & RemoveRow(int r)
idMat6 mat6_zero(idVec6(0, 0, 0, 0, 0, 0), idVec6(0, 0, 0, 0, 0, 0), idVec6(0, 0, 0, 0, 0, 0), idVec6(0, 0, 0, 0, 0, 0), idVec6(0, 0, 0, 0, 0, 0), idVec6(0, 0, 0, 0, 0, 0))
void Set(const float x, const float y, const float z)
bool InverseFastSelf(void)
bool LU_Factor(int *index, float *det=NULL)
void TriDiagonal_Inverse(idMatX &inv) const
const float * ToFloatPtr(void) const
idMat6 mat6_identity(idVec6(1, 0, 0, 0, 0, 0), idVec6(0, 1, 0, 0, 0, 0), idVec6(0, 0, 1, 0, 0, 0), idVec6(0, 0, 0, 1, 0, 0), idVec6(0, 0, 0, 0, 1, 0), idVec6(0, 0, 0, 0, 0, 1))
static const float FLT_EPSILON
bool HessenbergToRealSchur(idMatX &H, idVecX &realEigenValues, idVecX &imaginaryEigenValues)
int GetDimension(void) const
idVecX & SwapElements(int e1, int e2)
static const char * FloatArrayToString(const float *array, const int length, const int precision)
void LDLT_UnpackFactors(idMatX &L, idMatX &D) const
static float Sqrt(float x)
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
void ClearUpperTriangle(void)
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 SVD_Solve(idVecX &x, const idVecX &b, const idVecX &w, const idMatX &V) const
void Cholesky_Inverse(idMatX &inv) 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)
bool IsSymmetricPositiveSemiDefinite(const float epsilon=MATRIX_EPSILON) const
void Update_Increment(const idVecX &v, const idVecX &w)
idMatX & RemoveRowColumn(int r)
idMat4 & TransposeSelf(void)
bool LDLT_UpdateIncrement(const idVecX &v)
idVec3 ToAngularVelocity(void) const
bool InverseFastSelf(void)
static float temp[MATX_MAX_TEMP+4]
idMatX & RemoveColumn(int r)
bool LU_UpdateRankOne(const idVecX &v, const idVecX &w, float alpha, int *index)
bool LDLT_UpdateRankOne(const idVecX &v, float alpha, int offset=0)
static const float M_RAD2DEG
GLfloat GLfloat GLfloat v2
idVecX Multiply(const idVecX &vec) const
void Random(int seed, float l=0.0f, float u=1.0f)
idMat3 InertiaTranslate(const float mass, const idVec3 ¢erOfMass, const idVec3 &translation) const
float GetAngle(void) const
int GetNumColumns(void) const
void ClearLowerTriangle(void)
void Eigen_SortDecreasing(idVecX &eigenValues)
idMat6 Transpose(void) const
void TriDiagonal_ClearTriangles(void)
void Update_Decrement(int r)
GLubyte GLubyte GLubyte GLubyte w
bool IsOrthonormal(const float epsilon=MATRIX_EPSILON) const
void LDLT_Solve(idVecX &x, const idVecX &b) const
void LU_UnpackFactors(idMatX &L, idMatX &U) const
idMat5 mat5_zero(idVec5(0, 0, 0, 0, 0), idVec5(0, 0, 0, 0, 0), idVec5(0, 0, 0, 0, 0), idVec5(0, 0, 0, 0, 0), idVec5(0, 0, 0, 0, 0))
void HouseholderReduction(idVecX &diag, idVecX &subd)
idMatX & SwapColumns(int r1, int r2)
void LDLT_Inverse(idMatX &inv) const
static float Fabs(float f)
static const float SQRT_1OVER2
idMat5 Transpose(void) const
bool LDLT_UpdateDecrement(const idVecX &v, int r)
bool IsSymmetricPositiveDefinite(const float epsilon=MATRIX_EPSILON) const
const float * ToFloatPtr(void) const
void SVD_BiDiag(idVecX &w, idVecX &rv1, float &anorm)
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 Random(int seed, float l=0.0f, float u=1.0f)
void SVD_MultiplyFactors(idMatX &m, const idVecX &w, const idMatX &V) const
const char * ToString(int precision=2) const
bool InverseFastSelf(void)
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)
static float InvSqrt(float x)
GLubyte GLubyte GLubyte a
bool TriDiagonal_Solve(idVecX &x, const idVecX &b) const
bool Inverse_UpdateRowColumn(const idVecX &v, const idVecX &w, int r)
bool FixDegenerateNormal(void)
ID_INLINE void idSwap(type &a, type &b)
bool IsPositiveSemiDefinite(const float epsilon=MATRIX_EPSILON) const
GLsizei GLboolean transpose
const char * ToString(int precision=2) const
bool Cholesky_UpdateDecrement(const idVecX &v, int r)
const idVec3 & GetVec(void) const
bool InverseSelfGeneric(void)
void QR_MultiplyFactors(idMatX &m, const idVecX &c, const idVecX &d) const
int GetDimension(void) const
bool Cholesky_Factor(void)
GLdouble GLdouble GLdouble r
idMat2 mat2_identity(idVec2(1, 0), idVec2(0, 1))
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)
idMat3 & InertiaRotateSelf(const idMat3 &rotation)
idMat3 InertiaRotate(const idMat3 &rotation) const
const float * ToFloatPtr(void) const
void SVD_InitialWV(idVecX &w, idMatX &V, idVecX &rv1)
void SquareSubMatrix(const idMatX &m, int size)
idQuat ToQuat(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
void SetData(int rows, int columns, float *data)
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 QL(idVecX &diag, idVecX &subd)
void SetData(int length, float *data)
bool UpperTriangularInverse(void)
idRotation ToRotation(void) const
bool InverseFastSelf(void)
idMat5 mat5_identity(idVec5(1, 0, 0, 0, 0), idVec5(0, 1, 0, 0, 0), idVec5(0, 0, 1, 0, 0), idVec5(0, 0, 0, 1, 0), idVec5(0, 0, 0, 0, 1))
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
idMat3 mat3_zero(idVec3(0, 0, 0), idVec3(0, 0, 0), idVec3(0, 0, 0))
idMat4 mat4_identity(idVec4(1, 0, 0, 0), idVec4(0, 1, 0, 0), idVec4(0, 0, 1, 0), idVec4(0, 0, 0, 1))
void QR_Inverse(idMatX &inv, const idVecX &c, const idVecX &d) const
idMat6 & TransposeSelf(void)
bool Eigen_Solve(idVecX &realEigenValues, idVecX &imaginaryEigenValues)
bool InverseFastSelf(void)
bool LowerTriangularInverse(void)
float Determinant(void) const
bool LDLT_UpdateRowColumn(const idVecX &v, int r)
bool IsOrthogonal(const float epsilon=MATRIX_EPSILON) const
static float ACos(float a)
idMat3 & InertiaTranslateSelf(const float mass, const idVec3 ¢erOfMass, const idVec3 &translation)
void Eigen_SortIncreasing(idVecX &eigenValues)
const float * ToFloatPtr(void) 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
const float * ToFloatPtr(void) const
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
ID_INLINE T Min(T x, T y)
bool IsZMatrix(const float epsilon=MATRIX_EPSILON) const
float Pythag(float a, float b) const
idMat2 mat2_zero(idVec2(0, 0), idVec2(0, 0))
void Diag(const idVecX &v)
bool LU_UpdateDecrement(const idVecX &v, const idVecX &w, const idVecX &u, int r, int *index)
#define MATRIX_INVERSE_EPSILON
bool Compare(const idMatX &a) const
static class idCommon * common
float Determinant(void) const
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble w1