Added force_list, path_to_bezier, smooth_path, associate_vertices,

improved skin and sweep error handling.  Allow path_sweep to take a 2d
path.
This commit is contained in:
Adrian Mariano
2020-03-04 20:24:00 -05:00
parent 469b4cb525
commit 51af394c24
6 changed files with 140 additions and 15 deletions

View File

@@ -9,8 +9,8 @@
//////////////////////////////////////////////////////////////////////
include <BOSL2/vnf.scad>
include <vnf.scad>
include <skin.scad>
// Section: Terminology
// **Polyline**: A series of points joined by straight line segements.
@@ -318,6 +318,29 @@ function bezier_polyline(bezier, splinesteps=16, N=3) = let(
);
// Function: path_to_bezier()
// Usage:
// path_to_bezier(path,[tangent],[closed]);
// Description:
// Given an input path and optional path of tangent vectors, computes a cubic (degree 3) bezier path that passes
// through every point on the input path and matches the tangent vectors. If you do not supply
// the tangent it will be computed using path_tangents. If the path is closed specify this
// by setting closed=true.
// Arguments:
// 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) =
assert(is_path(path,dim=undef),"Input path is not a valid path")
assert(is_undef(tangent) || is_path(tanget,dim=len(path[0])),"Tangent must be a path of the same dimension as the input path")
let(
tangent = is_def(tangent)? tangent : path_tangents(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)],
select(path,lastpt)];
// Function: fillet_path()
// Usage: