From 49a68a9f8475018f211460f2ab0e9c8bb379ae62 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 22 Jul 2022 11:06:35 +0800 Subject: [PATCH] update examples --- src/experimental/arc_great_circle.scad | 122 ++++++++++++++----------- 1 file changed, 71 insertions(+), 51 deletions(-) diff --git a/src/experimental/arc_great_circle.scad b/src/experimental/arc_great_circle.scad index 84628df9..cb689a09 100644 --- a/src/experimental/arc_great_circle.scad +++ b/src/experimental/arc_great_circle.scad @@ -18,41 +18,8 @@ use use use -n = 10; -radius = 20; - -points = fibonacci_lattice(n, radius); -#for(p = points) { - translate(p) - sphere(.5); -} - -%sphere(radius); - -for(cell = vrn_sphere(points)) { - for(p = cell) { - translate(p) - sphere(1); - } - pts = concat(cell, [cell[0]]); - - for(i = [0:len(pts) - 2]) { - p1 = pts[i]; - p2 = pts[i + 1]; - arc = arc_great_circle(pts[i], pts[i + 1], $fn = 48); - polyline_join(arc) - sphere(.5, $fn = 4); - } -} -*/ - -/* -use -use -use - -use -use +use +use n = 8; radius = 20; @@ -65,22 +32,75 @@ points = fibonacci_lattice(n, radius); %sphere(radius); -shape = shape_circle(1.5, $fn = 36); +edges = [ + for(cell = vrn_sphere(points)) + for(i = [0:len(cell) - 2]) + [cell[i], cell[i + 1]] +]; -for(cell = vrn_sphere(points)) { - color("green") - for(p = cell) { - translate(p) - sphere(3, $fn = 48); - } - pts = concat(cell, [cell[0]]); - - - for(i = [0:len(pts) - 2]) { - p1 = pts[i]; - p2 = pts[i + 1]; - arc = arc_great_circle(pts[i], pts[i + 1], $fn = 96); - path_extrude(shape, arc); - } +deduped = dedup(edges, function(e1, e2) e1 == e2 || reverse(e1) == e2, function(e) 0, number_of_buckets = 1); + +for(edge = deduped) { + p1 = edge[0]; + p2 = edge[1]; + + color("green") { + translate(p1, $fn = 36) + sphere(3); + + translate(p2) + sphere(3, $fn = 36); + } + + polyline_join(arc_great_circle(p1, p2, $fn = 96)) + sphere(2, $fn = 4); +} +*/ + +/* +use +use +use + +use +use + +use +use + +n = 8; +radius = 20; + +points = fibonacci_lattice(n, radius); +#for(p = points) { + translate(p) + sphere(1); +} + +%sphere(radius); + +shape = shape_star(inner_radius = .5) * 2; + +edges = [ + for(cell = vrn_sphere(points)) + for(i = [0:len(cell) - 2]) + [cell[i], cell[i + 1]] +]; + +deduped = dedup(edges, function(e1, e2) e1 == e2 || reverse(e1) == e2, function(e) 0, number_of_buckets = 1); + +for(edge = deduped) { + p1 = edge[0]; + p2 = edge[1]; + + color("green") { + translate(p1, $fn = 36) + sphere(3); + + translate(p2) + sphere(3, $fn = 36); + } + + path_extrude(shape, arc_great_circle(p1, p2, $fn = 96)); } */ \ No newline at end of file