mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-15 08:59:40 +00:00
Compare commits
No commits in common. "7ff4cf36c2594c065b595de9759423490c31cbf0" and "5e96d1772ef45a4b87dd02dc3ae3b63b7156c349" have entirely different histories.
7ff4cf36c2
...
5e96d1772e
12 changed files with 79 additions and 31 deletions
|
@ -135,7 +135,7 @@ To declare what code the user needs to add to their code to include or use this
|
||||||
|
|
||||||
// Includes:
|
// Includes:
|
||||||
// include <BOSL2/std.scad>
|
// include <BOSL2/std.scad>
|
||||||
// include <BOSL2/gears.scad>
|
// include <BOSL2/beziers.scad>
|
||||||
|
|
||||||
Which outputs Markdown code that renders like:
|
Which outputs Markdown code that renders like:
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ Which outputs Markdown code that renders like:
|
||||||
>
|
>
|
||||||
> ```openscad
|
> ```openscad
|
||||||
> include <BOSL2/std.scad>
|
> include <BOSL2/std.scad>
|
||||||
> include <BOSL2/gears.scad>
|
> include <BOSL2/beziers.scad>
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// LibFile: beziers.scad
|
// LibFile: beziers.scad
|
||||||
// Bezier curves and surfaces are ways to represent smooth curves and smoothly curving
|
// Bezier curves and surfaces are way to represent smooth curves and smoothly curving
|
||||||
// surfaces with a set of control points. The curve or surface is defined by
|
// surfaces with a set of control points. The curve or surface is defined by
|
||||||
// the control points, but usually only passes through the first and last control point (the endpoints).
|
// the control points, but usually only passes through the first and last control point (the endpoints).
|
||||||
// This file provides some
|
// This file provides some
|
||||||
|
@ -8,9 +8,9 @@
|
||||||
// computing the Bezier curves and surfaces given by the control points,
|
// computing the Bezier curves and surfaces given by the control points,
|
||||||
// Includes:
|
// Includes:
|
||||||
// include <BOSL2/std.scad>
|
// include <BOSL2/std.scad>
|
||||||
|
// include <BOSL2/beziers.scad>
|
||||||
// FileGroup: Advanced Modeling
|
// FileGroup: Advanced Modeling
|
||||||
// FileSummary: Bezier curves and surfaces.
|
// FileSummary: Bezier curves and surfaces.
|
||||||
// FileFootnotes: STD=Included in std.scad
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Terminology:
|
// Terminology:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
include <BOSL2/std.scad>
|
include <BOSL2/std.scad>
|
||||||
include <BOSL2/gears.scad>
|
include <BOSL2/gears.scad>
|
||||||
|
include <BOSL2/beziers.scad>
|
||||||
include <BOSL2/screws.scad>
|
include <BOSL2/screws.scad>
|
||||||
include <BOSL2/cubetruss.scad>
|
include <BOSL2/cubetruss.scad>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <BOSL2/std.scad>
|
||||||
|
include <BOSL2/beziers.scad>
|
||||||
|
|
||||||
// Makes a pseudo-sphere from a rectangular patch and its mirror.
|
// Makes a pseudo-sphere from a rectangular patch and its mirror.
|
||||||
s = 50/sqrt(2);
|
s = 50/sqrt(2);
|
||||||
|
|
|
@ -90,6 +90,7 @@ module extrude_from_to(pt1, pt2, convexity, twist, scale, slices) {
|
||||||
// path_extrude2d(arc(d=100,angle=[180,270]),caps=true)
|
// path_extrude2d(arc(d=100,angle=[180,270]),caps=true)
|
||||||
// trapezoid(w1=10, w2=5, h=10, anchor=BACK);
|
// trapezoid(w1=10, w2=5, h=10, anchor=BACK);
|
||||||
// Example:
|
// Example:
|
||||||
|
// include <BOSL2/beziers.scad>
|
||||||
// path = bezpath_curve([
|
// path = bezpath_curve([
|
||||||
// [-50,0], [-25,50], [0,0], [50,0]
|
// [-50,0], [-25,50], [0,0], [50,0]
|
||||||
// ]);
|
// ]);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
// Section: NURBS Curves
|
// Section: NURBS Curves
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// FileGroup: Advanced Modeling
|
// FileGroup: Advanced Modeling
|
||||||
// FileSummary: Round path corners, rounded prisms, rounded cutouts in tubes, filleted prism joints
|
// FileSummary: Round path corners, rounded prisms, rounded cutouts in tubes, filleted prism joints
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
include <beziers.scad>
|
||||||
include <structs.scad>
|
include <structs.scad>
|
||||||
|
|
||||||
// Section: Types of Roundovers
|
// Section: Types of Roundovers
|
||||||
|
@ -595,20 +596,18 @@ function _rounding_offsets(edgespec,z_dir=1) =
|
||||||
|
|
||||||
|
|
||||||
// Function: smooth_path()
|
// Function: smooth_path()
|
||||||
// Synopsis: Create a smoothed path passing through all the points of a given path, or passing through all the segment midpoint tangents.
|
// Synopsis: Create smoothed path that passes through all the points of a given path.
|
||||||
// SynTags: Path
|
// SynTags: Path
|
||||||
// Topics: Rounding, Paths
|
// Topics: Rounding, Paths
|
||||||
// See Also: round_corners(), smooth_path(), path_join(), offset_stroke()
|
// See Also: round_corners(), smooth_path(), path_join(), offset_stroke()
|
||||||
// Usage ("edges" method) (default):
|
// Usage:
|
||||||
// smoothed = smooth_path(path, [tangents], [size=|relsize=], [method="edges"], [splinesteps=], [closed=], [uniform=]);
|
// smoothed = smooth_path(path, [tangents], [size=|relsize=], [splinesteps=], [closed=], [uniform=]);
|
||||||
// Usage ("corners" method):
|
|
||||||
// smoothed = smooth_path(path, [size=|relsize=], method="corners", [splinesteps=], [closed=]);
|
|
||||||
// Description:
|
// Description:
|
||||||
// Smooths the input path, creating a continuous curve using a cubic spline, using one of two methods.
|
// Smooths the input path, creating a continuous curve using a cubic spline, using one of two methods.
|
||||||
// .
|
// .
|
||||||
// For `method="edges"` (default), every segment (edge) of the path is replaced by a cubic curve with `splinesteps`
|
// For `method="edges"`, every segment (edge) of the path is replaced by a cubic curve with `splinesteps` points,
|
||||||
// points, and the cubic interpolation passes through every input point on the path, matching the tangents at every
|
// and the cubic interpolation passes through every input point on the path, matching the tangents at every
|
||||||
// point. If you do not specify `tangents`, they are computed using {{path_tangents()}} with `uniform=false` by
|
// point. If you do not specify `tangents`, they are computed using path_tangents with `uniform=false` by
|
||||||
// default. Only the dirction of a tangent vector matters, not the vector length.
|
// default. Only the dirction of a tangent vector matters, not the vector length.
|
||||||
// Setting `uniform=true` with non-uniform sampling may be desirable in some cases but tends to
|
// Setting `uniform=true` with non-uniform sampling may be desirable in some cases but tends to
|
||||||
// produces curves that overshoot the point on the path.
|
// produces curves that overshoot the point on the path.
|
||||||
|
@ -616,7 +615,7 @@ function _rounding_offsets(edgespec,z_dir=1) =
|
||||||
// For `method="corners"`, every corner of the path is replaced by two cubic curves, each with
|
// For `method="corners"`, every corner of the path is replaced by two cubic curves, each with
|
||||||
// `splinesteps` points. The two curves are joined at the corner bisector, and the cubic interpolations
|
// `splinesteps` points. The two curves are joined at the corner bisector, and the cubic interpolations
|
||||||
// are tangent to the midpoint of every segment. The `tangents` and `uniform` parameters don't apply to the
|
// are tangent to the midpoint of every segment. The `tangents` and `uniform` parameters don't apply to the
|
||||||
// "corners" method. Using either one with "corners" causes an error.
|
// "corners" method. Using `tangents` with "corners" causes an error.
|
||||||
// .
|
// .
|
||||||
// The `size` or `relsize` parameters apply to both methods. They determine how far the curve can bend away
|
// The `size` or `relsize` parameters apply to both methods. They determine how far the curve can bend away
|
||||||
// from the input path. In the case where the path has three non-collinear points, the size specifies the
|
// from the input path. In the case where the path has three non-collinear points, the size specifies the
|
||||||
|
@ -631,7 +630,7 @@ function _rounding_offsets(edgespec,z_dir=1) =
|
||||||
// `relsize` determines where the curve intersects the corner bisector, relative to the maximum deviation
|
// `relsize` determines where the curve intersects the corner bisector, relative to the maximum deviation
|
||||||
// possible (which corresponds to a circle rounding from the shortest leg of the corner). For example,
|
// possible (which corresponds to a circle rounding from the shortest leg of the corner). For example,
|
||||||
// `relsize=1` is the maximum deviation from the corner (a circle arc from the shortest leg), and `relsize=0.5`
|
// `relsize=1` is the maximum deviation from the corner (a circle arc from the shortest leg), and `relsize=0.5`
|
||||||
// causes the curve to intersect the corner bisector halfway between that maximum and the tip of the corner.
|
// causes the curve to intersect the corner bisector halfway between the maximum and the tip of the corner.
|
||||||
// .
|
// .
|
||||||
// At a given segment or corner (depending on the method) there is a maximum size: a size value that is too
|
// At a given segment or corner (depending on the method) there is a maximum size: a size value that is too
|
||||||
// large is rounded down. See also path_to_bezpath().
|
// large is rounded down. See also path_to_bezpath().
|
||||||
|
@ -639,8 +638,8 @@ function _rounding_offsets(edgespec,z_dir=1) =
|
||||||
// path = path to smooth
|
// path = path to smooth
|
||||||
// tangents = tangents constraining curve direction vectors (vector length doesn't matter) at each point for `method="edges"`. Default: computed automatically
|
// tangents = tangents constraining curve direction vectors (vector length doesn't matter) at each point for `method="edges"`. Default: computed automatically
|
||||||
// ---
|
// ---
|
||||||
// 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"`
|
// 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
|
||||||
// size = absolute deviation between the curve and edge (for method="edges") or corner (for method="corners"), a number or vector.
|
// size = absolute deviation between the curve and edge (for method="edges") or corner (for method="corner"), a number or vector.
|
||||||
// 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"
|
// 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"
|
||||||
// splinesteps = Number of steps for each bezier curve section. Default: 10
|
// splinesteps = Number of steps for each bezier curve section. Default: 10
|
||||||
// uniform = set to true to compute tangents with uniform=true. Applies only to "edges" method. Default: false
|
// uniform = set to true to compute tangents with uniform=true. Applies only to "edges" method. Default: false
|
||||||
|
@ -660,11 +659,11 @@ function _rounding_offsets(edgespec,z_dir=1) =
|
||||||
// color("red") polygon(smooth_path(square(4),
|
// color("red") polygon(smooth_path(square(4),
|
||||||
// method="corners",size=.25,closed=true));
|
// method="corners",size=.25,closed=true));
|
||||||
// stroke(square(4), closed=true, color="green", width=0.05);
|
// stroke(square(4), closed=true, color="green", width=0.05);
|
||||||
// Example(2D): Turning on uniform tangent calculation also changes the end derivatives for the "edges" curve:
|
// Example(2D): Turning on uniform tangent calculation also changes the end derivatives for the "edges" curve (it has no effect on the "corners" curve):
|
||||||
// color("green")stroke(square(4), width=0.1);
|
// color("green")stroke(square(4), width=0.1);
|
||||||
// stroke(smooth_path(square(4),size=0.4,uniform=true),
|
// stroke(smooth_path(square(4),size=0.4,uniform=true),
|
||||||
// width=0.1);
|
// width=0.1);
|
||||||
// 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).
|
// 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).
|
||||||
// color("green")
|
// color("green")
|
||||||
// stroke(square([10,5]), closed=true, width=0.06);
|
// stroke(square([10,5]), closed=true, width=0.06);
|
||||||
// stroke(smooth_path(square([10,5]), method="edges",
|
// stroke(smooth_path(square([10,5]), method="edges",
|
||||||
|
@ -675,14 +674,18 @@ function _rounding_offsets(edgespec,z_dir=1) =
|
||||||
// color("green")stroke(square([10,4]), closed=true, width=0.1);
|
// color("green")stroke(square([10,4]), closed=true, width=0.1);
|
||||||
// stroke(smooth_path(square([10,4]),relsize=0.1,closed=true),
|
// stroke(smooth_path(square([10,4]),relsize=0.1,closed=true),
|
||||||
// width=0.1);
|
// width=0.1);
|
||||||
// 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.
|
// 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.
|
||||||
// stroke(smooth_path(square([20,15]), method="corners", relsize=1, closed=true),
|
// stroke(smooth_path(square([20,15]), method="corners",
|
||||||
|
// relsize=1, closed=true),
|
||||||
// color="red", closed=true, width=0.1);
|
// color="red", closed=true, width=0.1);
|
||||||
// stroke(smooth_path(square([20,15]), method="corners", relsize=0.66, closed=true),
|
// stroke(smooth_path(square([20,15]), method="corners",
|
||||||
|
// relsize=0.66, closed=true),
|
||||||
// color="gold", closed=true, width=0.1);
|
// color="gold", closed=true, width=0.1);
|
||||||
// stroke(smooth_path(square([20,15]), method="corners", relsize=0.33, closed=true),
|
// stroke(smooth_path(square([20,15]), method="corners",
|
||||||
|
// relsize=0.33, closed=true),
|
||||||
// color="blue", closed=true, width=0.1);
|
// color="blue", closed=true, width=0.1);
|
||||||
// stroke(smooth_path(square([20,15]), method="corners", relsize=0.001, closed=true),
|
// stroke(smooth_path(square([20,15]), method="corners",
|
||||||
|
// relsize=0.001, closed=true), // relsize must be >0
|
||||||
// color="green", closed=true, width=0.1);
|
// color="green", closed=true, width=0.1);
|
||||||
// Example(2D): Settting uniform to true biases the tangents to align more with the line sides (applicable only to "edges" method).
|
// Example(2D): Settting uniform to true biases the tangents to align more with the line sides (applicable only to "edges" method).
|
||||||
// color("green")
|
// color("green")
|
||||||
|
@ -695,7 +698,7 @@ function _rounding_offsets(edgespec,z_dir=1) =
|
||||||
// polygon(smooth_path(path,size=1,closed=true));
|
// polygon(smooth_path(path,size=1,closed=true));
|
||||||
// color("red") polygon(smooth_path(path,method="corners",relsize=0.7,closed=true));
|
// color("red") polygon(smooth_path(path,method="corners",relsize=0.7,closed=true));
|
||||||
// stroke(path, color="green", width=0.2, closed=true);
|
// stroke(path, color="green", width=0.2, closed=true);
|
||||||
// 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.
|
// 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.
|
||||||
// color("green")stroke(square(4), width=0.06,closed=true);
|
// color("green")stroke(square(4), width=0.06,closed=true);
|
||||||
// stroke(smooth_path(square(4), method="edges", size=4, closed=true),
|
// stroke(smooth_path(square(4), method="edges", size=4, closed=true),
|
||||||
// closed=true, width=0.1);
|
// closed=true, width=0.1);
|
||||||
|
@ -717,7 +720,7 @@ function _rounding_offsets(edgespec,z_dir=1) =
|
||||||
// stroke(smooth_path(path,relsize=.1),width=.3);
|
// stroke(smooth_path(path,relsize=.1),width=.3);
|
||||||
// color("red") for(p=path) translate(p) sphere(d=0.3);
|
// color("red") for(p=path) translate(p) sphere(d=0.3);
|
||||||
// stroke(path, width=0.1, color="red");
|
// stroke(path, width=0.1, color="red");
|
||||||
// Example(FlatSpin,VPD=45): Comparison of "edges" and "corners" 3D path resembling a [trefoil knot](https://en.wikipedia.org/wiki/Trefoil_knot).
|
// Example(FlatSpin,VPD=45: Comparison of "edges" and "corners" 3D path resembling a [trefoil knot](https://en.wikipedia.org/wiki/Trefoil_knot).
|
||||||
// shape = [[8.66, -5, -5], [8.66, 5, 5], [-2, 3.46, 0],
|
// shape = [[8.66, -5, -5], [8.66, 5, 5], [-2, 3.46, 0],
|
||||||
// [-8.66, -5, -5], [0, -10, 5], [4, 0, 0],
|
// [-8.66, -5, -5], [0, -10, 5], [4, 0, 0],
|
||||||
// [0, 10, -5], [-8.66, 5, 5], [-2, -3.46, 0]];
|
// [0, 10, -5], [-8.66, 5, 5], [-2, -3.46, 0]];
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
use <builtins.scad>
|
use <builtins.scad>
|
||||||
|
include <beziers.scad>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1792,7 +1793,7 @@ module glued_circles(r, spread=10, tangent=30, d, anchor=CENTER, spin=0) {
|
||||||
// Examples(2D):
|
// Examples(2D):
|
||||||
// squircle(size=50, squareness=0.4);
|
// squircle(size=50, squareness=0.4);
|
||||||
// squircle([80,60], 0.7, $fn=64);
|
// squircle([80,60], 0.7, $fn=64);
|
||||||
// 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.
|
// 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.
|
||||||
// color("pink") squircle(size=50, style="superellipse", squareness=0.5, $fn=256);
|
// color("pink") squircle(size=50, style="superellipse", squareness=0.5, $fn=256);
|
||||||
// color("yellow") up(1) squircle(size=50, style="fg", squareness=0.5, $fn=256);
|
// color("yellow") up(1) squircle(size=50, style="fg", squareness=0.5, $fn=256);
|
||||||
// color("lightblue") up(2) squircle(size=50, style="bezier", squareness=0.5, $fn=256);
|
// color("lightblue") up(2) squircle(size=50, style="bezier", squareness=0.5, $fn=256);
|
||||||
|
|
|
@ -934,6 +934,7 @@ function linear_sweep(
|
||||||
// texture=tex, tex_size=[20,20],
|
// texture=tex, tex_size=[20,20],
|
||||||
// tex_depth=1, style="concave");
|
// tex_depth=1, style="concave");
|
||||||
// Example:
|
// Example:
|
||||||
|
// include <BOSL2/beziers.scad>
|
||||||
// bezpath = [
|
// bezpath = [
|
||||||
// [15, 30], [10,15],
|
// [15, 30], [10,15],
|
||||||
// [10, 0], [20, 10], [30,12],
|
// [10, 0], [20, 10], [30,12],
|
||||||
|
|
1
std.scad
1
std.scad
|
@ -16,7 +16,6 @@ include <distributors.scad>
|
||||||
include <miscellaneous.scad>
|
include <miscellaneous.scad>
|
||||||
include <color.scad>
|
include <color.scad>
|
||||||
include <attachments.scad>
|
include <attachments.scad>
|
||||||
include <beziers.scad>
|
|
||||||
include <shapes3d.scad>
|
include <shapes3d.scad>
|
||||||
include <shapes2d.scad>
|
include <shapes2d.scad>
|
||||||
include <drawing.scad>
|
include <drawing.scad>
|
||||||
|
|
|
@ -9,10 +9,12 @@ Quadratic Béziers, i.e. Bezier's of degree 2, are defined by [quadratic polynom
|
||||||
![Image courtesy Wikipedia](images/bezier_2_big.gif "Quadratic Bézier Animation courtesy Wikipedia")
|
![Image courtesy Wikipedia](images/bezier_2_big.gif "Quadratic Bézier Animation courtesy Wikipedia")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To visualize a Bézier curve we can use the module [debug_bezier()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.scad#module-debug_bezier). The argument N tells debug_bezier the degree of the Bézier curve.
|
To visualize a Bézier curve we can use the module [debug_bezier()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.scad#module-debug_bezier). The argument N tells debug_bezier the degree of the Bézier curve.
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[0,0], [30,60], [0,100]];
|
bez = [[0,0], [30,60], [0,100]];
|
||||||
debug_bezier(bez, N = 2);
|
debug_bezier(bez, N = 2);
|
||||||
|
@ -22,6 +24,7 @@ If we move any of the control points, we change the shape of the curve.
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[0,0], [100,50], [0,100]];
|
bez = [[0,0], [100,50], [0,100]];
|
||||||
debug_bezier(bez, N = 2);
|
debug_bezier(bez, N = 2);
|
||||||
|
@ -33,6 +36,7 @@ Cubic Bézier curves (degree 3) are defined by cubic polynomials. A cubic Bézie
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[20,0], [100,40], [50,90], [25,80]];
|
bez = [[20,0], [100,40], [50,90], [25,80]];
|
||||||
debug_bezier(bez, N = 3);
|
debug_bezier(bez, N = 3);
|
||||||
|
@ -42,6 +46,7 @@ By moving the second and third points on the list we change the shape of the cur
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
||||||
debug_bezier(bez, N = 3);
|
debug_bezier(bez, N = 3);
|
||||||
|
@ -58,6 +63,7 @@ Higher order Béziers such as Quartic (degree 4) and Quintic (degree 5) Béziers
|
||||||
|
|
||||||
```openscad-2D;Anim;FrameMS=2000;Frames=4;VPT=[50,50,40];ImgOnly
|
```openscad-2D;Anim;FrameMS=2000;Frames=4;VPT=[50,50,40];ImgOnly
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [
|
bez = [
|
||||||
[[0,0], [100,100], [0,80]],
|
[[0,0], [100,100], [0,80]],
|
||||||
|
@ -74,6 +80,7 @@ Bézier curves are not restricted to the XY plane. We can define a 3d Bézier a
|
||||||
|
|
||||||
```openscad-2D;FlatSpin,VPR=[80,0,360*$t],VPT=[0,0,20],VPD=175
|
```openscad-2D;FlatSpin,VPR=[80,0,360*$t],VPT=[0,0,20],VPD=175
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[10,0,10], [30,30,-10], [-30,30,40], [-10,0,30]];
|
bez = [[10,0,10], [30,30,-10], [-30,30,40], [-10,0,30]];
|
||||||
debug_bezier(bez, N = 3);
|
debug_bezier(bez, N = 3);
|
||||||
|
@ -93,6 +100,7 @@ The list of control points for a Bézier is not an OpenSCAD path. If we treat th
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[0,0], [30,30], [0,50], {70,30] [0,100]];
|
bez = [[0,0], [30,30], [0,50], {70,30] [0,100]];
|
||||||
debug_bezier(bez, N = 2);
|
debug_bezier(bez, N = 2);
|
||||||
|
@ -102,6 +110,7 @@ While the bez variable in these examples is a list of points, it is not the same
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
||||||
debug_bezier(bez, N = 3);
|
debug_bezier(bez, N = 3);
|
||||||
|
@ -112,6 +121,7 @@ color("red") stroke(bez);
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
||||||
path = bezpath_curve(bez, N = 3);
|
path = bezpath_curve(bez, N = 3);
|
||||||
|
@ -124,6 +134,7 @@ This means that a series of 7 control points can be grouped into three (overlapp
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[0,0], [10,30], [20,0], [30,-30], [40,0], [50,30],[60,0]];
|
bez = [[0,0], [10,30], [20,0], [30,-30], [40,0], [50,30],[60,0]];
|
||||||
path = bezpath_curve(bez, N = 2); //make a quadratic Bézier path
|
path = bezpath_curve(bez, N = 2); //make a quadratic Bézier path
|
||||||
|
@ -132,6 +143,7 @@ stroke(path);
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[0,0], [10,30], [20,0], [30,-30], [40,0], [50,30],[60,0]];
|
bez = [[0,0], [10,30], [20,0], [30,-30], [40,0], [50,30],[60,0]];
|
||||||
path = bezpath_curve(bez, N=3); //make a cubic Bézier path
|
path = bezpath_curve(bez, N=3); //make a cubic Bézier path
|
||||||
|
@ -142,6 +154,7 @@ By default [bezpath_curve()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.sc
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
||||||
path = bezpath_curve(bez, splinesteps = 6);
|
path = bezpath_curve(bez, splinesteps = 6);
|
||||||
|
@ -152,6 +165,7 @@ To close the path to the y-axis we can use the [bezpath\_close\_to\_axis()](http
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
||||||
closed = bezpath_close_to_axis(bez, axis = "Y");
|
closed = bezpath_close_to_axis(bez, axis = "Y");
|
||||||
|
@ -163,6 +177,7 @@ If we use [rotate_sweep()](https://github.com/BelfrySCAD/BOSL2/wiki/skin.scad#fu
|
||||||
|
|
||||||
```openscad-3D VPR = [80,0,20]
|
```openscad-3D VPR = [80,0,20]
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
$fn = 72;
|
$fn = 72;
|
||||||
|
|
||||||
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
||||||
|
@ -175,6 +190,7 @@ Instead of closing the path all the way to the y-axis, we can use [bezpath_offse
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
$fn = 72;
|
$fn = 72;
|
||||||
|
|
||||||
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
bez = [[20,0], [60,40], [-20,50], [25,80]];
|
||||||
|
@ -191,6 +207,7 @@ You can see the differences between the three methods here, with [bezpath_offset
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
include<BOSL2/rounding.scad>
|
include<BOSL2/rounding.scad>
|
||||||
$fn = 72;
|
$fn = 72;
|
||||||
|
|
||||||
|
@ -213,6 +230,7 @@ Sweeping a Bézier path offset using any of the three methods around the y-axis
|
||||||
|
|
||||||
```openscad-3D, VPT=[0,60,40], VPR=[90,0,0], VPD=250
|
```openscad-3D, VPT=[0,60,40], VPR=[90,0,0], VPD=250
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
include<BOSL2/rounding.scad>
|
include<BOSL2/rounding.scad>
|
||||||
|
|
||||||
$fn = 72;
|
$fn = 72;
|
||||||
|
@ -222,14 +240,16 @@ path = offset_stroke(bezier_curve(bez, splinesteps = 32), [2,0]);
|
||||||
back_half(s = 200) rotate_sweep(path,360);
|
back_half(s = 200) rotate_sweep(path,360);
|
||||||
```
|
```
|
||||||
|
|
||||||
We'll use a cylinder with a height of 2 for the floor of our vase. At the bottom of the vase the radius of the hole is bez[0].x but we need to find the radius at y = 2. The function [bezier_line_intersection()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.scad#function-bezier_line_intersection) returns a list of u-values where a given line intersects our Bézier curve.
|
We'll use a cylinder with a height of 2 for the floor of our vase. At the bottom of the vase the radius of the hole is bez[0].x but we need to find the radius at y = 2. The function [bezier_line_intersection()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.scad#function-bezier_line_intersection) will return a list of u-values where a given line intersects our Bézier curve.
|
||||||
|
|
||||||
The u-value is a number between 0 and 1 that designates how far along the curve the intersections occur. In our case the line only crosses the Bézier at one point so we get the single-element list [0.0168783].
|
The u-value is a number between 0 and 1 that designates how far along the curve the intersections occur. In our case the line only crosses the Bézier at one point so we get the single-element list [0.0168783].
|
||||||
|
|
||||||
The function [bezier_points()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.scad#function-bezpath_points) converts that list of u-values to a list of x,y coordinates. Drawing a line at y = 2 gives us the single-element list [[17.1687, 2]].
|
The function [bezier_points()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.scad#function-bezpath_points) will convert that list of u-values to a list of x,y coordinates. Drawing a line at y = 2 gives us the single-element list [[17.1687, 2]].
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
|
|
||||||
bez = [[15,0], [60,40], [-25,50], [25,80]];
|
bez = [[15,0], [60,40], [-25,50], [25,80]];
|
||||||
debug_bezier(bez, N = 3);
|
debug_bezier(bez, N = 3);
|
||||||
|
@ -240,10 +260,11 @@ echo(bezier_points(bez,u)); // [[17.1687, 2]]
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
That means a cyl() with a height of 2, a bottom radius of bez[0].x and a top radius of 17.1687 fits our vase.
|
That means a cyl() with a height of 2, a bottom radius of bez[0].x and a top radius of 17.1687 will fit our vase.
|
||||||
|
|
||||||
```openscad-3D, VPT=[0,60,12], VPR=[90,0,0], VPD=150
|
```openscad-3D, VPT=[0,60,12], VPR=[90,0,0], VPD=150
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
include<BOSL2/rounding.scad>
|
include<BOSL2/rounding.scad>
|
||||||
|
|
||||||
$fn = 72;
|
$fn = 72;
|
||||||
|
@ -261,6 +282,7 @@ Keep in mind the fact that **$fn** controls the smoothness of the [rotate_sweep(
|
||||||
|
|
||||||
```openscad-3D NoAxes VPD=400 VPT=[45,45,10] Big
|
```openscad-3D NoAxes VPD=400 VPT=[45,45,10] Big
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
$fn = 72;
|
$fn = 72;
|
||||||
|
|
||||||
|
@ -289,6 +311,7 @@ First, you can specify the endpoints by vectors and the control points by angle,
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([0,0], 45, 42.43),
|
bez_begin([0,0], 45, 42.43),
|
||||||
bez_end([100,0], 90, 30),
|
bez_end([100,0], 90, 30),
|
||||||
|
@ -300,6 +323,7 @@ Second, can specify the XY location of the endpoint and that end's control point
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([0,0], [30,30]),
|
bez_begin([0,0], [30,30]),
|
||||||
bez_end([100,0], [0,30]),
|
bez_end([100,0], [0,30]),
|
||||||
|
@ -311,6 +335,7 @@ Third, you can specify the endpoints by vectors, and the control points by a dir
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([0,0], BACK+RIGHT, 42.43),
|
bez_begin([0,0], BACK+RIGHT, 42.43),
|
||||||
bez_end([100,0], [0,1], 30),
|
bez_end([100,0], [0,1], 30),
|
||||||
|
@ -324,6 +349,7 @@ Here's an example using angle and distance to specify a corner. Note that the an
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([0,0], 45, 42.43),
|
bez_begin([0,0], 45, 42.43),
|
||||||
bez_joint([40,20], 90,0, 30,30),
|
bez_joint([40,20], 90,0, 30,30),
|
||||||
|
@ -332,12 +358,13 @@ bez = flatten([
|
||||||
debug_bezier(bez,N=3);
|
debug_bezier(bez,N=3);
|
||||||
```
|
```
|
||||||
|
|
||||||
The fourth cubic Bézier path constructor is [bez_tang()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.scad#function-bez_tang). This constructor makes smooth joint. It also has three control points, one on the path and the approaching and departing control points. Because all three points lie on a single line, we need only specify the angle of the departing control point. As in this example you can specify different distances for the approaching and departing controls points. If you specify only a single distance, it is used for both.
|
The fourth cubic Bézier path constructor is [bez_tang()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.scad#function-bez_tang). This constructor makes smooth joint. It also has three control points, one on the path and the approaching and departing control points. Because all three points lie on a single line, we need only specify the angle of the departing control point. As in this example you can specify different distances for the approaching and departing controls points. If you specify only a single distance, it will be used for both.
|
||||||
|
|
||||||
We can add a smooth joint to the last example:
|
We can add a smooth joint to the last example:
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([0,0], 45, 42.43),
|
bez_begin([0,0], 45, 42.43),
|
||||||
bez_joint([40,20], 90,0, 30,30),
|
bez_joint([40,20], 90,0, 30,30),
|
||||||
|
@ -351,6 +378,7 @@ It is not necessary to use the same notation to describe the entire Bézier path
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([0,0], [30,30]),
|
bez_begin([0,0], [30,30]),
|
||||||
bez_joint([40,20], BACK,RIGHT, 30,30),
|
bez_joint([40,20], BACK,RIGHT, 30,30),
|
||||||
|
@ -375,6 +403,7 @@ where r is the radius of the circle and n is the number of bez_tang() segments r
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
r = 50; // radius of the circle
|
r = 50; // radius of the circle
|
||||||
n = 4; //bezier segments to complete circle
|
n = 4; //bezier segments to complete circle
|
||||||
|
@ -395,6 +424,7 @@ Similarly, for the heart-shaped path we'll replace a corner point with the start
|
||||||
|
|
||||||
```openscad-2D
|
```openscad-2D
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([0,25], 40, 40),
|
bez_begin([0,25], 40, 40),
|
||||||
|
@ -408,6 +438,7 @@ The first shape in [The Bézier Game](https://bezier.method.ac) past the stages
|
||||||
|
|
||||||
```openscad-3D,Big,NoScales,VPR=[0,0,0],VPT=[100,25,0],VPF=22
|
```openscad-3D,Big,NoScales,VPR=[0,0,0],VPT=[100,25,0],VPF=22
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([0,0], BACK, 15),
|
bez_begin([0,0], BACK, 15),
|
||||||
|
@ -437,6 +468,7 @@ We can make a heart shaped dish using a 2D Bézier path to define the shape. Wh
|
||||||
|
|
||||||
```openscad-3d
|
```openscad-3d
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
include<BOSL2/rounding.scad>
|
include<BOSL2/rounding.scad>
|
||||||
|
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
|
@ -462,6 +494,7 @@ The path by angle constructors can be used to create 3D Bézier paths by specify
|
||||||
|
|
||||||
```openscad-3D,FlatSpin,NoScales,VPR=[85,0,360*$t],VPT=[0,0,20]
|
```openscad-3D,FlatSpin,NoScales,VPR=[85,0,360*$t],VPT=[0,0,20]
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin ([-50,0,0], 90, 25, p=90),
|
bez_begin ([-50,0,0], 90, 25, p=90),
|
||||||
|
@ -479,6 +512,7 @@ The cubic Bézier path constructors can also be used to create 3D Bézier paths
|
||||||
|
|
||||||
```openscad-3D,FlatSpin,NoScales,VPR=[80,0,360*$t],,VPT=[0,0,20]
|
```openscad-3D,FlatSpin,NoScales,VPR=[80,0,360*$t],,VPT=[0,0,20]
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([-50,0,0], [0,25,0]),
|
bez_begin([-50,0,0], [0,25,0]),
|
||||||
|
@ -497,6 +531,7 @@ The third method for specifying 3D cubic Bézier Paths is by Direction Vector an
|
||||||
|
|
||||||
```openscad-3D,FlatSpin,NoScales,VPR=[80,0,360*$t],,VPT=[0,0,20]
|
```openscad-3D,FlatSpin,NoScales,VPR=[80,0,360*$t],,VPT=[0,0,20]
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
bez = flatten([
|
bez = flatten([
|
||||||
bez_begin([-50,0,0], BACK, 25),
|
bez_begin([-50,0,0], BACK, 25),
|
||||||
|
@ -515,6 +550,7 @@ We can use a 2D Bézier path to define the shape of our bud vase as we did in th
|
||||||
|
|
||||||
```openscad-3d,Big
|
```openscad-3d,Big
|
||||||
include<BOSL2/std.scad>
|
include<BOSL2/std.scad>
|
||||||
|
include<BOSL2/beziers.scad>
|
||||||
|
|
||||||
//Side Bézier Path
|
//Side Bézier Path
|
||||||
side_bez = [[20,0], [40,40], [-10,70], [20,100]];
|
side_bez = [[20,0], [40,40], [-10,70], [20,100]];
|
||||||
|
|
4
vnf.scad
4
vnf.scad
|
@ -322,6 +322,7 @@ function vnf_vertex_array(
|
||||||
// vnf_wireframe(vnf,width=0.1);
|
// vnf_wireframe(vnf,width=0.1);
|
||||||
// color("red")move_copies(flatten(pts)) sphere(r=.15,$fn=9);
|
// color("red")move_copies(flatten(pts)) sphere(r=.15,$fn=9);
|
||||||
// Example(3D,NoAxes,Edges,VPR=[65,0,25],VPD=380,Med): Model of a cymbal with roughly same-size facets, using a different number of points for each concentric ring of vertices.
|
// Example(3D,NoAxes,Edges,VPR=[65,0,25],VPD=380,Med): Model of a cymbal with roughly same-size facets, using a different number of points for each concentric ring of vertices.
|
||||||
|
// include <BOSL2/beziers.scad>
|
||||||
// bez = [
|
// bez = [
|
||||||
// [[0,26], [35,26], [29,0], [80,16], [102,0]], //top
|
// [[0,26], [35,26], [29,0], [80,16], [102,0]], //top
|
||||||
// [[99,-1], [79,15], [28,-1], [34,25], [-1,25]] // bottom
|
// [[99,-1], [79,15], [28,-1], [34,25], [-1,25]] // bottom
|
||||||
|
@ -1442,6 +1443,7 @@ function projection(vnf,cut=false,eps=EPSILON) =
|
||||||
// vnf4=vnf_join([vnf3, zflip(vnf3,1)]);
|
// vnf4=vnf_join([vnf3, zflip(vnf3,1)]);
|
||||||
// vnf_polyhedron(vnf4);
|
// vnf_polyhedron(vnf4);
|
||||||
// Example: When the input VNF is a surface with a boundary, if you use the default setting closed=true, then vnf_halfspace() tries to construct closing faces from the edges created by the cut. These faces may be invalid, for example if the cut points are collinear. In this example the constructed face is a valid face.
|
// Example: When the input VNF is a surface with a boundary, if you use the default setting closed=true, then vnf_halfspace() tries to construct closing faces from the edges created by the cut. These faces may be invalid, for example if the cut points are collinear. In this example the constructed face is a valid face.
|
||||||
|
// include <BOSL2/beziers.scad>
|
||||||
// patch=[
|
// patch=[
|
||||||
// [[10,-10,0],[1,-1,0],[-1,-1,0],[-10,-10,0]],
|
// [[10,-10,0],[1,-1,0],[-1,-1,0],[-10,-10,0]],
|
||||||
// [[10,-10,20],[1,-1,20],[-1,-1,20],[-10,-10,20]]
|
// [[10,-10,20],[1,-1,20],[-1,-1,20],[-10,-10,20]]
|
||||||
|
@ -1450,6 +1452,7 @@ function projection(vnf,cut=false,eps=EPSILON) =
|
||||||
// vnfcut = vnf_halfspace([-.8,0,-1,-14],vnf);
|
// vnfcut = vnf_halfspace([-.8,0,-1,-14],vnf);
|
||||||
// vnf_polyhedron(vnfcut);
|
// vnf_polyhedron(vnfcut);
|
||||||
// Example: Setting closed to false eliminates this (possibly invalid) face:
|
// Example: Setting closed to false eliminates this (possibly invalid) face:
|
||||||
|
// include <BOSL2/beziers.scad>
|
||||||
// patch=[
|
// patch=[
|
||||||
// [[10,-10,0],[1,-1,0],[-1,-1,0],[-10,-10,0]],
|
// [[10,-10,0],[1,-1,0],[-1,-1,0],[-10,-10,0]],
|
||||||
// [[10,-10,20],[1,-1,20],[-1,-1,20],[-10,-10,20]]
|
// [[10,-10,20],[1,-1,20],[-1,-1,20],[-10,-10,20]]
|
||||||
|
@ -1772,6 +1775,7 @@ function _sort_pairs0(arr) =
|
||||||
// merge = set to false to suppress the automatic invocation of {{vnf_merge_points()}}. Default: true
|
// merge = set to false to suppress the automatic invocation of {{vnf_merge_points()}}. Default: true
|
||||||
// idx = if true, return indices into VNF vertices instead of actual 3D points. Must set `merge=false` to enable this. Default: false
|
// idx = if true, return indices into VNF vertices instead of actual 3D points. Must set `merge=false` to enable this. Default: false
|
||||||
// Example(3D,NoAxes,VPT=[7.06325,-20.8414,20.1803],VPD=292.705,VPR=[55,0,25.7]): In this example we know that the bezier patch VNF has no duplicate vertices, so we do not need to run {{vnf_merge_points()}}.
|
// Example(3D,NoAxes,VPT=[7.06325,-20.8414,20.1803],VPD=292.705,VPR=[55,0,25.7]): In this example we know that the bezier patch VNF has no duplicate vertices, so we do not need to run {{vnf_merge_points()}}.
|
||||||
|
// include <BOSL2/beziers.scad>
|
||||||
// patch = [
|
// patch = [
|
||||||
// // u=0,v=0 u=1,v=0
|
// // u=0,v=0 u=1,v=0
|
||||||
// [[-50,-50, 0], [-16,-50, 20], [ 16,-50, -20], [50,-50, 0]],
|
// [[-50,-50, 0], [-16,-50, 20], [ 16,-50, -20], [50,-50, 0]],
|
||||||
|
|
Loading…
Reference in a new issue