mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-04 03:09:45 +00:00
Added asserts for regular_ngon().
This commit is contained in:
parent
8a29e9e86b
commit
7ea33cc724
2 changed files with 6 additions and 2 deletions
|
@ -609,7 +609,10 @@ function _turtle_command(command, parm, parm2, state, index) =
|
||||||
function regular_ngon(n=6, r, d, or, od, ir, id, side, rounding=0, realign=false, anchor=CENTER, spin=0) =
|
function regular_ngon(n=6, r, d, or, od, ir, id, side, rounding=0, realign=false, anchor=CENTER, spin=0) =
|
||||||
let(
|
let(
|
||||||
sc = 1/cos(180/n),
|
sc = 1/cos(180/n),
|
||||||
r = get_radius(r1=ir*sc, r2=or, r=r, d1=id*sc, d2=od, d=d, dflt=side/2/sin(180/n)),
|
r = get_radius(r1=ir*sc, r2=or, r=r, d1=id*sc, d2=od, d=d, dflt=side/2/sin(180/n))
|
||||||
|
)
|
||||||
|
assert(!is_undef(r), "regular_ngon(): need to specify one of r, d, or, od, ir, id, side.")
|
||||||
|
let(
|
||||||
path = rounding==0? circle(r=r, realign=realign, spin=90, $fn=n) :
|
path = rounding==0? circle(r=r, realign=realign, spin=90, $fn=n) :
|
||||||
let(
|
let(
|
||||||
steps = floor(segs(r)/n),
|
steps = floor(segs(r)/n),
|
||||||
|
@ -628,6 +631,7 @@ function regular_ngon(n=6, r, d, or, od, ir, id, side, rounding=0, realign=false
|
||||||
module regular_ngon(n=6, r, d, or, od, ir, id, side, rounding=0, realign=false, anchor=CENTER, spin=0) {
|
module regular_ngon(n=6, r, d, or, od, ir, id, side, rounding=0, realign=false, anchor=CENTER, spin=0) {
|
||||||
sc = 1/cos(180/n);
|
sc = 1/cos(180/n);
|
||||||
r = get_radius(r1=ir*sc, r2=or, r=r, d1=id*sc, d2=od, d=d, dflt=side/2/sin(180/n));
|
r = get_radius(r1=ir*sc, r2=or, r=r, d1=id*sc, d2=od, d=d, dflt=side/2/sin(180/n));
|
||||||
|
assert(!is_undef(r), "regular_ngon(): need to specify one of r, d, or, od, ir, id, side.");
|
||||||
path = regular_ngon(n=n, r=r, rounding=rounding, realign=realign);
|
path = regular_ngon(n=n, r=r, rounding=rounding, realign=realign);
|
||||||
attachable(anchor,spin, two_d=true, path=path) {
|
attachable(anchor,spin, two_d=true, path=path) {
|
||||||
polygon(path);
|
polygon(path);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
BOSL_VERSION = [2,0,143];
|
BOSL_VERSION = [2,0,144];
|
||||||
|
|
||||||
|
|
||||||
// Section: BOSL Library Version Functions
|
// Section: BOSL Library Version Functions
|
||||||
|
|
Loading…
Reference in a new issue