diff --git a/test/test_all.scad b/test/test_all.scad index 08e55a98..9213a1fb 100644 --- a/test/test_all.scad +++ b/test/test_all.scad @@ -11,6 +11,7 @@ include ; include ; include ; include ; +include ; // Function include ; diff --git a/test/test_hull_polyline3d.scad b/test/test_hull_polyline3d.scad new file mode 100644 index 00000000..95811be6 --- /dev/null +++ b/test/test_hull_polyline3d.scad @@ -0,0 +1,61 @@ +include ; + +module test_hull_polyline3d() { + echo("==== test_hull_polyline3d ===="); + + points = [ + [1, 2, 3], + [4, -5, -6], + [-1, -3, -5], + [0, 0, 0] + ]; + + thickness = 1; + + include ; + + module test_line_segment(index, point1, point2, radius) { + assertEqualPoint(points[index - 1], point1); + assertEqualPoint(points[index], point2); + assertEqual(thickness, radius * 2); + } + + hull_polyline3d( + points = points, + thickness = thickness, + $fn = 3 + ); +} + +module test_hull_polyline3d_helix() { + echo("==== test_hull_polyline3d_helix ===="); + + r = 50; + points = [ + for(a = [0:180]) + [ + r * cos(-90 + a) * cos(a), + r * cos(-90 + a) * sin(a), + r * sin(-90 + a) + ] + ]; + + thickness = 12; + + include ; + + module test_line_segment(index, point1, point2, radius) { + assertEqualPoint(points[index - 1], point1); + assertEqualPoint(points[index], point2); + assertEqual(thickness, radius * 2); + } + + for(i = [0:7]) { + rotate(45 * i) + hull_polyline3d(points, thickness, $fn = 3); + } + +} + +test_hull_polyline3d(); +test_hull_polyline3d_helix(); \ No newline at end of file