Skip to content

Commit 7c56855

Browse files
committed
Added a spin module, does what the transformation with the same name in Blender does
1 parent 88bf287 commit 7c56855

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

utilities.scad

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ function angle(v) = angleOfNormalizedVector(normalized(v));
2323

2424
function angleBetweenTwoPoints(a, b) = angle(normalized(b-a));
2525

26+
// TODO check that the axis parameter works as intended
27+
// Duplicate everything $no of times around an $axis, for $angle/360 rounds
28+
module spin(no, angle=360, axis=[0, 0, 1]){
29+
for (i = [0:no]){
30+
rotate(normalized(axis)*angle*i/no) union(){
31+
for (i = [0 : $children-1]) child(i);
32+
}
33+
}
34+
}
35+
2636

2737
CENTER = 0;
2838
LEFT = -0.5;

0 commit comments

Comments
 (0)