Skip to content

Commit

Permalink
star shape doen
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiaxin-S committed Apr 25, 2017
1 parent 64bf8bc commit 6a101df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions example.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include <index.scad>

translate([0,44]) Star(20, [6,10]);
translate([20,44]) Star(40, [6,8,8,6]);
translate([36,44]) Star(30, [3,4,5,6,5,4]);
6 changes: 6 additions & 0 deletions index.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Gear/star generator
// Uses a list comprehension taking a list of radii to generate a star shape
module Star(num, radii) {
function r(a) = (floor(a / 10) % 2) ? 10 : 8;
polygon([for (i=[0:num-1], a=i*360/num, r=radii[i%len(radii)]) [ r*cos(a), r*sin(a) ]]);
}

0 comments on commit 6a101df

Please sign in to comment.