From 7a14909ec063c6ba756f78a9700632899885dad2 Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Sat, 6 Mar 2021 11:10:31 -0500 Subject: [PATCH 1/2] fix names for path_cut_segs which is broken --- paths.scad | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/paths.scad b/paths.scad index e40d65a..495f656 100644 --- a/paths.scad +++ b/paths.scad @@ -1334,11 +1334,11 @@ function _path_cuts_dir(path, cuts, closed=false, eps=1e-2) = ]; -// Function: path_cut_segs() +// Function: path_cut() // Topics: Paths // See Also: path_cut_points() // Usage: -// path_list = path_cut_segs(path, cutdist, ); +// path_list = path_cut(path, cutdist, ); // Description: // Given a list of distances in `cutdist`, cut the path into // subpaths at those lengths, returning a list of paths. @@ -1352,15 +1352,15 @@ function _path_cuts_dir(path, cuts, closed=false, eps=1e-2) = // closed = If true, treat the path as a closed polygon. // Example(2D): // path = circle(d=100); -// segs = path_cut_segs(path, [50, 200], closed=true); +// segs = path_cut(path, [50, 200], closed=true); // rainbow(segs) stroke($item); -function path_cut_segs(path,cutdist,closed) = - is_num(cutdist) ? path_cut_segs(path,[cutdist],closed) : +function path_cut(path,cutdist,closed) = + is_num(cutdist) ? path_cut(path,[cutdist],closed) : assert(is_vector(cutdist)) assert(select(cutdist,-1)0, "Cut distances must be strictly positive") let( - cutlist = path_cut(path,cutdist,closed=closed), + cutlist = path_cut_points(path,cutdist,closed=closed), cuts = len(cutlist) ) [ From b90f51dbc43c7f490c8e0cf1cd8cc921d6bd452c Mon Sep 17 00:00:00 2001 From: Adrian Mariano Date: Mon, 8 Mar 2021 17:08:06 -0500 Subject: [PATCH 2/2] doc tweaks --- rounding.scad | 2 +- transforms.scad | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/rounding.scad b/rounding.scad index 0d60c04..b9ef299 100644 --- a/rounding.scad +++ b/rounding.scad @@ -76,7 +76,7 @@ include // ignored. Note that $fn is interpreted as the number of points on the roundover curve, which is // not equivalent to its meaning for rounding circles because roundovers are usually small fractions // of a circular arc. When doing continuous curvature rounding be sure to use lots of segments or the effect -// will be hidden by the discretization. Note that if you use $fn then $fn with "smooth" then $fn points are added at each corner, even +// will be hidden by the discretization. Note that if you use $fn with "smooth" then $fn points are added at each corner, even // if the "corner" is flat, with collinear points, so this guarantees a specific output length. // // Figure(2D,Med): diff --git a/transforms.scad b/transforms.scad index 471198b..0fa9374 100644 --- a/transforms.scad +++ b/transforms.scad @@ -349,17 +349,18 @@ function up(z=0, p) = move([0,0,z],p=p); // * `rot(30)` or `rot(a=30)` rotates 30 degrees around the Z axis. // * `rot([20,30,40])` or `rot(a=[20,30,40])` rotates 20 degrees around the X axis, then 30 degrees around the Y axis, then 40 degrees around the Z axis. // * `rot(30, [1,1,0])` or `rot(a=30, v=[1,1,0])` rotates 30 degrees around the axis vector `[1,1,0]`. -// * `rot(from=[0,0,1], to=[1,0,0])` rotates the top towards the right, similar to `rot(a=90,v=[0,1,0]`. -// * `rot(from=[0,0,1], to=[1,1,0], a=45)` rotates 45 degrees around the Z axis, then rotates the top towards the back-right. Similar to `rot(a=90,v=[-1,1,0])` -// If the `cp` centerpoint argument is given, then rotations are performed around that centerpoint. -// If the `reverse` argument is true, then the rotations performed will be exactly reversed. +// * `rot(from=[0,0,1], to=[1,0,0])` rotates the `from` vector to line up with the `to` vector, in this case the top to the right and hence equivalent to `rot(a=90,v=[0,1,0]`. +// * `rot(from=[0,1,1], to=[1,1,0], a=45)` rotates 45 degrees around the `from` vector ([0,1,1]) and then rotates the `from` vector to align with the `to` vector. Equivalent to `rot(from=[0,1,1],to=[1,1,0]) rot(a=45,v=[0,1,1])`. You can also regard `a` as as post-rotation around the `to` vector. For this form, `a` must be a scalar. +// * If the `cp` centerpoint argument is given, then rotations are performed around that centerpoint. So `rot(args...,cp=[1,2,3])` is equivalent to `move(-[1,2,3])rot(args...)move([1,2,3])`. +// * If the `reverse` argument is true, then the rotations performed will be exactly reversed. +// . // The behavior and return value varies depending on how `rot()` is called: // * Called as a module, rotates all children. // * Called as a function with a `p` argument containing a point, returns the rotated point. // * Called as a function with a `p` argument containing a list of points, returns the list of rotated points. // * Called as a function with a [bezier patch](beziers.scad) in the `p` argument, returns the rotated patch. // * Called as a function with a [VNF structure](vnf.scad) in the `p` argument, returns the rotated VNF. -// * Called as a function without a `p` argument, and `planar` is true, returns the affine2d rotational matrix. Requires that `a` is a finite scalar. +// * Called as a function without a `p` argument, and `planar` is true, returns the affine2d rotational matrix. The angle `a` must be a scalar. // * Called as a function without a `p` argument, and `planar` is false, returns the affine3d rotational matrix. // // Arguments: