mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-12 01:34:12 +02:00
refactor
This commit is contained in:
12
src/voxel/_impl/_vx_curve_impl.scad
Normal file
12
src/voxel/_impl/_vx_curve_impl.scad
Normal file
@@ -0,0 +1,12 @@
|
||||
use <../vx_bezier.scad>;
|
||||
|
||||
function _vx_catmull_rom_spline_4pts(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
|
||||
)
|
||||
vx_bezier(points[1], p1x, p2x, points[2]);
|
@@ -1,17 +1,16 @@
|
||||
/**
|
||||
* vx_curve.scad
|
||||
*
|
||||
* @copyright Justin Lin, 2020
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-vx_curve.html
|
||||
*
|
||||
**/
|
||||
|
||||
use <_impl/_vx_curve_impl.scad>;
|
||||
use <../util/sort.scad>;
|
||||
use <../util/dedup.scad>;
|
||||
use <vx_bezier.scad>;
|
||||
|
||||
function _vx_catmull_rom_spline_4pts(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
|
||||
)
|
||||
vx_bezier(points[1], p1x, p2x, points[2]);
|
||||
|
||||
function vx_curve(points, tightness = 0) =
|
||||
let(
|
||||
|
Reference in New Issue
Block a user