1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-10 16:54:23 +02:00

add sf_hull

This commit is contained in:
Justin Lin
2021-06-21 08:34:45 +08:00
parent f00402b0d1
commit dfaa75e2b0

49
src/surface/sf_hull.scad Normal file
View File

@@ -0,0 +1,49 @@
module sf_hull(points, thickness) {
rows = len(points);
columns = len(points[0]);
yi_range = [0:rows - 2];
xi_range = [0:columns - 2];
half_thickness = thickness / 2;
module hull_pts(tri) {
hull() {
translate(tri[0]) sphere(half_thickness);
translate(tri[1]) sphere(half_thickness);
translate(tri[2]) sphere(half_thickness);
}
}
module tri_to_hull_faces(tri1, tri2) {
hull_pts(tri1);
hull_pts(tri2);
}
twintri_lt =
[
for(yi = yi_range)
for(xi = xi_range)
[
[
points[yi][xi],
points[yi][xi + 1],
points[yi + 1][xi]
],
[
points[yi + 1][xi],
points[yi][xi + 1],
points[yi + 1][xi + 1]
]
]
];
for(twintri = twintri_lt) {
tri_to_hull_faces(twintri[0], twintri[1]);
}
}
// override it to test
module test_function_grapher_faces(points, faces) {
}