mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Changed close argument of stroke() to closed.
This commit is contained in:
parent
1020d1d659
commit
3eb39d0018
5 changed files with 40 additions and 40 deletions
|
@ -22,7 +22,7 @@ outlinecolor="black";
|
||||||
|
|
||||||
module showit(label, rgn, poly=polycolor, outline=outlinecolor, width=0.5) {
|
module showit(label, rgn, poly=polycolor, outline=outlinecolor, width=0.5) {
|
||||||
move([-50,-50]) {
|
move([-50,-50]) {
|
||||||
if(outline) color(outline) linear_extrude(height=max(0.1,1-width)) for(path=rgn) stroke(path, width=width, close=true);
|
if(outline) color(outline) linear_extrude(height=max(0.1,1-width)) for(path=rgn) stroke(path, width=width, closed=true);
|
||||||
if(poly) color(poly) linear_extrude(height=0.1) region(rgn);
|
if(poly) color(poly) linear_extrude(height=0.1) region(rgn);
|
||||||
color("black") right(50) fwd(7) linear_extrude(height=0.1) text(text=label, size=8, halign="center", valign="center");
|
color("black") right(50) fwd(7) linear_extrude(height=0.1) text(text=label, size=8, halign="center", valign="center");
|
||||||
}
|
}
|
||||||
|
|
|
@ -789,39 +789,39 @@ function _offset_region(
|
||||||
// %down(.1)polygon(test);
|
// %down(.1)polygon(test);
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// star = star(5, r=100, ir=30);
|
// star = star(5, r=100, ir=30);
|
||||||
// #stroke(close=true, star);
|
// #stroke(closed=true, star);
|
||||||
// stroke(close=true, offset(star, delta=-10, closed=true));
|
// stroke(closed=true, offset(star, delta=-10, closed=true));
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// star = star(5, r=100, ir=30);
|
// star = star(5, r=100, ir=30);
|
||||||
// #stroke(close=true, star);
|
// #stroke(closed=true, star);
|
||||||
// stroke(close=true, offset(star, delta=-10, chamfer=true, closed=true));
|
// stroke(closed=true, offset(star, delta=-10, chamfer=true, closed=true));
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// star = star(5, r=100, ir=30);
|
// star = star(5, r=100, ir=30);
|
||||||
// #stroke(close=true, star);
|
// #stroke(closed=true, star);
|
||||||
// stroke(close=true, offset(star, r=-10, closed=true));
|
// stroke(closed=true, offset(star, r=-10, closed=true));
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// star = star(5, r=100, ir=30);
|
// star = star(5, r=100, ir=30);
|
||||||
// #stroke(close=true, star);
|
// #stroke(closed=true, star);
|
||||||
// stroke(close=true, offset(star, delta=10, closed=true));
|
// stroke(closed=true, offset(star, delta=10, closed=true));
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// star = star(5, r=100, ir=30);
|
// star = star(5, r=100, ir=30);
|
||||||
// #stroke(close=true, star);
|
// #stroke(closed=true, star);
|
||||||
// stroke(close=true, offset(star, delta=-10, chamfer=true, closed=true));
|
// stroke(closed=true, offset(star, delta=-10, chamfer=true, closed=true));
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// star = star(5, r=100, ir=30);
|
// star = star(5, r=100, ir=30);
|
||||||
// #stroke(close=true, star);
|
// #stroke(closed=true, star);
|
||||||
// stroke(close=true, offset(star, r=10, closed=true));
|
// stroke(closed=true, offset(star, r=10, closed=true));
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// ellipse = scale([1,0.3,1], p=circle(r=100));
|
// ellipse = scale([1,0.3,1], p=circle(r=100));
|
||||||
// #stroke(close=true, ellipse);
|
// #stroke(closed=true, ellipse);
|
||||||
// stroke(close=true, offset(ellipse, r=-15, check_valid=true, closed=true));
|
// stroke(closed=true, offset(ellipse, r=-15, check_valid=true, closed=true));
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// sinpath = 2*[for(theta=[-180:5:180]) [theta/4,45*sin(theta)]];
|
// sinpath = 2*[for(theta=[-180:5:180]) [theta/4,45*sin(theta)]];
|
||||||
// #stroke(sinpath);
|
// #stroke(sinpath);
|
||||||
// stroke(offset(sinpath, r=17.5));
|
// stroke(offset(sinpath, r=17.5));
|
||||||
// Example(2D): Region
|
// Example(2D): Region
|
||||||
// rgn = difference(circle(d=100), union(square([20,40], center=true), square([40,20], center=true)));
|
// rgn = difference(circle(d=100), union(square([20,40], center=true), square([40,20], center=true)));
|
||||||
// #linear_extrude(height=1.1) for (p=rgn) stroke(close=true, width=0.5, p);
|
// #linear_extrude(height=1.1) for (p=rgn) stroke(closed=true, width=0.5, p);
|
||||||
// region(offset(rgn, r=-5));
|
// region(offset(rgn, r=-5));
|
||||||
function offset(
|
function offset(
|
||||||
path, r=undef, delta=undef, chamfer=false,
|
path, r=undef, delta=undef, chamfer=false,
|
||||||
|
@ -1017,7 +1017,7 @@ function _tagged_region(region1,region2,keep1,keep2,eps=EPSILON) =
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// shape1 = move([-8,-8,0], p=circle(d=50));
|
// shape1 = move([-8,-8,0], p=circle(d=50));
|
||||||
// shape2 = move([ 8, 8,0], p=circle(d=50));
|
// shape2 = move([ 8, 8,0], p=circle(d=50));
|
||||||
// for (shape = [shape1,shape2]) color("red") stroke(shape, width=0.5, close=true);
|
// for (shape = [shape1,shape2]) color("red") stroke(shape, width=0.5, closed=true);
|
||||||
// color("green") region(union(shape1,shape2));
|
// color("green") region(union(shape1,shape2));
|
||||||
function union(regions=[],b=undef,c=undef,eps=EPSILON) =
|
function union(regions=[],b=undef,c=undef,eps=EPSILON) =
|
||||||
b!=undef? union(concat([regions],[b],c==undef?[]:[c]), eps=eps) :
|
b!=undef? union(concat([regions],[b],c==undef?[]:[c]), eps=eps) :
|
||||||
|
@ -1048,7 +1048,7 @@ function union(regions=[],b=undef,c=undef,eps=EPSILON) =
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// shape1 = move([-8,-8,0], p=circle(d=50));
|
// shape1 = move([-8,-8,0], p=circle(d=50));
|
||||||
// shape2 = move([ 8, 8,0], p=circle(d=50));
|
// shape2 = move([ 8, 8,0], p=circle(d=50));
|
||||||
// for (shape = [shape1,shape2]) color("red") stroke(shape, width=0.5, close=true);
|
// for (shape = [shape1,shape2]) color("red") stroke(shape, width=0.5, closed=true);
|
||||||
// color("green") region(difference(shape1,shape2));
|
// color("green") region(difference(shape1,shape2));
|
||||||
function difference(regions=[],b=undef,c=undef,eps=EPSILON) =
|
function difference(regions=[],b=undef,c=undef,eps=EPSILON) =
|
||||||
b!=undef? difference(concat([regions],[b],c==undef?[]:[c]), eps=eps) :
|
b!=undef? difference(concat([regions],[b],c==undef?[]:[c]), eps=eps) :
|
||||||
|
@ -1078,7 +1078,7 @@ function difference(regions=[],b=undef,c=undef,eps=EPSILON) =
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// shape1 = move([-8,-8,0], p=circle(d=50));
|
// shape1 = move([-8,-8,0], p=circle(d=50));
|
||||||
// shape2 = move([ 8, 8,0], p=circle(d=50));
|
// shape2 = move([ 8, 8,0], p=circle(d=50));
|
||||||
// for (shape = [shape1,shape2]) color("red") stroke(shape, width=0.5, close=true);
|
// for (shape = [shape1,shape2]) color("red") stroke(shape, width=0.5, closed=true);
|
||||||
// color("green") region(intersection(shape1,shape2));
|
// color("green") region(intersection(shape1,shape2));
|
||||||
function intersection(regions=[],b=undef,c=undef,eps=EPSILON) =
|
function intersection(regions=[],b=undef,c=undef,eps=EPSILON) =
|
||||||
b!=undef? intersection(concat([regions],[b],c==undef?[]:[c]),eps=eps) :
|
b!=undef? intersection(concat([regions],[b],c==undef?[]:[c]),eps=eps) :
|
||||||
|
@ -1109,7 +1109,7 @@ function intersection(regions=[],b=undef,c=undef,eps=EPSILON) =
|
||||||
// shape1 = move([-8,-8,0], p=circle(d=50));
|
// shape1 = move([-8,-8,0], p=circle(d=50));
|
||||||
// shape2 = move([ 8, 8,0], p=circle(d=50));
|
// shape2 = move([ 8, 8,0], p=circle(d=50));
|
||||||
// for (shape = [shape1,shape2])
|
// for (shape = [shape1,shape2])
|
||||||
// color("red") stroke(shape, width=0.5, close=true);
|
// color("red") stroke(shape, width=0.5, closed=true);
|
||||||
// color("green") region(exclusive_or(shape1,shape2));
|
// color("green") region(exclusive_or(shape1,shape2));
|
||||||
// Example(2D): As Module
|
// Example(2D): As Module
|
||||||
// exclusive_or() {
|
// exclusive_or() {
|
||||||
|
|
10
paths.scad
10
paths.scad
|
@ -464,19 +464,19 @@ module debug_polygon(points, paths=undef, convexity=2, size=1)
|
||||||
// color("red") path_spread(spiral, n=100) circle(r=1);
|
// color("red") path_spread(spiral, n=100) circle(r=1);
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// circle = regular_ngon(n=64, or=10);
|
// circle = regular_ngon(n=64, or=10);
|
||||||
// stroke(circle,width=1,close=true);
|
// stroke(circle,width=1,closed=true);
|
||||||
// color("green")path_spread(circle, n=7, closed=true) circle(r=1+$idx/3);
|
// color("green")path_spread(circle, n=7, closed=true) circle(r=1+$idx/3);
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// heptagon = regular_ngon(n=7, or=10);
|
// heptagon = regular_ngon(n=7, or=10);
|
||||||
// stroke(heptagon, width=1, close=true);
|
// stroke(heptagon, width=1, closed=true);
|
||||||
// color("purple") path_spread(heptagon, n=9, closed=true) square([0.5,3],anchor=FRONT);
|
// color("purple") path_spread(heptagon, n=9, closed=true) square([0.5,3],anchor=FRONT);
|
||||||
// Example(2D): Direction at the corners is the average of the two adjacent edges
|
// Example(2D): Direction at the corners is the average of the two adjacent edges
|
||||||
// heptagon = regular_ngon(n=7, or=10);
|
// heptagon = regular_ngon(n=7, or=10);
|
||||||
// stroke(heptagon, width=1, close=true);
|
// stroke(heptagon, width=1, closed=true);
|
||||||
// color("purple") path_spread(heptagon, n=7, closed=true) square([0.5,3],anchor=FRONT);
|
// color("purple") path_spread(heptagon, n=7, closed=true) square([0.5,3],anchor=FRONT);
|
||||||
// Example(2D): Don't rotate the children
|
// Example(2D): Don't rotate the children
|
||||||
// heptagon = regular_ngon(n=7, or=10);
|
// heptagon = regular_ngon(n=7, or=10);
|
||||||
// stroke(heptagon, width=1, close=true);
|
// stroke(heptagon, width=1, closed=true);
|
||||||
// color("red") path_spread(heptagon, n=9, closed=true, rotate_children=false) square([0.5,3],anchor=FRONT);
|
// color("red") path_spread(heptagon, n=9, closed=true, rotate_children=false) square([0.5,3],anchor=FRONT);
|
||||||
// Example(2D): Open path, specify `n`
|
// Example(2D): Open path, specify `n`
|
||||||
// sinwav = [for(theta=[0:360]) 5*[theta/180, sin(theta)]];
|
// sinwav = [for(theta=[0:360]) 5*[theta/180, sin(theta)]];
|
||||||
|
@ -488,7 +488,7 @@ module debug_polygon(points, paths=undef, convexity=2, size=1)
|
||||||
// color("red")path_spread(sinwav, n=5, spacing=1) square([.2,1.5],anchor=FRONT);
|
// color("red")path_spread(sinwav, n=5, spacing=1) square([.2,1.5],anchor=FRONT);
|
||||||
// Example(2D)): Closed path, specify `n` and `spacing`, copies centered around circle[0]
|
// Example(2D)): Closed path, specify `n` and `spacing`, copies centered around circle[0]
|
||||||
// circle = regular_ngon(n=64,or=10);
|
// circle = regular_ngon(n=64,or=10);
|
||||||
// stroke(circle,width=.1,close=true);
|
// stroke(circle,width=.1,closed=true);
|
||||||
// color("red")path_spread(circle, n=10, spacing=1, closed=true) square([.2,1.5],anchor=FRONT);
|
// color("red")path_spread(circle, n=10, spacing=1, closed=true) square([.2,1.5],anchor=FRONT);
|
||||||
// Example(2D): Open path, specify `spacing`
|
// Example(2D): Open path, specify `spacing`
|
||||||
// sinwav = [for(theta=[0:360]) 5*[theta/180, sin(theta)]];
|
// sinwav = [for(theta=[0:360]) 5*[theta/180, sin(theta)]];
|
||||||
|
|
|
@ -12,14 +12,14 @@
|
||||||
|
|
||||||
// Module: stroke()
|
// Module: stroke()
|
||||||
// Usage:
|
// Usage:
|
||||||
// stroke(path, width, [endcap], [close]);
|
// stroke(path, width, [endcap], [closed]);
|
||||||
// Description:
|
// Description:
|
||||||
// Draws a 2D line path with a given line thickness.
|
// Draws a 2D line path with a given line thickness.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// path = The 2D path to draw along.
|
// path = The 2D path to draw along.
|
||||||
// width = The width of the line to draw.
|
// width = The width of the line to draw.
|
||||||
// endcaps = If true, draw round endcaps at the ends of the line.
|
// endcaps = If true, draw round endcaps at the ends of the line.
|
||||||
// close = If true, draw an additional line from the end of the path to the start.
|
// closed = If true, draw an additional line from the end of the path to the start.
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// path = [[0,100], [100,100], [200,0], [100,-100], [100,0]];
|
// path = [[0,100], [100,100], [200,0], [100,-100], [100,0]];
|
||||||
// stroke(path, width=10, endcaps=false);
|
// stroke(path, width=10, endcaps=false);
|
||||||
|
@ -28,11 +28,11 @@
|
||||||
// stroke(path, width=20, endcaps=true);
|
// stroke(path, width=20, endcaps=true);
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// path = [[0,100], [100,100], [200,0], [100,-100], [100,0]];
|
// path = [[0,100], [100,100], [200,0], [100,-100], [100,0]];
|
||||||
// stroke(path, width=20, endcaps=true, close=true);
|
// stroke(path, width=20, endcaps=true, closed=true);
|
||||||
module stroke(path, width=1, endcaps=true, close=false)
|
module stroke(path, width=1, endcaps=true, closed=false)
|
||||||
{
|
{
|
||||||
$fn = quantup(segs(width/2),4);
|
$fn = quantup(segs(width/2),4);
|
||||||
path = close? concat(path,[path[0]]) : path;
|
path = closed? concat(path,[path[0]]) : path;
|
||||||
assert(is_list(path) && is_vector(path[0]) && len(path[0])==2, "path must be a 2D list of points.");
|
assert(is_list(path) && is_vector(path[0]) && len(path[0])==2, "path must be a 2D list of points.");
|
||||||
segments = pair(path);
|
segments = pair(path);
|
||||||
segpairs = pair(segments);
|
segpairs = pair(segments);
|
||||||
|
@ -122,7 +122,7 @@ module stroke(path, width=1, endcaps=true, close=false)
|
||||||
// arc(points=[[5,30],[-10,-10],[30,5]], wedge=true);
|
// arc(points=[[5,30],[-10,-10],[30,5]], wedge=true);
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// path = arc(points=[[5,30],[-10,-10],[30,5]], wedge=true);
|
// path = arc(points=[[5,30],[-10,-10],[30,5]], wedge=true);
|
||||||
// stroke(close=true, path);
|
// stroke(closed=true, path);
|
||||||
// Example(FlatSpin):
|
// Example(FlatSpin):
|
||||||
// include <BOSL2/paths.scad>
|
// include <BOSL2/paths.scad>
|
||||||
// path = arc(points=[[0,30,0],[0,0,30],[30,0,0]]);
|
// path = arc(points=[[0,30,0],[0,0,30],[30,0,0]]);
|
||||||
|
@ -217,7 +217,7 @@ function _normal_segment(p1,p2) =
|
||||||
// trapezoid(h=25, w1=20, w2=35);
|
// trapezoid(h=25, w1=20, w2=35);
|
||||||
// trapezoid(h=20, w1=40, w2=0);
|
// trapezoid(h=20, w1=40, w2=0);
|
||||||
// Example(2D): Called as Function
|
// Example(2D): Called as Function
|
||||||
// stroke(close=true, trapezoid(h=30, w1=40, w2=20));
|
// stroke(closed=true, trapezoid(h=30, w1=40, w2=20));
|
||||||
function trapezoid(h, w1, w2, anchor=CENTER, spin=0) =
|
function trapezoid(h, w1, w2, anchor=CENTER, spin=0) =
|
||||||
let(
|
let(
|
||||||
s = anchor.y>0? [w2,h] : anchor.y<0? [w1,h] : [(w1+w2)/2,h],
|
s = anchor.y>0? [w2,h] : anchor.y<0? [w1,h] : [(w1+w2)/2,h],
|
||||||
|
@ -259,7 +259,7 @@ module trapezoid(h, w1, w2, anchor=CENTER, spin=0)
|
||||||
// Example(2D): Realigned
|
// Example(2D): Realigned
|
||||||
// regular_ngon(n=8, side=20, realign=true);
|
// regular_ngon(n=8, side=20, realign=true);
|
||||||
// Example(2D): Called as Function
|
// Example(2D): Called as Function
|
||||||
// stroke(close=true, regular_ngon(n=6, or=30));
|
// stroke(closed=true, regular_ngon(n=6, or=30));
|
||||||
function regular_ngon(n=6, or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false, anchor=CENTER, spin=0) =
|
function regular_ngon(n=6, or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false, anchor=CENTER, spin=0) =
|
||||||
let(
|
let(
|
||||||
sc = 1/cos(180/n),
|
sc = 1/cos(180/n),
|
||||||
|
@ -301,7 +301,7 @@ module regular_ngon(n=6, or=undef, od=undef, ir=undef, id=undef, side=undef, rea
|
||||||
// Example(2D): Realigned
|
// Example(2D): Realigned
|
||||||
// pentagon(side=20, realign=true);
|
// pentagon(side=20, realign=true);
|
||||||
// Example(2D): Called as Function
|
// Example(2D): Called as Function
|
||||||
// stroke(close=true, pentagon(or=30));
|
// stroke(closed=true, pentagon(or=30));
|
||||||
function pentagon(or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false, anchor=CENTER, spin=0) =
|
function pentagon(or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false, anchor=CENTER, spin=0) =
|
||||||
regular_ngon(n=5, or=or, od=od, ir=ir, id=id, side=side, realign=realign, anchor=anchor, spin=spin);
|
regular_ngon(n=5, or=or, od=od, ir=ir, id=id, side=side, realign=realign, anchor=anchor, spin=spin);
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ module pentagon(or=undef, od=undef, ir=undef, id=undef, side=undef, realign=fals
|
||||||
// Example(2D): Realigned
|
// Example(2D): Realigned
|
||||||
// hexagon(side=20, realign=true);
|
// hexagon(side=20, realign=true);
|
||||||
// Example(2D): Called as Function
|
// Example(2D): Called as Function
|
||||||
// stroke(close=true, hexagon(or=30));
|
// stroke(closed=true, hexagon(or=30));
|
||||||
function hexagon(or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false, anchor=CENTER, spin=0) =
|
function hexagon(or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false, anchor=CENTER, spin=0) =
|
||||||
regular_ngon(n=6, or=or, od=od, ir=ir, id=id, side=side, realign=realign, anchor=anchor, spin=spin);
|
regular_ngon(n=6, or=or, od=od, ir=ir, id=id, side=side, realign=realign, anchor=anchor, spin=spin);
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ module hexagon(or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false
|
||||||
// Example(2D): Realigned
|
// Example(2D): Realigned
|
||||||
// octagon(side=20, realign=true);
|
// octagon(side=20, realign=true);
|
||||||
// Example(2D): Called as Function
|
// Example(2D): Called as Function
|
||||||
// stroke(close=true, octagon(or=30));
|
// stroke(closed=true, octagon(or=30));
|
||||||
function octagon(or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false, anchor=CENTER, spin=0) =
|
function octagon(or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false, anchor=CENTER, spin=0) =
|
||||||
regular_ngon(n=8, or=or, od=od, ir=ir, id=id, side=side, realign=realign, anchor=anchor, spin=spin);
|
regular_ngon(n=8, or=or, od=od, ir=ir, id=id, side=side, realign=realign, anchor=anchor, spin=spin);
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ module octagon(or=undef, od=undef, ir=undef, id=undef, side=undef, realign=false
|
||||||
// glued_circles(d=30, spread=30, tangent=15);
|
// glued_circles(d=30, spread=30, tangent=15);
|
||||||
// glued_circles(d=30, spread=30, tangent=-30);
|
// glued_circles(d=30, spread=30, tangent=-30);
|
||||||
// Example(2D): Called as Function
|
// Example(2D): Called as Function
|
||||||
// stroke(close=true, glued_circles(r=15, spread=40, tangent=45));
|
// stroke(closed=true, glued_circles(r=15, spread=40, tangent=45));
|
||||||
function glued_circles(r=undef, d=undef, spread=10, tangent=30, anchor=CENTER, spin=0) =
|
function glued_circles(r=undef, d=undef, spread=10, tangent=30, anchor=CENTER, spin=0) =
|
||||||
let(
|
let(
|
||||||
r = get_radius(r=r, d=d, dflt=10),
|
r = get_radius(r=r, d=d, dflt=10),
|
||||||
|
@ -454,7 +454,7 @@ module glued_circles(r=undef, d=undef, spread=10, tangent=30, anchor=CENTER, spi
|
||||||
// Example(2D): Realigned
|
// Example(2D): Realigned
|
||||||
// star(n=7, r=50, step=3, realign=true);
|
// star(n=7, r=50, step=3, realign=true);
|
||||||
// Example(2D): Called as Function
|
// Example(2D): Called as Function
|
||||||
// stroke(close=true, star(n=5, r=50, ir=25));
|
// stroke(closed=true, star(n=5, r=50, ir=25));
|
||||||
function star(n, r, d, ir, id, step, realign=false, anchor=CENTER, spin=0) =
|
function star(n, r, d, ir, id, step, realign=false, anchor=CENTER, spin=0) =
|
||||||
let(
|
let(
|
||||||
r = get_radius(r=r, d=d),
|
r = get_radius(r=r, d=d),
|
||||||
|
@ -500,7 +500,7 @@ function _superformula(theta,m1,m2,n1,n2=1,n3=1,a=1,b=1) =
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// supershape(step=0.5,m1=16,m2=16,n1=0.5,n2=0.5,n3=16,r=50);
|
// supershape(step=0.5,m1=16,m2=16,n1=0.5,n2=0.5,n3=16,r=50);
|
||||||
// Example(2D): Called as Function
|
// Example(2D): Called as Function
|
||||||
// stroke(close=true, supershape(step=0.5,m1=16,m2=16,n1=0.5,n2=0.5,n3=16,d=100));
|
// stroke(closed=true, supershape(step=0.5,m1=16,m2=16,n1=0.5,n2=0.5,n3=16,d=100));
|
||||||
// Examples(2D,Med):
|
// Examples(2D,Med):
|
||||||
// for(n=[2:5]) right(2.5*(n-2)) supershape(m1=4,m2=4,n1=n,a=1,b=2); // Superellipses
|
// for(n=[2:5]) right(2.5*(n-2)) supershape(m1=4,m2=4,n1=n,a=1,b=2); // Superellipses
|
||||||
// m=[2,3,5,7]; for(i=[0:3]) right(2.5*i) supershape(.5,m1=m[i],n1=1);
|
// m=[2,3,5,7]; for(i=[0:3]) right(2.5*i) supershape(.5,m1=m[i],n1=1);
|
||||||
|
|
|
@ -2274,7 +2274,7 @@ module HSV(h,s=1,v=1,a=1) color(HSV(h,s,v),a) children();
|
||||||
// rainbow(["Foo","Bar","Baz"]) fwd($idx*10) text(text=$item,size=8,halign="center",valign="center");
|
// rainbow(["Foo","Bar","Baz"]) fwd($idx*10) text(text=$item,size=8,halign="center",valign="center");
|
||||||
// Example(2D):
|
// Example(2D):
|
||||||
// rgn = [circle(d=45,$fn=3), circle(d=75,$fn=4), circle(d=50)];
|
// rgn = [circle(d=45,$fn=3), circle(d=75,$fn=4), circle(d=50)];
|
||||||
// rainbow(rgn) stroke($item, close=true);
|
// rainbow(rgn) stroke($item, closed=true);
|
||||||
module rainbow(list)
|
module rainbow(list)
|
||||||
for($idx=[0:1:len(list)-1],$item=[list[$idx]])
|
for($idx=[0:1:len(list)-1],$item=[list[$idx]])
|
||||||
HSV(h=360*$idx/len(list))
|
HSV(h=360*$idx/len(list))
|
||||||
|
|
Loading…
Reference in a new issue