diff --git a/README.md b/README.md index 6348a7c5..ab433223 100644 --- a/README.md +++ b/README.md @@ -241,9 +241,9 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp ### Voxel -- vx_contour -- vx_bezier +- [vx_bezier](https://openhome.cc/eGossip/OpenSCAD/lib2x-vx_bezier.html) - vx_curve +- vx_contour ### Maze diff --git a/docs/images/lib2x-vx_bezier-1.JPG b/docs/images/lib2x-vx_bezier-1.JPG new file mode 100644 index 00000000..156ea5ed Binary files /dev/null and b/docs/images/lib2x-vx_bezier-1.JPG differ diff --git a/docs/lib2x-vx_bezier.md b/docs/lib2x-vx_bezier.md new file mode 100644 index 00000000..f3c86351 --- /dev/null +++ b/docs/lib2x-vx_bezier.md @@ -0,0 +1,33 @@ +# vx_bezier + +Given 4 control points, returns voxel-by-voxel points of Bézier Curve . + +## Parameters + +- `p1` : The 1st control point. +- `p2` : The 2nd control point. +- `p3` : The 3rd control point. +- `p4` : The 4th control point. + +## Examples + + use ; + + t_step = 0.05; + width = 2; + + p1 = [0, 0, 0]; + p2 = [30, 15, 25]; + p3 = [-35, 20, -20]; + p4 = [10, 40, 9]; + + points = vx_bezier( + p1, p2, p3, p4 + ); + + for(p = points) { + translate(p) + cube(1); + } + +![vx_bezier](images/lib2x-vx_bezier-1.JPG) diff --git a/src/voxel/vx_bezier.scad b/src/voxel/vx_bezier.scad index eb973ec1..0b33f54b 100644 --- a/src/voxel/vx_bezier.scad +++ b/src/voxel/vx_bezier.scad @@ -1,3 +1,13 @@ +/** +* vx_bezier.scad +* +* @copyright Justin Lin, 2020 +* @license https://opensource.org/licenses/lgpl-3.0.html +* +* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-vx_bezier.html +* +**/ + use <__comm__/__to2d.scad>; use <__comm__/__to3d.scad>; use <_impl/_vx_bezier_impl.scad>;