more error messages for star()

improve speed and flexibility of apply()
fix triangulation bug
add support for single point 2d solutions in polygon_line_intersection
This commit is contained in:
Adrian Mariano
2021-09-14 20:10:55 -04:00
parent 2ea90b7467
commit 4f8ebb2e80
4 changed files with 46 additions and 21 deletions

View File

@@ -1563,7 +1563,9 @@ function star(n, r, ir, d, or, od, id, step, realign=false, align_tip, align_pit
)
assert(is_def(n), "Must specify number of points, n")
assert(count==1, "Must specify exactly one of ir, id, step")
assert(stepOK, str("Parameter 'step' must be between 2 and ",floor(n/2-1/2)," for ",n," point star"))
assert(stepOK, n==4 ? "Parameter 'step' not allowed for 4 point stars"
: n==5 || n==6 ? str("Parameter 'step' must be 2 for ",n," point stars")
: str("Parameter 'step' must be between 2 and ",floor(n/2-1/2)," for ",n," point stars"))
let(
mat = !is_undef(_mat) ? _mat :
( realign? rot(-180/n, planar=true) : affine2d_identity() ) * (