From 9f4ede7e29a5e651aba518bbfc40b196d91c0b4d Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 1 Jun 2021 06:43:33 +0800 Subject: [PATCH] add spiral_polygon_fidget --- .../spiral_polygon_fidget.scad | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 examples/spiral_polygons/spiral_polygon_fidget.scad diff --git a/examples/spiral_polygons/spiral_polygon_fidget.scad b/examples/spiral_polygons/spiral_polygon_fidget.scad new file mode 100644 index 00000000..2d12bc5c --- /dev/null +++ b/examples/spiral_polygons/spiral_polygon_fidget.scad @@ -0,0 +1,54 @@ +use ; +use ; + +beginning_radius = 7.5; +fn = 5; +number_of_polygons = 10; +height = 30; +thickness = 1.5; + +spiral_plate(beginning_radius, fn, number_of_polygons, height); + +module spiral_plate(beginning_radius, fn, n, height) { + theta = 180 / fn; + + y = beginning_radius - beginning_radius * cos(theta); + dr = y / cos(theta) + thickness * 1.5; + pw = pow((beginning_radius + dr) * sin(theta), 2); + + function a(ri, ro, i) = acos((pow(ro, 2) + pow(ri, 2) - pw * pow(0.985, i)) / (2 * ro * ri)); + + module drawPolygon(r) { + circle(r, $fn = fn); + } + + rs = [for(i = [0: n]) beginning_radius + i * dr]; + //as = [for(i = [1: n]) a(rs[i - 1], rs[i], i) / 2]; + + s = [for(i = [1: n]) (rs[i] * 1.2) / rs[i - 1]]; + + half_height = height / 2; + + module half() { + translate([0, 0, -half_height]) { + linear_extrude(half_height, scale = s[0]) + difference() { + drawPolygon(beginning_radius); + drawPolygon(beginning_radius - thickness); + } + + for(i = [1:n - 1]) { + //rotate(as[i] * 2) + linear_extrude(half_height, scale = s[i]) + difference() { + drawPolygon(rs[i]); + drawPolygon(rs[i] - thickness); + } + } + } + } + + half(); + mirror([0, 0, 1]) + half(); +} \ No newline at end of file