1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-04-14 11:11:55 +02:00

added bazier_surface

This commit is contained in:
Justin Lin 2017-04-08 08:57:57 +08:00
parent d3c5fecc58
commit 1e20f0235d
5 changed files with 54 additions and 0 deletions

View File

@ -46,6 +46,7 @@ Some modules may depend on other modules. For example, the `polyline2d` module d
- Path
- [circle_path](https://openhome.cc/eGossip/OpenSCAD/lib-circle_path.html)
- [bezier_curve](https://openhome.cc/eGossip/OpenSCAD/lib-bezier_curve.html)
- [bezier_surface](https://openhome.cc/eGossip/OpenSCAD/lib-bezier_surface.html)
- [helix](https://openhome.cc/eGossip/OpenSCAD/lib-helix.html)
- [archimedean_spiral](https://openhome.cc/eGossip/OpenSCAD/lib-archimedean_spiral.html)
- [sphere_spiral](https://openhome.cc/eGossip/OpenSCAD/lib-sphere_spiral.html)

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -0,0 +1,37 @@
# bezier_surface
Given a set of control points, the `bezier_surface` function returns points of the Bézier surface. Combined with the `function_grapher` module defined in my lib-openscad, you can create a Bézier surface.
It depends on the `bezier_curve` function so remember to include bezier_curve.scad.
## Parameters
- `t_step` : The distance between two points of the Bézier path.
- `points` : A set of control points. See examples below.
## Examples
If you have 16 control points and combine with the `function_grapher` module:
include <bezier_curve.scad>;
include <bezier_surface.scad>;
include <function_grapher.scad>;
t_step = 0.05;
thickness = 0.5;
ctrl_pts = [
[[0, 0, 20], [60, 0, -35], [90, 0, 60], [200, 0, 5]],
[[0, 50, 30], [100, 60, -25], [120, 50, 120], [200, 50, 5]],
[[0, 100, 0], [60, 120, 35], [90, 100, 60], [200, 100, 45]],
[[0, 150, 0], [60, 150, -35], [90, 180, 60], [200, 150, 45]]
];
g = bezier_surface(t_step, ctrl_pts);
function_grapher(g, thickness);
![bezier_surface](images/lib-bezier_surface-1.JPG)
The following figure shows controll points and bazier curves around the surface.
![bezier_surface](images/lib-bezier_surface-2.JPG)

View File

@ -1,3 +1,19 @@
/**
* bezier_surface.scad
*
* Given a set of control points, the bezier_surface function returns points of the Bézier surface.
* Combined with the function_grapher module defined in my lib-openscad,
* you can create a Bézier surface.
*
* It depends on the bezier_curve function so remember to include bezier_curve.scad.
*
* @copyright Justin Lin, 2017
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib-bezier_surface.html
*
**/
function bezier_surface(t_step, ctrl_pts) =
let(pts = [
for(i = [0:len(ctrl_pts) - 1])