mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-26 07:55:16 +02:00
add example
This commit is contained in:
@@ -12,9 +12,7 @@ function _catmull_rom_spline_4pts(t_step, points, tightness) =
|
|||||||
bezier_curve(t_step, [points[1], p1x, p2x, points[2]]);
|
bezier_curve(t_step, [points[1], p1x, p2x, points[2]]);
|
||||||
|
|
||||||
function catmull_rom_spline(t_step, points, tightness = 0) =
|
function catmull_rom_spline(t_step, points, tightness = 0) =
|
||||||
let(
|
let(leng = len(points))
|
||||||
leng = len(points)
|
|
||||||
)
|
|
||||||
concat(
|
concat(
|
||||||
[
|
[
|
||||||
for(i = [0:leng - 4])
|
for(i = [0:leng - 4])
|
||||||
@@ -25,4 +23,28 @@ function catmull_rom_spline(t_step, points, tightness = 0) =
|
|||||||
],
|
],
|
||||||
[points[leng - 2]]
|
[points[leng - 2]]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
use <experimental/catmull_rom_spline.scad>;
|
||||||
|
use <hull_polyline3d.scad>;
|
||||||
|
|
||||||
|
pts = [
|
||||||
|
[280, 20, 10],
|
||||||
|
[150, 80, -100],
|
||||||
|
[20, 140, 50],
|
||||||
|
[280, 140, 20],
|
||||||
|
[150, 210, 90],
|
||||||
|
[20, 280, 0]
|
||||||
|
];
|
||||||
|
|
||||||
|
#for(pt = pts) {
|
||||||
|
translate(pt)
|
||||||
|
sphere(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
t_step = 0.1;
|
||||||
|
tightness = 0;
|
||||||
|
points = catmull_rom_spline(t_step, pts, tightness);
|
||||||
|
|
||||||
|
hull_polyline3d(points, 5);
|
||||||
|
*/
|
Reference in New Issue
Block a user