mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-05 06:17:32 +02:00
accept 2d points
This commit is contained in:
@@ -46,20 +46,21 @@ function _bspline_curve_v(v, s, t, degree, knots, l = 1) =
|
|||||||
|
|
||||||
function _bspline_curve_interpolate(t, degree, points, knots, weights) =
|
function _bspline_curve_interpolate(t, degree, points, knots, weights) =
|
||||||
let(
|
let(
|
||||||
|
d = len(points[0]),
|
||||||
n = len(points),
|
n = len(points),
|
||||||
kts = is_undef(knots) ? _bspline_curve_knots(n, degree) : knots,
|
kts = is_undef(knots) ? _bspline_curve_knots(n, degree) : knots,
|
||||||
wts = is_undef(weights) ? _bspline_curve_weights(n) : weights,
|
wts = is_undef(weights) ? _bspline_curve_weights(n) : weights,
|
||||||
v = [
|
v = [
|
||||||
for(i = 0; i < n; i = i + 1)
|
for(i = 0; i < n; i = i + 1)
|
||||||
let(p = points[i] * wts[i])
|
let(p = points[i] * wts[i])
|
||||||
[p[0], p[1], p[2], wts[i]]
|
concat([for(j = 0; j < d; j = j + 1) p[j]], [wts[i]])
|
||||||
],
|
],
|
||||||
ts = _bspline_curve_ts(t, degree, kts),
|
ts = _bspline_curve_ts(t, degree, kts),
|
||||||
nt = ts[0],
|
nt = ts[0],
|
||||||
s = ts[1],
|
s = ts[1],
|
||||||
nv = _bspline_curve_v(v, s, nt, degree, kts)
|
nv = _bspline_curve_v(v, s, nt, degree, kts)
|
||||||
)
|
)
|
||||||
[for(i = 0; i < 3; i = i + 1) nv[s][i] / nv[s][3]];
|
[for(i = 0; i < d; i = i + 1) nv[s][i] / nv[s][d]];
|
||||||
|
|
||||||
function bspline_curve(t_step, degree, points, knots, weights) =
|
function bspline_curve(t_step, degree, points, knots, weights) =
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user