From 90ef49789645d2e440bfc19035b5a5a0aa3abcf2 Mon Sep 17 00:00:00 2001 From: Alex Matulich Date: Sun, 5 Jan 2025 11:40:20 -0800 Subject: [PATCH] include beziers.scad in std.scad, remove include line from all other files containing it --- WRITING_DOCS.md | 4 +-- beziers.scad | 2 +- examples/BOSL2logo.scad | 1 - examples/spherical_patch.scad | 1 - miscellaneous.scad | 1 - nurbs.scad | 1 - rounding.scad | 1 - shapes2d.scad | 1 - skin.scad | 1 - std.scad | 1 + tutorials/Beziers_for_Beginners.md | 44 +++--------------------------- vnf.scad | 4 --- 12 files changed, 8 insertions(+), 54 deletions(-) diff --git a/WRITING_DOCS.md b/WRITING_DOCS.md index 3a97bc1..aa9791b 100644 --- a/WRITING_DOCS.md +++ b/WRITING_DOCS.md @@ -135,7 +135,7 @@ To declare what code the user needs to add to their code to include or use this // Includes: // include - // include + // include Which outputs Markdown code that renders like: @@ -145,7 +145,7 @@ Which outputs Markdown code that renders like: > > ```openscad > include -> include +> include > ``` diff --git a/beziers.scad b/beziers.scad index e6e8091..01c1364 100644 --- a/beziers.scad +++ b/beziers.scad @@ -8,9 +8,9 @@ // computing the Bezier curves and surfaces given by the control points, // Includes: // include -// include // FileGroup: Advanced Modeling // FileSummary: Bezier curves and surfaces. +// FileFootnotes: STD=Included in std.scad ////////////////////////////////////////////////////////////////////// // Terminology: diff --git a/examples/BOSL2logo.scad b/examples/BOSL2logo.scad index 33652cb..4e77803 100644 --- a/examples/BOSL2logo.scad +++ b/examples/BOSL2logo.scad @@ -1,6 +1,5 @@ include include -include include include diff --git a/examples/spherical_patch.scad b/examples/spherical_patch.scad index 482360f..6e5d33b 100644 --- a/examples/spherical_patch.scad +++ b/examples/spherical_patch.scad @@ -1,5 +1,4 @@ include -include // Makes a pseudo-sphere from a rectangular patch and its mirror. s = 50/sqrt(2); diff --git a/miscellaneous.scad b/miscellaneous.scad index 472e056..31c7b18 100644 --- a/miscellaneous.scad +++ b/miscellaneous.scad @@ -90,7 +90,6 @@ module extrude_from_to(pt1, pt2, convexity, twist, scale, slices) { // path_extrude2d(arc(d=100,angle=[180,270]),caps=true) // trapezoid(w1=10, w2=5, h=10, anchor=BACK); // Example: -// include // path = bezpath_curve([ // [-50,0], [-25,50], [0,0], [50,0] // ]); diff --git a/nurbs.scad b/nurbs.scad index bb5f3d6..4852256 100644 --- a/nurbs.scad +++ b/nurbs.scad @@ -15,7 +15,6 @@ ////////////////////////////////////////////////////////////////////// include -include // Section: NURBS Curves diff --git a/rounding.scad b/rounding.scad index affc5c2..c00e860 100644 --- a/rounding.scad +++ b/rounding.scad @@ -11,7 +11,6 @@ // FileGroup: Advanced Modeling // FileSummary: Round path corners, rounded prisms, rounded cutouts in tubes, filleted prism joints ////////////////////////////////////////////////////////////////////// -include include // Section: Types of Roundovers diff --git a/shapes2d.scad b/shapes2d.scad index 3ffab3a..738d7e6 100644 --- a/shapes2d.scad +++ b/shapes2d.scad @@ -16,7 +16,6 @@ ////////////////////////////////////////////////////////////////////// use -include diff --git a/skin.scad b/skin.scad index 6ba2c1e..f8623b5 100644 --- a/skin.scad +++ b/skin.scad @@ -934,7 +934,6 @@ function linear_sweep( // texture=tex, tex_size=[20,20], // tex_depth=1, style="concave"); // Example: -// include // bezpath = [ // [15, 30], [10,15], // [10, 0], [20, 10], [30,12], diff --git a/std.scad b/std.scad index f20de64..1b745f4 100644 --- a/std.scad +++ b/std.scad @@ -16,6 +16,7 @@ include include include include +include include include include diff --git a/tutorials/Beziers_for_Beginners.md b/tutorials/Beziers_for_Beginners.md index 4c1d63b..7e6434f 100755 --- a/tutorials/Beziers_for_Beginners.md +++ b/tutorials/Beziers_for_Beginners.md @@ -9,12 +9,10 @@ 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") - 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 include -include bez = [[0,0], [30,60], [0,100]]; debug_bezier(bez, N = 2); @@ -24,7 +22,6 @@ If we move any of the control points, we change the shape of the curve. ```openscad-2D include -include bez = [[0,0], [100,50], [0,100]]; debug_bezier(bez, N = 2); @@ -36,7 +33,6 @@ Cubic Bézier curves (degree 3) are defined by cubic polynomials. A cubic Bézie ```openscad-2D include -include bez = [[20,0], [100,40], [50,90], [25,80]]; debug_bezier(bez, N = 3); @@ -46,7 +42,6 @@ By moving the second and third points on the list we change the shape of the cur ```openscad-2D include -include bez = [[20,0], [60,40], [-20,50], [25,80]]; debug_bezier(bez, N = 3); @@ -63,7 +58,6 @@ 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 include -include bez = [ [[0,0], [100,100], [0,80]], @@ -80,7 +74,6 @@ 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 include -include bez = [[10,0,10], [30,30,-10], [-30,30,40], [-10,0,30]]; debug_bezier(bez, N = 3); @@ -100,7 +93,6 @@ The list of control points for a Bézier is not an OpenSCAD path. If we treat th ```openscad-2D include -include bez = [[0,0], [30,30], [0,50], {70,30] [0,100]]; debug_bezier(bez, N = 2); @@ -110,7 +102,6 @@ While the bez variable in these examples is a list of points, it is not the same ```openscad-2D include -include bez = [[20,0], [60,40], [-20,50], [25,80]]; debug_bezier(bez, N = 3); @@ -121,7 +112,6 @@ color("red") stroke(bez); ```openscad-2D include -include bez = [[20,0], [60,40], [-20,50], [25,80]]; path = bezpath_curve(bez, N = 3); @@ -134,7 +124,6 @@ This means that a series of 7 control points can be grouped into three (overlapp ```openscad-2D include -include 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 @@ -143,7 +132,6 @@ stroke(path); ```openscad-2D include -include 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 @@ -154,7 +142,6 @@ By default [bezpath_curve()](https://github.com/BelfrySCAD/BOSL2/wiki/beziers.sc ```openscad-2D include -include bez = [[20,0], [60,40], [-20,50], [25,80]]; path = bezpath_curve(bez, splinesteps = 6); @@ -165,7 +152,6 @@ To close the path to the y-axis we can use the [bezpath\_close\_to\_axis()](http ```openscad-2D include -include bez = [[20,0], [60,40], [-20,50], [25,80]]; closed = bezpath_close_to_axis(bez, axis = "Y"); @@ -177,7 +163,6 @@ If we use [rotate_sweep()](https://github.com/BelfrySCAD/BOSL2/wiki/skin.scad#fu ```openscad-3D VPR = [80,0,20] include -include $fn = 72; bez = [[20,0], [60,40], [-20,50], [25,80]]; @@ -190,7 +175,6 @@ Instead of closing the path all the way to the y-axis, we can use [bezpath_offse ```openscad-2D include -include $fn = 72; bez = [[20,0], [60,40], [-20,50], [25,80]]; @@ -207,7 +191,6 @@ You can see the differences between the three methods here, with [bezpath_offset ```openscad-2D include -include include $fn = 72; @@ -230,7 +213,6 @@ 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 include -include include $fn = 72; @@ -240,16 +222,14 @@ path = offset_stroke(bezier_curve(bez, splinesteps = 32), [2,0]); 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) will return 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) returns 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 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]]. +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]]. ```openscad-2D include -include - bez = [[15,0], [60,40], [-25,50], [25,80]]; debug_bezier(bez, N = 3); @@ -260,11 +240,10 @@ 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 will fit 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 fits our vase. ```openscad-3D, VPT=[0,60,12], VPR=[90,0,0], VPD=150 include -include include $fn = 72; @@ -282,7 +261,6 @@ Keep in mind the fact that **$fn** controls the smoothness of the [rotate_sweep( ```openscad-3D NoAxes VPD=400 VPT=[45,45,10] Big include -include $fn = 72; @@ -311,7 +289,6 @@ First, you can specify the endpoints by vectors and the control points by angle, ```openscad-2D include -include bez = flatten([ bez_begin([0,0], 45, 42.43), bez_end([100,0], 90, 30), @@ -323,7 +300,6 @@ Second, can specify the XY location of the endpoint and that end's control point ```openscad-2D include -include bez = flatten([ bez_begin([0,0], [30,30]), bez_end([100,0], [0,30]), @@ -335,7 +311,6 @@ Third, you can specify the endpoints by vectors, and the control points by a dir ```openscad-2D include -include bez = flatten([ bez_begin([0,0], BACK+RIGHT, 42.43), bez_end([100,0], [0,1], 30), @@ -349,7 +324,6 @@ Here's an example using angle and distance to specify a corner. Note that the an ```openscad-2D include -include bez = flatten([ bez_begin([0,0], 45, 42.43), bez_joint([40,20], 90,0, 30,30), @@ -358,13 +332,12 @@ bez = flatten([ 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 will be 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 is used for both. We can add a smooth joint to the last example: ```openscad-2D include -include bez = flatten([ bez_begin([0,0], 45, 42.43), bez_joint([40,20], 90,0, 30,30), @@ -378,7 +351,6 @@ It is not necessary to use the same notation to describe the entire Bézier path ```openscad-2D include -include bez = flatten([ bez_begin([0,0], [30,30]), bez_joint([40,20], BACK,RIGHT, 30,30), @@ -403,7 +375,6 @@ where r is the radius of the circle and n is the number of bez_tang() segments r ```openscad-2D include -include r = 50; // radius of the circle n = 4; //bezier segments to complete circle @@ -424,7 +395,6 @@ Similarly, for the heart-shaped path we'll replace a corner point with the start ```openscad-2D include -include bez = flatten([ bez_begin([0,25], 40, 40), @@ -438,7 +408,6 @@ 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 include -include bez = flatten([ bez_begin([0,0], BACK, 15), @@ -468,7 +437,6 @@ We can make a heart shaped dish using a 2D Bézier path to define the shape. Wh ```openscad-3d include -include include bez = flatten([ @@ -494,7 +462,6 @@ 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] include -include bez = flatten([ bez_begin ([-50,0,0], 90, 25, p=90), @@ -512,7 +479,6 @@ 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] include -include bez = flatten([ bez_begin([-50,0,0], [0,25,0]), @@ -531,7 +497,6 @@ 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] include -include bez = flatten([ bez_begin([-50,0,0], BACK, 25), @@ -550,7 +515,6 @@ We can use a 2D Bézier path to define the shape of our bud vase as we did in th ```openscad-3d,Big include -include //Side Bézier Path side_bez = [[20,0], [40,40], [-10,70], [20,100]]; diff --git a/vnf.scad b/vnf.scad index 441da0b..6ed86fa 100644 --- a/vnf.scad +++ b/vnf.scad @@ -322,7 +322,6 @@ function vnf_vertex_array( // vnf_wireframe(vnf,width=0.1); // 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. -// include // bez = [ // [[0,26], [35,26], [29,0], [80,16], [102,0]], //top // [[99,-1], [79,15], [28,-1], [34,25], [-1,25]] // bottom @@ -1443,7 +1442,6 @@ function projection(vnf,cut=false,eps=EPSILON) = // vnf4=vnf_join([vnf3, zflip(vnf3,1)]); // 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. -// include // patch=[ // [[10,-10,0],[1,-1,0],[-1,-1,0],[-10,-10,0]], // [[10,-10,20],[1,-1,20],[-1,-1,20],[-10,-10,20]] @@ -1452,7 +1450,6 @@ function projection(vnf,cut=false,eps=EPSILON) = // vnfcut = vnf_halfspace([-.8,0,-1,-14],vnf); // vnf_polyhedron(vnfcut); // Example: Setting closed to false eliminates this (possibly invalid) face: -// include // patch=[ // [[10,-10,0],[1,-1,0],[-1,-1,0],[-10,-10,0]], // [[10,-10,20],[1,-1,20],[-1,-1,20],[-10,-10,20]] @@ -1775,7 +1772,6 @@ function _sort_pairs0(arr) = // 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 // 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 // patch = [ // // u=0,v=0 u=1,v=0 // [[-50,-50, 0], [-16,-50, 20], [ 16,-50, -20], [50,-50, 0]],