From 3774e25689d77986e7c5807644d42944ca3f43e2 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Wed, 16 Dec 2020 21:29:33 -0500 Subject: [PATCH] remove hull.scad, replaced with test_hull.scad --- tests/hull.scad | 73 ------------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 tests/hull.scad diff --git a/tests/hull.scad b/tests/hull.scad deleted file mode 100644 index 50366d2..0000000 --- a/tests/hull.scad +++ /dev/null @@ -1,73 +0,0 @@ -include <../std.scad> -include <../hull.scad> - - -testpoints_on_sphere = [ for(p = - [ - [1,PHI,0], [-1,PHI,0], [1,-PHI,0], [-1,-PHI,0], - [0,1,PHI], [0,-1,PHI], [0,1,-PHI], [0,-1,-PHI], - [PHI,0,1], [-PHI,0,1], [PHI,0,-1], [-PHI,0,-1] - ]) - unit(p) -]; - -testpoints_circular = [ for(a = [0:15:360-EPSILON]) [cos(a),sin(a)] ]; - -testpoints_coplanar = let(u = unit([1,3,7]), v = unit([-2,1,-2])) [ for(i = [1:10]) rands(-1,1,1)[0] * u + rands(-1,1,1)[0] * v ]; - -testpoints_collinear_2d = let(u = unit([5,3])) [ for(i = [1:20]) rands(-1,1,1)[0] * u ]; -testpoints_collinear_3d = let(u = unit([5,3,-5])) [ for(i = [1:20]) rands(-1,1,1)[0] * u ]; - -testpoints2d = 20 * [for (i = [1:10]) concat(rands(-1,1,2))]; -testpoints3d = 20 * [for (i = [1:50]) concat(rands(-1,1,3))]; - -// All points are on the sphere, no point should be red -translate([-50,0]) visualize_hull(20*testpoints_on_sphere); - -// 2D points -translate([50,0]) visualize_hull(testpoints2d); - -// All points on a circle, no point should be red -translate([0,50]) visualize_hull(20*testpoints_circular); - -// All points 3d but collinear -translate([0,-50]) visualize_hull(20*testpoints_coplanar); - -// Collinear -translate([50,50]) visualize_hull(20*testpoints_collinear_2d); - -// Collinear -translate([-50,50]) visualize_hull(20*testpoints_collinear_3d); - -// 3D points -visualize_hull(testpoints3d); - - -module visualize_hull(points) { - hull = hull(points); - - %if (len(hull) > 0 && is_list(hull[0]) && len(hull[0]) > 0) - polyhedron(points=points, faces = hull); - else - polyhedron(points=points, faces = [hull]); - - for (i = [0:len(points)-1]) { - p = points[i]; - $fn = 16; - translate(p) { - if (hull_contains_index(hull,i)) { - color("blue") sphere(1); - } else { - color("red") sphere(1); - } - } - } - - function hull_contains_index(hull, index) = - search(index,hull,1,0) || - search(index,hull,1,1) || - search(index,hull,1,2); -} - - -// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap