Skip to content

Commit 7ff4cf3

Browse files
Merge pull request #1538 from amatulic/anachronist_dev
Grammar fix, corrections to rounding and shapes2d examples
2 parents 76ea1eb + 86ef2ec commit 7ff4cf3

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

beziers.scad

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//////////////////////////////////////////////////////////////////////
22
// LibFile: beziers.scad
3-
// Bezier curves and surfaces are way to represent smooth curves and smoothly curving
3+
// Bezier curves and surfaces are ways to represent smooth curves and smoothly curving
44
// surfaces with a set of control points. The curve or surface is defined by
55
// the control points, but usually only passes through the first and last control point (the endpoints).
66
// This file provides some

rounding.scad

+21-23
Original file line numberDiff line numberDiff line change
@@ -595,26 +595,28 @@ function _rounding_offsets(edgespec,z_dir=1) =
595595

596596

597597
// Function: smooth_path()
598-
// Synopsis: Create smoothed path that passes through all the points of a given path.
598+
// Synopsis: Create a smoothed path passing through all the points of a given path, or passing through all the segment midpoint tangents.
599599
// SynTags: Path
600600
// Topics: Rounding, Paths
601601
// See Also: round_corners(), smooth_path(), path_join(), offset_stroke()
602-
// Usage:
603-
// smoothed = smooth_path(path, [tangents], [size=|relsize=], [splinesteps=], [closed=], [uniform=]);
602+
// Usage ("edges" method) (default):
603+
// smoothed = smooth_path(path, [tangents], [size=|relsize=], [method="edges"], [splinesteps=], [closed=], [uniform=]);
604+
// Usage ("corners" method):
605+
// smoothed = smooth_path(path, [size=|relsize=], method="corners", [splinesteps=], [closed=]);
604606
// Description:
605607
// Smooths the input path, creating a continuous curve using a cubic spline, using one of two methods.
606608
// .
607-
// For `method="edges"`, every segment (edge) of the path is replaced by a cubic curve with `splinesteps` points,
608-
// and the cubic interpolation passes through every input point on the path, matching the tangents at every
609-
// point. If you do not specify `tangents`, they are computed using path_tangents with `uniform=false` by
609+
// For `method="edges"` (default), every segment (edge) of the path is replaced by a cubic curve with `splinesteps`
610+
// points, and the cubic interpolation passes through every input point on the path, matching the tangents at every
611+
// point. If you do not specify `tangents`, they are computed using {{path_tangents()}} with `uniform=false` by
610612
// default. Only the dirction of a tangent vector matters, not the vector length.
611613
// Setting `uniform=true` with non-uniform sampling may be desirable in some cases but tends to
612614
// produces curves that overshoot the point on the path.
613615
// .
614616
// For `method="corners"`, every corner of the path is replaced by two cubic curves, each with
615617
// `splinesteps` points. The two curves are joined at the corner bisector, and the cubic interpolations
616618
// are tangent to the midpoint of every segment. The `tangents` and `uniform` parameters don't apply to the
617-
// "corners" method. Using `tangents` with "corners" causes an error.
619+
// "corners" method. Using either one with "corners" causes an error.
618620
// .
619621
// The `size` or `relsize` parameters apply to both methods. They determine how far the curve can bend away
620622
// from the input path. In the case where the path has three non-collinear points, the size specifies the
@@ -629,16 +631,16 @@ function _rounding_offsets(edgespec,z_dir=1) =
629631
// `relsize` determines where the curve intersects the corner bisector, relative to the maximum deviation
630632
// possible (which corresponds to a circle rounding from the shortest leg of the corner). For example,
631633
// `relsize=1` is the maximum deviation from the corner (a circle arc from the shortest leg), and `relsize=0.5`
632-
// causes the curve to intersect the corner bisector halfway between the maximum and the tip of the corner.
634+
// causes the curve to intersect the corner bisector halfway between that maximum and the tip of the corner.
633635
// .
634636
// At a given segment or corner (depending on the method) there is a maximum size: a size value that is too
635637
// large is rounded down. See also path_to_bezpath().
636638
// Arguments:
637639
// path = path to smooth
638640
// tangents = tangents constraining curve direction vectors (vector length doesn't matter) at each point for `method="edges"`. Default: computed automatically
639641
// ---
640-
// relsize = relative maximum devation between the curve and edge (for method="edges") or corner (for method="corner"), a number or vector, expressed as proportion of edge length or proportion of max distance from corner (typically between 0 and 1). Default: 0.1
641-
// size = absolute deviation between the curve and edge (for method="edges") or corner (for method="corner"), a number or vector.
642+
// relsize = relative maximum devation between the curve and edge (for method="edges") or corner (for method="corners"), a number or vector, expressed as proportion of edge length or proportion of max distance from corner (typically between 0 and 1). Default: 0.1 for `method="edges"` or 0.5 for `method="corners"`
643+
// size = absolute deviation between the curve and edge (for method="edges") or corner (for method="corners"), a number or vector.
642644
// method = type of curve; "edges" makes a curve that intersects all the path vertices but deviates from the path edges, and "corners" makes a curve that is tangent to all segment midpoints but deviates from the corners. Default: "edges"
643645
// splinesteps = Number of steps for each bezier curve section. Default: 10
644646
// uniform = set to true to compute tangents with uniform=true. Applies only to "edges" method. Default: false
@@ -658,11 +660,11 @@ function _rounding_offsets(edgespec,z_dir=1) =
658660
// color("red") polygon(smooth_path(square(4),
659661
// method="corners",size=.25,closed=true));
660662
// stroke(square(4), closed=true, color="green", width=0.05);
661-
// Example(2D): Turning on uniform tangent calculation also changes the end derivatives for the "edges" curve (it has no effect on the "corners" curve):
663+
// Example(2D): Turning on uniform tangent calculation also changes the end derivatives for the "edges" curve:
662664
// color("green")stroke(square(4), width=0.1);
663665
// stroke(smooth_path(square(4),size=0.4,uniform=true),
664666
// width=0.1);
665-
// Example(2D): Here's a wide rectangle. With `method="edges" (yellow), using `size` means all edges bulge the same amount, regardless of their length. With `method="corners"` (red), the curve is `size' distance from the corners (up to a maximum theoretical circular arc).
667+
// Example(2D): Here's a wide rectangle. With `method="edges"` (yellow), using `size` means all edges bulge the same amount, regardless of their length. With `method="corners"` (red), the curve is `size` distance from the corners (up to a maximum theoretical circular arc).
666668
// color("green")
667669
// stroke(square([10,5]), closed=true, width=0.06);
668670
// stroke(smooth_path(square([10,5]), method="edges",
@@ -673,18 +675,14 @@ function _rounding_offsets(edgespec,z_dir=1) =
673675
// color("green")stroke(square([10,4]), closed=true, width=0.1);
674676
// stroke(smooth_path(square([10,4]),relsize=0.1,closed=true),
675677
// width=0.1);
676-
// Example(2D): For the "corners" curve, with relsize the distance from the corner is proportional to the maximum distance corresponding to a circular arc (shown in red) from the shorter leg of the corner. As `relsize` approaches zero, the curve approaches the corner.
677-
// stroke(smooth_path(square([20,15]), method="corners",
678-
// relsize=1, closed=true),
678+
// Example(2D,Med,NoScales): For the "corners" curve, with relsize the distance from the corner is proportional to the maximum distance corresponding to a circular arc (shown in red) from the shorter leg of the corner. As `relsize` approaches zero, the curve approaches the corner.
679+
// stroke(smooth_path(square([20,15]), method="corners", relsize=1, closed=true),
679680
// color="red", closed=true, width=0.1);
680-
// stroke(smooth_path(square([20,15]), method="corners",
681-
// relsize=0.66, closed=true),
681+
// stroke(smooth_path(square([20,15]), method="corners", relsize=0.66, closed=true),
682682
// color="gold", closed=true, width=0.1);
683-
// stroke(smooth_path(square([20,15]), method="corners",
684-
// relsize=0.33, closed=true),
683+
// stroke(smooth_path(square([20,15]), method="corners", relsize=0.33, closed=true),
685684
// color="blue", closed=true, width=0.1);
686-
// stroke(smooth_path(square([20,15]), method="corners",
687-
// relsize=0.001, closed=true), // relsize must be >0
685+
// stroke(smooth_path(square([20,15]), method="corners", relsize=0.001, closed=true),
688686
// color="green", closed=true, width=0.1);
689687
// Example(2D): Settting uniform to true biases the tangents to align more with the line sides (applicable only to "edges" method).
690688
// color("green")
@@ -697,7 +695,7 @@ function _rounding_offsets(edgespec,z_dir=1) =
697695
// polygon(smooth_path(path,size=1,closed=true));
698696
// color("red") polygon(smooth_path(path,method="corners",relsize=0.7,closed=true));
699697
// stroke(path, color="green", width=0.2, closed=true);
700-
// Example(2D): Here's the square with a size that's too big to achieve, giving the the maximum possible curve with `method="edges"` (yellow). For `method="corners"` (red), the maximum possible distance from the corners is a circle.
698+
// Example(2D,NoScales): Here's the square with a size that's too big to achieve, giving the the maximum possible curve with `method="edges"` (yellow). For `method="corners"` (red), the maximum possible distance from the corners is a circle.
701699
// color("green")stroke(square(4), width=0.06,closed=true);
702700
// stroke(smooth_path(square(4), method="edges", size=4, closed=true),
703701
// closed=true, width=0.1);
@@ -719,7 +717,7 @@ function _rounding_offsets(edgespec,z_dir=1) =
719717
// stroke(smooth_path(path,relsize=.1),width=.3);
720718
// color("red") for(p=path) translate(p) sphere(d=0.3);
721719
// stroke(path, width=0.1, color="red");
722-
// Example(FlatSpin,VPD=45: Comparison of "edges" and "corners" 3D path resembling a [trefoil knot](https://en.wikipedia.org/wiki/Trefoil_knot).
720+
// Example(FlatSpin,VPD=45): Comparison of "edges" and "corners" 3D path resembling a [trefoil knot](https://en.wikipedia.org/wiki/Trefoil_knot).
723721
// shape = [[8.66, -5, -5], [8.66, 5, 5], [-2, 3.46, 0],
724722
// [-8.66, -5, -5], [0, -10, 5], [4, 0, 0],
725723
// [0, 10, -5], [-8.66, 5, 5], [-2, -3.46, 0]];

shapes2d.scad

+1-1
Original file line numberDiff line numberDiff line change
@@ -1792,7 +1792,7 @@ module glued_circles(r, spread=10, tangent=30, d, anchor=CENTER, spin=0) {
17921792
// Examples(2D):
17931793
// squircle(size=50, squareness=0.4);
17941794
// squircle([80,60], 0.7, $fn=64);
1795-
// Example(3D,VPD=48,VPR=[40,0,40],NoAxes): Corner differences between the three squircle styles for squareness=0.5. Style "superellipse" is pink, "fg" is gold, "bezier" is blue.
1795+
// Example(3D,VPD=48,VPR=[40,0,40],VPT=[11,-11,-10],NoAxes): Corner differences between the three squircle styles for squareness=0.5. Style "superellipse" is pink, "fg" is gold, "bezier" is blue.
17961796
// color("pink") squircle(size=50, style="superellipse", squareness=0.5, $fn=256);
17971797
// color("yellow") up(1) squircle(size=50, style="fg", squareness=0.5, $fn=256);
17981798
// color("lightblue") up(2) squircle(size=50, style="bezier", squareness=0.5, $fn=256);

0 commit comments

Comments
 (0)