Merge pull request #43 from rockstorm101/fix-reg-polygon
regular_shapes: Avoid the circle trick
This commit is contained in:
commit
cd134456c1
|
@ -33,7 +33,11 @@ module reg_polygon(sides,radius)
|
||||||
if(sides<2) square([radius,0]);
|
if(sides<2) square([radius,0]);
|
||||||
if(sides==3) triangle(radius);
|
if(sides==3) triangle(radius);
|
||||||
if(sides==4) square([dia(radius),dia(radius)],center=true);
|
if(sides==4) square([dia(radius),dia(radius)],center=true);
|
||||||
if(sides>4) circle(r=radius,$fn=sides);
|
if(sides>4) {
|
||||||
|
angles=[ for (i = [0:sides-1]) i*(360/sides) ];
|
||||||
|
coords=[ for (th=angles) [radius*cos(th), radius*sin(th)] ];
|
||||||
|
polygon(coords);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module pentagon(radius)
|
module pentagon(radius)
|
||||||
|
|
Loading…
Reference in a new issue