You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
14
13
15
14
```openscad-2D
16
15
include<BOSL2/std.scad>
17
-
include<BOSL2/beziers.scad>
18
16
19
17
bez = [[0,0], [30,60], [0,100]];
20
18
debug_bezier(bez, N = 2);
@@ -24,7 +22,6 @@ If we move any of the control points, we change the shape of the curve.
24
22
25
23
```openscad-2D
26
24
include<BOSL2/std.scad>
27
-
include<BOSL2/beziers.scad>
28
25
29
26
bez = [[0,0], [100,50], [0,100]];
30
27
debug_bezier(bez, N = 2);
@@ -36,7 +33,6 @@ Cubic Bézier curves (degree 3) are defined by cubic polynomials. A cubic Bézie
36
33
37
34
```openscad-2D
38
35
include<BOSL2/std.scad>
39
-
include<BOSL2/beziers.scad>
40
36
41
37
bez = [[20,0], [100,40], [50,90], [25,80]];
42
38
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
46
42
47
43
```openscad-2D
48
44
include<BOSL2/std.scad>
49
-
include<BOSL2/beziers.scad>
50
45
51
46
bez = [[20,0], [60,40], [-20,50], [25,80]];
52
47
debug_bezier(bez, N = 3);
@@ -63,7 +58,6 @@ Higher order Béziers such as Quartic (degree 4) and Quintic (degree 5) Béziers
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.
244
226
245
227
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].
246
228
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]].
@@ -282,7 +261,6 @@ Keep in mind the fact that **$fn** controls the smoothness of the [rotate_sweep(
282
261
283
262
```openscad-3D NoAxes VPD=400 VPT=[45,45,10] Big
284
263
include<BOSL2/std.scad>
285
-
include<BOSL2/beziers.scad>
286
264
287
265
$fn = 72;
288
266
@@ -311,7 +289,6 @@ First, you can specify the endpoints by vectors and the control points by angle,
311
289
312
290
```openscad-2D
313
291
include<BOSL2/std.scad>
314
-
include<BOSL2/beziers.scad>
315
292
bez = flatten([
316
293
bez_begin([0,0], 45, 42.43),
317
294
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
323
300
324
301
```openscad-2D
325
302
include<BOSL2/std.scad>
326
-
include<BOSL2/beziers.scad>
327
303
bez = flatten([
328
304
bez_begin([0,0], [30,30]),
329
305
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
335
311
336
312
```openscad-2D
337
313
include<BOSL2/std.scad>
338
-
include<BOSL2/beziers.scad>
339
314
bez = flatten([
340
315
bez_begin([0,0], BACK+RIGHT, 42.43),
341
316
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
349
324
350
325
```openscad-2D
351
326
include<BOSL2/std.scad>
352
-
include<BOSL2/beziers.scad>
353
327
bez = flatten([
354
328
bez_begin([0,0], 45, 42.43),
355
329
bez_joint([40,20], 90,0, 30,30),
@@ -358,13 +332,12 @@ bez = flatten([
358
332
debug_bezier(bez,N=3);
359
333
```
360
334
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.
362
336
363
337
We can add a smooth joint to the last example:
364
338
365
339
```openscad-2D
366
340
include<BOSL2/std.scad>
367
-
include<BOSL2/beziers.scad>
368
341
bez = flatten([
369
342
bez_begin([0,0], 45, 42.43),
370
343
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
378
351
379
352
```openscad-2D
380
353
include<BOSL2/std.scad>
381
-
include<BOSL2/beziers.scad>
382
354
bez = flatten([
383
355
bez_begin([0,0], [30,30]),
384
356
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
403
375
404
376
```openscad-2D
405
377
include<BOSL2/std.scad>
406
-
include<BOSL2/beziers.scad>
407
378
408
379
r = 50; // radius of the circle
409
380
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
424
395
425
396
```openscad-2D
426
397
include<BOSL2/std.scad>
427
-
include<BOSL2/beziers.scad>
428
398
429
399
bez = flatten([
430
400
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
0 commit comments