From 0414c440a348413dd0f71797512d215bb6165809 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Wed, 4 May 2022 21:15:52 +0800 Subject: [PATCH] rename --- src/_impl/_bezier_curve_impl.scad | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/_impl/_bezier_curve_impl.scad b/src/_impl/_bezier_curve_impl.scad index ec98264a..c395a187 100644 --- a/src/_impl/_bezier_curve_impl.scad +++ b/src/_impl/_bezier_curve_impl.scad @@ -12,12 +12,12 @@ function _combi(n, k) = n < 4 ? bi_coef[n][k] : k == 0 ? 1 : (_combi(n, k - 1) * (n - k + 1) / k); -function bezier_curve_coordinate(t, pn, n, i) = +function bezier_curve_component(t, points, n, i) = let(one_t = 1 - t) - sum([for(j = [0:n]) _combi(n, j) * pn[j][i] * one_t ^ (n - j) * t ^ j]); + sum([for(j = [0:n]) _combi(n, j) * points[j][i] * one_t ^ (n - j) * t ^ j]); -function _bezier_curve(range, t, points, n) = - [for(i = range) bezier_curve_coordinate(t, points, n, i)]; +function _bezier_curve_coordinate(range, t, points, n) = + [for(i = range) bezier_curve_component(t, points, n, i)]; function _bezier_curve_impl(t_step, points) = let( @@ -26,6 +26,6 @@ function _bezier_curve_impl(t_step, points) = range = [0:len(points[0]) - 1] ) [ - each [for(t = 0; t < t_end; t = t + 1) _bezier_curve(range, t * t_step, points, n)], - _bezier_curve(range, 1, points, n) + each [for(t = 0; t < t_end; t = t + 1) _bezier_curve_coordinate(range, t * t_step, points, n)], + _bezier_curve_coordinate(range, 1, points, n) ];