Merge pull request #378 from revarbat/revarbat_dev

reauleaux_polygon() fixes
This commit is contained in:
Revar Desmera 2021-01-12 00:12:19 -08:00 committed by GitHub
commit 1820d7d2b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View file

@ -3,7 +3,6 @@
// Helpers to make debugging OpenScad code easier. // Helpers to make debugging OpenScad code easier.
// Includes: // Includes:
// include <BOSL2/std.scad> // include <BOSL2/std.scad>
// include <BOSL2/debug.scad>
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////

View file

@ -1593,7 +1593,7 @@ module supershape(step=0.5,m1=4,m2=undef,n1,n2=undef,n3=undef,a=1,b=undef, r=und
// Function&Module: reuleaux_polygon() // Function&Module: reuleaux_polygon()
// Usage: As Module // Usage: As Module
// reuleaux_polygon(N, r|d); // reuleaux_polygon(N, r|d);
// Usage: As Module // Usage: As Function
// path = reuleaux_polygon(N, r|d); // path = reuleaux_polygon(N, r|d);
// Description: // Description:
// Creates a 2D Reuleaux Polygon; a constant width shape that is not circular. // Creates a 2D Reuleaux Polygon; a constant width shape that is not circular.
@ -1608,13 +1608,17 @@ module supershape(step=0.5,m1=4,m2=undef,n1,n2=undef,n3=undef,a=1,b=undef, r=und
// Examples(2D): // Examples(2D):
// reuleaux_polygon(N=3, r=50); // reuleaux_polygon(N=3, r=50);
// reuleaux_polygon(N=5, d=100); // reuleaux_polygon(N=5, d=100);
// Examples(2D): Standard vector anchors are based on extents
// reuleaux_polygon(N=3, d=50) show_anchors(custom=false);
// Examples(2D): Named anchors exist for the tips
// reuleaux_polygon(N=3, d=50) show_anchors(std=false);
module reuleaux_polygon(N=3, r, d, anchor=CENTER, spin=0) { module reuleaux_polygon(N=3, r, d, anchor=CENTER, spin=0) {
assert(N>=3 && (N%2)==1); assert(N>=3 && (N%2)==1);
r = get_radius(r=r, d=d, dflt=1); r = get_radius(r=r, d=d, dflt=1);
path = reuleaux_polygon(N=N, r=r); path = reuleaux_polygon(N=N, r=r);
anchors = [ anchors = [
for (i = [0:1:N-1]) let( for (i = [0:1:N-1]) let(
ca = 360 - (i+0.5) * 360/N, ca = 360 - i * 360/N,
cp = polar_to_xy(r, ca) cp = polar_to_xy(r, ca)
) anchorpt(str("tip",i), cp, unit(cp,BACK), 0), ) anchorpt(str("tip",i), cp, unit(cp,BACK), 0),
]; ];
@ -1641,7 +1645,7 @@ function reuleaux_polygon(N=3, r, d, anchor=CENTER, spin=0) =
], ],
anchors = [ anchors = [
for (i = [0:1:N-1]) let( for (i = [0:1:N-1]) let(
ca = 360 - (i+0.5) * 360/N, ca = 360 - i * 360/N,
cp = polar_to_xy(r, ca) cp = polar_to_xy(r, ca)
) anchorpt(str("tip",i), cp, unit(cp,BACK), 0), ) anchorpt(str("tip",i), cp, unit(cp,BACK), 0),
] ]

View file

@ -6,7 +6,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,523]; BOSL_VERSION = [2,0,525];
// Section: BOSL Library Version Functions // Section: BOSL Library Version Functions