aboutsummaryrefslogtreecommitdiff
path: root/3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-05-22 01:08:24 -0700
committerrtk0c <[email protected]>2022-05-22 01:08:24 -0700
commitc568f0a8c9f0aef00c770b494ee1ff3a89ab48de (patch)
tree1dc1e69d796e635cdac6a4ef7e6d3a90ab1423c2 /3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp
parenta5db6bd3cc4af5233010ff44d0572ddf98b43c9d (diff)
Changeset: 35 Fix missing sources in git submodules after migration to PlasticSCM
Diffstat (limited to '3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp')
-rw-r--r--3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp b/3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp
new file mode 100644
index 0000000..eaec6e1
--- /dev/null
+++ b/3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp
@@ -0,0 +1,51 @@
+#include <glm/gtc/matrix_inverse.hpp>
+#include <glm/gtc/epsilon.hpp>
+
+int test_affine()
+{
+ int Error = 0;
+
+ {
+ glm::mat3 const M(
+ 2.f, 0.f, 0.f,
+ 0.f, 2.f, 0.f,
+ 0.f, 0.f, 1.f);
+ glm::mat3 const A = glm::affineInverse(M);
+ glm::mat3 const I = glm::inverse(M);
+ glm::mat3 const R = glm::affineInverse(A);
+
+ for(glm::length_t i = 0; i < A.length(); ++i)
+ {
+ Error += glm::all(glm::epsilonEqual(M[i], R[i], 0.01f)) ? 0 : 1;
+ Error += glm::all(glm::epsilonEqual(A[i], I[i], 0.01f)) ? 0 : 1;
+ }
+ }
+
+ {
+ glm::mat4 const M(
+ 2.f, 0.f, 0.f, 0.f,
+ 0.f, 2.f, 0.f, 0.f,
+ 0.f, 0.f, 2.f, 0.f,
+ 0.f, 0.f, 0.f, 1.f);
+ glm::mat4 const A = glm::affineInverse(M);
+ glm::mat4 const I = glm::inverse(M);
+ glm::mat4 const R = glm::affineInverse(A);
+
+ for(glm::length_t i = 0; i < A.length(); ++i)
+ {
+ Error += glm::all(glm::epsilonEqual(M[i], R[i], 0.01f)) ? 0 : 1;
+ Error += glm::all(glm::epsilonEqual(A[i], I[i], 0.01f)) ? 0 : 1;
+ }
+ }
+
+ return Error;
+}
+
+int main()
+{
+ int Error = 0;
+
+ Error += test_affine();
+
+ return Error;
+}