1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-21 14:04:53 +02:00

optimization

This commit is contained in:
Justin Lin
2022-05-14 21:02:48 +08:00
parent bcaf7fe67c
commit d330331494

View File

@@ -23,8 +23,8 @@ module sf_curve(levels, curve_path, thickness, depth, invert = false, convexity
// resample // resample
let(diff = leng_curve_path / columns) let(diff = leng_curve_path / columns)
[ [
for(i = [0:columns]) for(i = [each [0:columns]] * diff)
let(idx = floor(diff * i)) let(idx = floor(i))
curve_path[idx > to ? to : idx] curve_path[idx > to ? to : idx]
]; ];
@@ -48,10 +48,11 @@ module sf_curve(levels, curve_path, thickness, depth, invert = false, convexity
function _curve(s) = [ function _curve(s) = [
for(y = [0:rows - 1]) for(y = [0:rows - 1])
let(off = [0, y, 0], sy = s[y])
[ [
for(x = [0:columns - 1]) for(x = [0:columns - 1])
let(p = (pts[x] + pts[x + 1]) / 2) let(p = (pts[x] + pts[x + 1]) / 2)
p + [0, y, 0] + normal_vts[x] * s[y][x][2] p + off + normal_vts[x] *sy[x][2]
] ]
]; ];