2017-04-08 06:48:36 +08:00
# bezier_curve
2017-03-22 10:47:09 +08:00
2017-04-26 17:24:47 +08:00
Given a set of control points, the `bezier_curve` function returns points of the Bézier path. Combined with the `polyline` , `polyline3d` or `hull_polyline3d` module defined in my library, you can create a Bézier curve.
2017-03-22 10:47:09 +08:00
## Parameters
- `t_step` : The distance between two points of the Bézier path.
2019-07-28 18:24:18 +08:00
- `points` : A set of `[x, y]` or `[x, y, z]` control points.
2017-03-22 10:47:09 +08:00
## Examples
If you have four control points and combine with the `hull_polyline3d` module:
2017-04-07 15:57:55 +08:00
include < hull_polyline3d.scad > ;
2017-04-08 06:48:36 +08:00
include < bezier_curve.scad > ;
2017-03-30 14:22:48 +08:00
2017-03-22 10:47:09 +08:00
t_step = 0.05;
width = 2;
p0 = [0, 0, 0];
p1 = [40, 60, 35];
p2 = [-50, 90, 0];
p3 = [0, 200, -35];
2017-04-08 06:48:36 +08:00
points = bezier_curve(t_step,
2017-03-22 10:47:09 +08:00
[p0, p1, p2, p3]
);
hull_polyline3d(points, width);
2017-04-08 06:48:36 +08:00
![bezier_curve ](images/lib-bezier_curve-1.JPG )