From cb03a1437be7341b28425c8c63e40d74cdc42ee4 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 5 May 2022 08:41:27 +0800 Subject: [PATCH] add test --- test/matrix/test_m_rotation.scad | 21 +++++++++++++++++++++ test/test_all.scad | 1 + 2 files changed, 22 insertions(+) create mode 100644 test/matrix/test_m_rotation.scad diff --git a/test/matrix/test_m_rotation.scad b/test/matrix/test_m_rotation.scad new file mode 100644 index 00000000..6a63a308 --- /dev/null +++ b/test/matrix/test_m_rotation.scad @@ -0,0 +1,21 @@ +use ; +use ; + +module test_m_rotation() { + echo("==== test_m_rotation ===="); + + a = [0, -45, 45]; + + expected = [[0.5, -0.707107, -0.5, 0], [0.5, 0.707107, -0.5, 0], [0.707107, 0, 0.707107, 0], [0, 0, 0, 1]]; + actual = m_rotation(a); + assertEqualPoints(expected, actual, 0.0005); + + v = [10, 10, 10]; + + expected2 = [[0.804738, -0.310617, 0.505879, 0], [0.505879, 0.804738, -0.310617, 0], [-0.310617, 0.505879, 0.804738, 0], [0, 0, 0, 1]]; + actual2 = m_rotation(a = 45, v = v); + + assertEqualPoints(expected2, actual2, 0.0005); +} + +test_m_rotation(); \ No newline at end of file diff --git a/test/test_all.scad b/test/test_all.scad index c6c5b5bd..d43d66d9 100644 --- a/test/test_all.scad +++ b/test/test_all.scad @@ -100,6 +100,7 @@ include ; include ; include ; include ; +include ; // Voronoi include ;