From 498b15c59dd09c62a0c777dd1d9fcf14531d73d6 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 19 Nov 2020 08:22:50 +0800 Subject: [PATCH] move --- src/_impl/_catmull_rom_spline.scad | 12 ++++++++++++ src/{experimental => }/bauer_spiral.scad | 0 src/{experimental => }/catmull_rom_spline.scad | 15 ++------------- src/experimental/note.md | 7 +++++-- src/{experimental => }/fibonacci_lattice.scad | 0 5 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 src/_impl/_catmull_rom_spline.scad rename src/{experimental => }/bauer_spiral.scad (100%) rename src/{experimental => }/catmull_rom_spline.scad (57%) rename src/{experimental => }/fibonacci_lattice.scad (100%) diff --git a/src/_impl/_catmull_rom_spline.scad b/src/_impl/_catmull_rom_spline.scad new file mode 100644 index 00000000..d208a258 --- /dev/null +++ b/src/_impl/_catmull_rom_spline.scad @@ -0,0 +1,12 @@ +use ; + +function _catmull_rom_spline_4pts(t_step, points, tightness) = + let( + p1x_0tightness = (points[2] - points[0]) / 4 + points[1], + v_p1x = points[1] - p1x_0tightness, + p1x = p1x_0tightness + v_p1x * tightness, + p2x_0tightness = (points[1] - points[3]) / 4 + points[2], + v_p2x = points[2] - p2x_0tightness, + p2x = p2x_0tightness + v_p2x * tightness + ) + bezier_curve(t_step, [points[1], p1x, p2x, points[2]]); \ No newline at end of file diff --git a/src/experimental/bauer_spiral.scad b/src/bauer_spiral.scad similarity index 100% rename from src/experimental/bauer_spiral.scad rename to src/bauer_spiral.scad diff --git a/src/experimental/catmull_rom_spline.scad b/src/catmull_rom_spline.scad similarity index 57% rename from src/experimental/catmull_rom_spline.scad rename to src/catmull_rom_spline.scad index 06612241..298e374c 100644 --- a/src/experimental/catmull_rom_spline.scad +++ b/src/catmull_rom_spline.scad @@ -1,15 +1,4 @@ -use ; - -function _catmull_rom_spline_4pts(t_step, points, tightness) = - let( - p1x_0tightness = (points[2] - points[0]) / 4 + points[1], - v_p1x = points[1] - p1x_0tightness, - p1x = p1x_0tightness + v_p1x * tightness, - p2x_0tightness = (points[1] - points[3]) / 4 + points[2], - v_p2x = points[2] - p2x_0tightness, - p2x = p2x_0tightness + v_p2x * tightness - ) - bezier_curve(t_step, [points[1], p1x, p2x, points[2]]); +use <_impl/_catmull_rom_spline.scad>; function catmull_rom_spline(t_step, points, tightness = 0) = let(leng = len(points)) @@ -25,7 +14,7 @@ function catmull_rom_spline(t_step, points, tightness = 0) = ); /* -use ; +use ; use ; pts = [ diff --git a/src/experimental/note.md b/src/experimental/note.md index 51ac9026..816e5f6e 100644 --- a/src/experimental/note.md +++ b/src/experimental/note.md @@ -4,7 +4,10 @@ to_do: next: -- vx_contour - maze/* +- vx_contour - polygon_hull -- polyhedron_hull \ No newline at end of file +- polyhedron_hull +- catmull_rom_spline +- bauer_spiral +- fibonacci_lattice \ No newline at end of file diff --git a/src/experimental/fibonacci_lattice.scad b/src/fibonacci_lattice.scad similarity index 100% rename from src/experimental/fibonacci_lattice.scad rename to src/fibonacci_lattice.scad