From 920509c3f1cc04e331d4d50259e10fcd4bb2ea39 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 10 Mar 2022 20:40:06 +0800 Subject: [PATCH] add test --- src/polyhedron_hull.scad | 7 ++++++- test/test_all.scad | 1 + test/test_polyhedron_hull.scad | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/test_polyhedron_hull.scad diff --git a/src/polyhedron_hull.scad b/src/polyhedron_hull.scad index 6e5690d7..a22702ba 100644 --- a/src/polyhedron_hull.scad +++ b/src/polyhedron_hull.scad @@ -19,6 +19,11 @@ module polyhedron_hull(points, polyhedron_abuse = false) { } else { vts_faces = _convex_hull3(points); - polyhedron(vts_faces[0], vts_faces[1]); + polyhedron(vts_faces[0], vts_faces[1]); + test_convex_hull3(vts_faces); } +} + +module test_convex_hull3(vts_faces) { + } \ No newline at end of file diff --git a/test/test_all.scad b/test/test_all.scad index bf31ead8..3c0fdc9c 100644 --- a/test/test_all.scad +++ b/test/test_all.scad @@ -8,6 +8,7 @@ include ; include ; include ; include ; +include ; // Transformation include ; diff --git a/test/test_polyhedron_hull.scad b/test/test_polyhedron_hull.scad new file mode 100644 index 00000000..a23f3e81 --- /dev/null +++ b/test/test_polyhedron_hull.scad @@ -0,0 +1,21 @@ +include ; + +module test_polyhedron_hull() { + echo("==== test_polyhedron_hull ===="); + polyhedron_hull([ + [1, 1, 1], + [1, 1, 0], + [-1, 1, 0], + [-1, -1, 0], + [1, -1, 0], + [0, 0, 1], + [0, 0, -1] + ]); +} + + +module test_convex_hull3(vts_faces) { + assert(vts_faces == [[[-1, -1, 0], [-1, 1, 0], [0, 0, -1], [0, 0, 1], [1, -1, 0], [1, 1, 0], [1, 1, 1]], [[2, 1, 0], [3, 0, 1], [4, 2, 0], [4, 0, 3], [5, 1, 2], [5, 2, 4], [6, 3, 1], [6, 1, 5], [6, 4, 3], [6, 5, 4]]]); +} + +test_polyhedron_hull(); \ No newline at end of file