mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-09-02 23:53:13 +02:00
renamed replist to repeat
fixed normalization issue in path_to_bezier
This commit is contained in:
@@ -330,18 +330,17 @@ function bezier_polyline(bezier, splinesteps=16, N=3) = let(
|
||||
// path = path of points to define the bezier
|
||||
// tangents = optional list of tangent vectors at every point
|
||||
// closed = set to true for a closed path. Default: false
|
||||
function path_to_bezier(path, tangent, closed=false) =
|
||||
function path_to_bezier(path, tangents, closed=false) =
|
||||
assert(is_path(path,dim=undef),"Input path is not a valid path")
|
||||
assert(is_undef(tangent) || is_path(tangent,dim=len(path[0])),"Tangent must be a path of the same dimension as the input path")
|
||||
assert(is_undef(tangents) || is_path(tangents,dim=len(path[0])),"Tangents must be a path of the same dimension as the input path")
|
||||
let(
|
||||
tangent = is_def(tangent)? [for(t=tangent) unit(t)] : path_tangents(path, closed=closed),
|
||||
tangents = is_def(tangents)? tangents : deriv(path, closed=closed),
|
||||
lastpt = len(path) - (closed?0:1)
|
||||
)
|
||||
[for(i=[0:lastpt-1]) each [path[i], path[i]+tangent[i], select(path,i+1)-select(tangent,i+1)],
|
||||
[for(i=[0:lastpt-1]) each [path[i], path[i]+tangents[i]/3, select(path,i+1)-select(tangents,i+1)/3],
|
||||
select(path,lastpt)];
|
||||
|
||||
|
||||
|
||||
// Function: fillet_path()
|
||||
// Usage:
|
||||
// fillet_path(pts, fillet, [maxerr]);
|
||||
|
Reference in New Issue
Block a user