MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / testInvert

Function testInvert

src/ImathTest/testInvert.cpp:56–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54} // namespace
55
56void
57testInvert ()
58{
59 cout << "Testing 4x4 and 3x3 matrix inversion:" << endl;
60
61 {
62 cout << "M44f" << endl;
63
64 // clang-format off
65
66 M44f m1 ( 1, 0, 0, 0,
67 0, 1, 0, 0,
68 0, 0, 1, 0,
69 0, 0, 0, 1);
70
71 M44f m2 ( 0, 1, 0, 0,
72 -1, 0, 0, 0,
73 0, 0, 1, 0,
74 0, 0, 0, 1);
75
76 M44f m3 ( 1, 0, 0, 0,
77 0, 2, 0, 0,
78 0, 0, 0, -1,
79 0, 0, 1, 0);
80
81 M44f m4 ( 4.683281e-01f, -8.749647e-01f, 1.229049e-01f, 0.000000e+00f,
82 1.251189e-02f, 1.456563e-01f, 9.892561e-01f, 0.000000e+00f,
83 -8.834660e-01f, -4.617587e-01f, 7.916244e-02f, 0.000000e+00f,
84 -4.726541e+00f, 3.044795e+00f, -6.737138e+00f, 1.000000e+00f);
85
86 M44f m5 ( 4.683281e-01f, -8.749647e-01f, 1.229049e-01f, 1.000000e+00f,
87 1.251189e-02f, 1.456563e-01f, 9.892561e-01f, 2.000000e+00f,
88 -8.834660e-01f, -4.617587e-01f, 7.916244e-02f, 3.000000e+00f,
89 -4.726541e+00f, 3.044795e+00f, -6.737138e+00f, 4.000000e+00f);
90
91 // clang-format on
92
93 invertM44f (m1, 0);
94 invertM44f (m2, 0);
95 invertM44f (m3, 0);
96 invertM44f (m4, 1e-6f);
97 invertM44f (m5, 1e-6f);
98 }
99
100 {
101 cout << "M33f" << endl;
102
103 // clang-format off
104
105 M33f m1 ( 1, 0, 0,
106 0, 1, 0,
107 0, 0, 1);
108
109 M33f m2 ( 0, 1, 0,
110 -1, 0, 0,
111 0, 0, 1);
112
113 M33f m3 ( 2, 0, 0,

Callers

nothing calls this directly

Calls 2

invertM44fFunction · 0.85
invertM33fFunction · 0.85

Tested by

no test coverage detected