From 2a8ed855961981518f31fb7ef9ce300c1313ba36 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 25 Feb 2020 08:06:15 +0800 Subject: [PATCH] add convext_hull --- src/experimental/demo/convex_hull_demo.scad | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/experimental/demo/convex_hull_demo.scad diff --git a/src/experimental/demo/convex_hull_demo.scad b/src/experimental/demo/convex_hull_demo.scad new file mode 100644 index 00000000..d9a2f8f8 --- /dev/null +++ b/src/experimental/demo/convex_hull_demo.scad @@ -0,0 +1,14 @@ +use ; +use ; +use ; + +xs = rands(-20, 20, 150); +ys = rands(-20, 20, 150); +points = [for(i = [0:len(xs) - 1]) [xs[i], ys[i]]]; + +for(p = points) { + translate(p) + sphere(.5); +} +hull_shape = convex_hull(points); +#hull_polyline2d(concat(hull_shape, [hull_shape[0]]), width = 1); \ No newline at end of file