Skip to content

Commit

Permalink
Update meshbuilder_Spiral.scad
Browse files Browse the repository at this point in the history
Now using pointsutils
  • Loading branch information
dinther authored Aug 29, 2023
1 parent 465d2e8 commit 4f334f5
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions demo/meshbuilder_Spiral.scad
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
use <pathbuilder.scad>
use <meshbuilder.scad>

$fn=128;

function rotate(x, y, z, angle) = let (
c = cos(angle),
s = sin(angle),
nx = (c * x) + (s * y),
ny = (c * y) - (s * x)) [nx, ny, z];
use <pointutils.scad>
$fn=32;

module spiral(shape, angle, step, pitch){
l = len(shape);
pl = [for(j=[l:-1:0]) let(k=(j==l? 0:j)) [for(i=[0:step:angle-1])
rotate( shape[k][0],shape[k][1], shape[k][2]+i*pitch/360, i)]];
rotatePoint( [shape[k][0],shape[k][1], shape[k][2]+i*pitch/360], i)]];
n = len(pl[0]);
// Manually add end caps
front_cap = [for(i=[0:l-1]) n*i];
Expand All @@ -22,7 +16,8 @@ module spiral(shape, angle, step, pitch){
}

points = svgPoints("m5,0 h1 a10,10,0,0,1,10,0h1,v-2 a12,12,0,0,0,-12,0")[0];

//echo(points);
//points = [[M]];
// swap y and z axis
shape = [for(pt = points) [pt[0],0,pt[1]]];

Expand Down

0 comments on commit 4f334f5

Please sign in to comment.