1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-20 05:21:38 +02:00

add sf_curve

This commit is contained in:
Justin Lin
2021-05-22 12:07:08 +08:00
parent 6d9e2d0822
commit 85449ed29e

29
src/surface/sf_curve.scad Normal file
View File

@@ -0,0 +1,29 @@
use <_impl/_sf_square_surfaces.scad>;
use <sf_solidify.scad>;
use <ptf/ptf_rotate.scad>;
module sf_curve(levels, points, thickness, depth, invert = false) {
rows = len(levels);
columns = len(levels[0]);
normal_vts = [
for(i = [0:columns - 1])
let(v = points[i + 1] - points[i])
ptf_rotate(v / norm(v), [0, -90, 0])
];
dp = is_undef(depth) ? thickness / 2 : depth;
surfaces = _sf_square_surfaces(levels, thickness, dp, invert);
function _curve(s) = [
for(y = [0:rows - 1])
[
for(x = [0:columns - 1])
let(p = points[x])
[p[0], y, p[2]] + normal_vts[x] * s[y][x][2]
]
];
sf_solidify(_curve(surfaces[0]), _curve(surfaces[1]));
}