Skip to content

Commit 76ea1eb

Browse files
Merge pull request #1537 from amatulic/anachronist_dev
include beziers.scad in std.scad, remove include line from all other files containing it
2 parents 5e96d17 + 90ef497 commit 76ea1eb

12 files changed

+8
-54
lines changed

WRITING_DOCS.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ To declare what code the user needs to add to their code to include or use this
135135

136136
// Includes:
137137
// include <BOSL2/std.scad>
138-
// include <BOSL2/beziers.scad>
138+
// include <BOSL2/gears.scad>
139139

140140
Which outputs Markdown code that renders like:
141141

@@ -145,7 +145,7 @@ Which outputs Markdown code that renders like:
145145
>
146146
> ```openscad
147147
> include <BOSL2/std.scad>
148-
> include <BOSL2/beziers.scad>
148+
> include <BOSL2/gears.scad>
149149
> ```
150150
151151

beziers.scad

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// computing the Bezier curves and surfaces given by the control points,
99
// Includes:
1010
// include <BOSL2/std.scad>
11-
// include <BOSL2/beziers.scad>
1211
// FileGroup: Advanced Modeling
1312
// FileSummary: Bezier curves and surfaces.
13+
// FileFootnotes: STD=Included in std.scad
1414
//////////////////////////////////////////////////////////////////////
1515

1616
// Terminology:

examples/BOSL2logo.scad

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
include <BOSL2/std.scad>
22
include <BOSL2/gears.scad>
3-
include <BOSL2/beziers.scad>
43
include <BOSL2/screws.scad>
54
include <BOSL2/cubetruss.scad>
65

examples/spherical_patch.scad

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
include <BOSL2/std.scad>
2-
include <BOSL2/beziers.scad>
32

43
// Makes a pseudo-sphere from a rectangular patch and its mirror.
54
s = 50/sqrt(2);

miscellaneous.scad

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ module extrude_from_to(pt1, pt2, convexity, twist, scale, slices) {
9090
// path_extrude2d(arc(d=100,angle=[180,270]),caps=true)
9191
// trapezoid(w1=10, w2=5, h=10, anchor=BACK);
9292
// Example:
93-
// include <BOSL2/beziers.scad>
9493
// path = bezpath_curve([
9594
// [-50,0], [-25,50], [0,0], [50,0]
9695
// ]);

nurbs.scad

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
//////////////////////////////////////////////////////////////////////
1616

1717
include<BOSL2/std.scad>
18-
include<BOSL2/beziers.scad>
1918

2019
// Section: NURBS Curves
2120

rounding.scad

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// FileGroup: Advanced Modeling
1212
// FileSummary: Round path corners, rounded prisms, rounded cutouts in tubes, filleted prism joints
1313
//////////////////////////////////////////////////////////////////////
14-
include <beziers.scad>
1514
include <structs.scad>
1615

1716
// Section: Types of Roundovers

shapes2d.scad

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
//////////////////////////////////////////////////////////////////////
1717

1818
use <builtins.scad>
19-
include <beziers.scad>
2019

2120

2221

skin.scad

-1
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,6 @@ function linear_sweep(
934934
// texture=tex, tex_size=[20,20],
935935
// tex_depth=1, style="concave");
936936
// Example:
937-
// include <BOSL2/beziers.scad>
938937
// bezpath = [
939938
// [15, 30], [10,15],
940939
// [10, 0], [20, 10], [30,12],

std.scad

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ include <distributors.scad>
1616
include <miscellaneous.scad>
1717
include <color.scad>
1818
include <attachments.scad>
19+
include <beziers.scad>
1920
include <shapes3d.scad>
2021
include <shapes2d.scad>
2122
include <drawing.scad>

tutorials/Beziers_for_Beginners.md

+4-40
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ Quadratic Béziers, i.e. Bezier's of degree 2, are defined by [quadratic polynom
99
![Image courtesy Wikipedia](images/bezier_2_big.gif "Quadratic Bézier Animation courtesy Wikipedia")
1010

1111

12-
1312
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.
1413

1514
```openscad-2D
1615
include<BOSL2/std.scad>
17-
include<BOSL2/beziers.scad>
1816
1917
bez = [[0,0], [30,60], [0,100]];
2018
debug_bezier(bez, N = 2);
@@ -24,7 +22,6 @@ If we move any of the control points, we change the shape of the curve.
2422

2523
```openscad-2D
2624
include<BOSL2/std.scad>
27-
include<BOSL2/beziers.scad>
2825
2926
bez = [[0,0], [100,50], [0,100]];
3027
debug_bezier(bez, N = 2);
@@ -36,7 +33,6 @@ Cubic Bézier curves (degree 3) are defined by cubic polynomials. A cubic Bézie
3633

3734
```openscad-2D
3835
include<BOSL2/std.scad>
39-
include<BOSL2/beziers.scad>
4036
4137
bez = [[20,0], [100,40], [50,90], [25,80]];
4238
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
4642

4743
```openscad-2D
4844
include<BOSL2/std.scad>
49-
include<BOSL2/beziers.scad>
5045
5146
bez = [[20,0], [60,40], [-20,50], [25,80]];
5247
debug_bezier(bez, N = 3);
@@ -63,7 +58,6 @@ Higher order Béziers such as Quartic (degree 4) and Quintic (degree 5) Béziers
6358

6459
```openscad-2D;Anim;FrameMS=2000;Frames=4;VPT=[50,50,40];ImgOnly
6560
include<BOSL2/std.scad>
66-
include<BOSL2/beziers.scad>
6761
6862
bez = [
6963
[[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
8074

8175
```openscad-2D;FlatSpin,VPR=[80,0,360*$t],VPT=[0,0,20],VPD=175
8276
include<BOSL2/std.scad>
83-
include<BOSL2/beziers.scad>
8477
8578
bez = [[10,0,10], [30,30,-10], [-30,30,40], [-10,0,30]];
8679
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
10093

10194
```openscad-2D
10295
include<BOSL2/std.scad>
103-
include<BOSL2/beziers.scad>
10496
10597
bez = [[0,0], [30,30], [0,50], {70,30] [0,100]];
10698
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
110102
111103
```openscad-2D
112104
include<BOSL2/std.scad>
113-
include<BOSL2/beziers.scad>
114105
115106
bez = [[20,0], [60,40], [-20,50], [25,80]];
116107
debug_bezier(bez, N = 3);
@@ -121,7 +112,6 @@ color("red") stroke(bez);
121112

122113
```openscad-2D
123114
include<BOSL2/std.scad>
124-
include<BOSL2/beziers.scad>
125115
126116
bez = [[20,0], [60,40], [-20,50], [25,80]];
127117
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
134124

135125
```openscad-2D
136126
include<BOSL2/std.scad>
137-
include<BOSL2/beziers.scad>
138127
139128
bez = [[0,0], [10,30], [20,0], [30,-30], [40,0], [50,30],[60,0]];
140129
path = bezpath_curve(bez, N = 2); //make a quadratic Bézier path
@@ -143,7 +132,6 @@ stroke(path);
143132

144133
```openscad-2D
145134
include<BOSL2/std.scad>
146-
include<BOSL2/beziers.scad>
147135
148136
bez = [[0,0], [10,30], [20,0], [30,-30], [40,0], [50,30],[60,0]];
149137
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
154142

155143
```openscad-2D
156144
include<BOSL2/std.scad>
157-
include<BOSL2/beziers.scad>
158145
159146
bez = [[20,0], [60,40], [-20,50], [25,80]];
160147
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
165152

166153
```openscad-2D
167154
include<BOSL2/std.scad>
168-
include<BOSL2/beziers.scad>
169155
170156
bez = [[20,0], [60,40], [-20,50], [25,80]];
171157
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
177163

178164
```openscad-3D VPR = [80,0,20]
179165
include<BOSL2/std.scad>
180-
include<BOSL2/beziers.scad>
181166
$fn = 72;
182167
183168
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
190175

191176
```openscad-2D
192177
include<BOSL2/std.scad>
193-
include<BOSL2/beziers.scad>
194178
$fn = 72;
195179
196180
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
207191

208192
```openscad-2D
209193
include<BOSL2/std.scad>
210-
include<BOSL2/beziers.scad>
211194
include<BOSL2/rounding.scad>
212195
$fn = 72;
213196
@@ -230,7 +213,6 @@ Sweeping a Bézier path offset using any of the three methods around the y-axis
230213

231214
```openscad-3D, VPT=[0,60,40], VPR=[90,0,0], VPD=250
232215
include<BOSL2/std.scad>
233-
include<BOSL2/beziers.scad>
234216
include<BOSL2/rounding.scad>
235217
236218
$fn = 72;
@@ -240,16 +222,14 @@ path = offset_stroke(bezier_curve(bez, splinesteps = 32), [2,0]);
240222
back_half(s = 200) rotate_sweep(path,360);
241223
```
242224

243-
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.
225+
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.
244226

245227
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].
246228

247-
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]].
229+
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]].
248230

249231
```openscad-2D
250232
include<BOSL2/std.scad>
251-
include<BOSL2/beziers.scad>
252-
253233
254234
bez = [[15,0], [60,40], [-25,50], [25,80]];
255235
debug_bezier(bez, N = 3);
@@ -260,11 +240,10 @@ echo(bezier_points(bez,u)); // [[17.1687, 2]]
260240
261241
```
262242

263-
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.
243+
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.
264244

265245
```openscad-3D, VPT=[0,60,12], VPR=[90,0,0], VPD=150
266246
include<BOSL2/std.scad>
267-
include<BOSL2/beziers.scad>
268247
include<BOSL2/rounding.scad>
269248
270249
$fn = 72;
@@ -282,7 +261,6 @@ Keep in mind the fact that **$fn** controls the smoothness of the [rotate_sweep(
282261

283262
```openscad-3D NoAxes VPD=400 VPT=[45,45,10] Big
284263
include<BOSL2/std.scad>
285-
include<BOSL2/beziers.scad>
286264
287265
$fn = 72;
288266
@@ -311,7 +289,6 @@ First, you can specify the endpoints by vectors and the control points by angle,
311289

312290
```openscad-2D
313291
include<BOSL2/std.scad>
314-
include<BOSL2/beziers.scad>
315292
bez = flatten([
316293
bez_begin([0,0], 45, 42.43),
317294
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
323300

324301
```openscad-2D
325302
include<BOSL2/std.scad>
326-
include<BOSL2/beziers.scad>
327303
bez = flatten([
328304
bez_begin([0,0], [30,30]),
329305
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
335311

336312
```openscad-2D
337313
include<BOSL2/std.scad>
338-
include<BOSL2/beziers.scad>
339314
bez = flatten([
340315
bez_begin([0,0], BACK+RIGHT, 42.43),
341316
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
349324

350325
```openscad-2D
351326
include<BOSL2/std.scad>
352-
include<BOSL2/beziers.scad>
353327
bez = flatten([
354328
bez_begin([0,0], 45, 42.43),
355329
bez_joint([40,20], 90,0, 30,30),
@@ -358,13 +332,12 @@ bez = flatten([
358332
debug_bezier(bez,N=3);
359333
```
360334

361-
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.
335+
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.
362336

363337
We can add a smooth joint to the last example:
364338

365339
```openscad-2D
366340
include<BOSL2/std.scad>
367-
include<BOSL2/beziers.scad>
368341
bez = flatten([
369342
bez_begin([0,0], 45, 42.43),
370343
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
378351

379352
```openscad-2D
380353
include<BOSL2/std.scad>
381-
include<BOSL2/beziers.scad>
382354
bez = flatten([
383355
bez_begin([0,0], [30,30]),
384356
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
403375

404376
```openscad-2D
405377
include<BOSL2/std.scad>
406-
include<BOSL2/beziers.scad>
407378
408379
r = 50; // radius of the circle
409380
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
424395

425396
```openscad-2D
426397
include<BOSL2/std.scad>
427-
include<BOSL2/beziers.scad>
428398
429399
bez = flatten([
430400
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
438408

439409
```openscad-3D,Big,NoScales,VPR=[0,0,0],VPT=[100,25,0],VPF=22
440410
include<BOSL2/std.scad>
441-
include<BOSL2/beziers.scad>
442411
443412
bez = flatten([
444413
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
468437

469438
```openscad-3d
470439
include<BOSL2/std.scad>
471-
include<BOSL2/beziers.scad>
472440
include<BOSL2/rounding.scad>
473441
474442
bez = flatten([
@@ -494,7 +462,6 @@ The path by angle constructors can be used to create 3D Bézier paths by specify
494462

495463
```openscad-3D,FlatSpin,NoScales,VPR=[85,0,360*$t],VPT=[0,0,20]
496464
include<BOSL2/std.scad>
497-
include<BOSL2/beziers.scad>
498465
499466
bez = flatten([
500467
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
512479

513480
```openscad-3D,FlatSpin,NoScales,VPR=[80,0,360*$t],,VPT=[0,0,20]
514481
include<BOSL2/std.scad>
515-
include<BOSL2/beziers.scad>
516482
517483
bez = flatten([
518484
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
531497

532498
```openscad-3D,FlatSpin,NoScales,VPR=[80,0,360*$t],,VPT=[0,0,20]
533499
include<BOSL2/std.scad>
534-
include<BOSL2/beziers.scad>
535500
536501
bez = flatten([
537502
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
550515

551516
```openscad-3d,Big
552517
include<BOSL2/std.scad>
553-
include<BOSL2/beziers.scad>
554518
555519
//Side Bézier Path
556520
side_bez = [[20,0], [40,40], [-10,70], [20,100]];

0 commit comments

Comments
 (0)