MCPcopy Create free account
hub / github.com/EricLengyel/Terathon-Math-Library / InverseUnitDet

Method InverseUnitDet

TSMatrix4D.cpp:1004–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1002}
1003
1004Transform3D Terathon::InverseUnitDet(const Transform3D& m)
1005{
1006 #ifdef TERATHON_SSE
1007
1008 Transform3D result;
1009
1010 vec_float a = VecLoad(&m(0,0));
1011 vec_float b = VecLoad(&m(0,1));
1012 vec_float c = VecLoad(&m(0,2));
1013 vec_float d = VecLoad(&m(0,3));
1014
1015 vec_float t0 = VecShuffle<1,0,1,0>(a, b);
1016 vec_float t1 = VecShuffle<1,0,1,0>(c, d);
1017 vec_float t2 = VecShuffle<3,2,3,2>(a, b);
1018 vec_float t3 = VecShuffle<3,2,3,2>(c, d);
1019
1020 vec_float r0 = VecShuffle<2,0,2,0>(t0, t1);
1021 vec_float r1 = VecShuffle<3,1,3,1>(t0, t1);
1022 vec_float r2 = VecShuffle<2,0,2,0>(t2, t3);
1023
1024 vec_float s = VecCross3D(r0, r1);
1025 vec_float h = r0 * VecSmearW(r1) - r1 * VecSmearW(r0);
1026
1027 VecStore(VecCross3D(r1, r2), &result(0,0));
1028 VecStore(VecCross3D(r2, r0), &result(0,1));
1029 VecStore(s, &result(0,2));
1030 VecStore(VecCross3D(h, r2) - s * VecSmearW(r2), &result(0,3));
1031
1032 result(3,0) = result(3,1) = result(3,2) = 0.0F;
1033 result(3,3) = 1.0F;
1034 return (result);
1035
1036 #else
1037
1038 const Vector3D& a = m[0];
1039 const Vector3D& b = m[1];
1040 const Vector3D& c = m[2];
1041 const Vector3D& d = m[3];
1042
1043 Bivector3D s = a ^ b;
1044 Bivector3D t = c ^ d;
1045
1046 return (Transform3D(b ^ c, -(b ^ t), c ^ a, a ^ t, s, -(d ^ s)));
1047
1048 #endif
1049}
1050
1051Matrix3D Terathon::InverseUnitDet3D(const Transform3D& m)
1052{

Callers

nothing calls this directly

Calls 5

VecLoadFunction · 0.85
VecCross3DFunction · 0.85
VecSmearWFunction · 0.85
VecStoreFunction · 0.85
Transform3DClass · 0.70

Tested by

no test coverage detected