fix smooth_path and path_to_bezier to handle 1-regions

This commit is contained in:
Adrian Mariano
2022-01-04 23:11:34 -05:00
parent fe9a9a5d01
commit 70afd85c18
2 changed files with 7 additions and 4 deletions

View File

@@ -747,14 +747,16 @@ function bezier_path(bezier, splinesteps=16, N=3, endpoint=true) =
// using `path_tangents()` with `uniform=false` by default. Tangents computed on non-uniform data tend
// to display overshoots. See `smooth_path()` for examples.
// Arguments:
// path = 2D or 3D point list that the curve must pass through
// path = 2D or 3D point list or 1-region that the curve must pass through
// closed = true if the curve is closed . Default: false
// tangents = tangents constraining curve direction at each point
// uniform = set to true to compute tangents with uniform=true. Default: false
// ---
// size = absolute size specification for the curve, a number or vector
// relsize = relative size specification for the curve, a number or vector. Default: 0.1.
function path_to_bezier(path, closed=false, tangents, uniform=false, size, relsize) =
function path_to_bezier(path, closed, tangents, uniform=false, size, relsize) =
is_1region(path) ? path_to_bezier(path[0], default(closed,true), tangents, uniform, size, relsize) :
let(closed=default(closed,false))
assert(is_bool(closed))
assert(is_bool(uniform))
assert(num_defined([size,relsize])<=1, "Can't define both size and relsize")