From 63dcbe259de8995d86968b3d6faa1c05f136235b Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 17 May 2019 17:54:28 +0800 Subject: [PATCH] added starburst --- src/starburst.scad | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/starburst.scad diff --git a/src/starburst.scad b/src/starburst.scad new file mode 100644 index 00000000..68ffe769 --- /dev/null +++ b/src/starburst.scad @@ -0,0 +1,32 @@ +module starburst(r1, r2, n, height) { + a = 180 / n; + + p0 = [0, 0, 0]; + p1 = [r2 * cos(a), r2 * sin(a), 0]; + p2 = [r1, 0, 0]; + p3 = [0, 0, height]; + + module half_burst() { + polyhedron(points = [p0, p1, p2, p3], + faces = [ + [0, 2, 1], + [0, 1, 3], + [0, 3, 2], + [2, 1, 3] + ] + ); + } + + module burst() { + hull() { + half_burst(); + mirror([0, 1,0]) half_burst(); + } + } + + union() { + for(i = [0 : n - 1]) { + rotate(2 * a * i) burst(); + } + } +} \ No newline at end of file