1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00

add filled param

This commit is contained in:
Justin Lin
2022-05-29 12:10:35 +08:00
parent 4d611bb0b5
commit 0c534e6133

View File

@@ -15,6 +15,7 @@ times = 80;
line_r = 2; line_r = 2;
smooth = true; smooth = true;
smooth_times = 2; smooth_times = 2;
filled = true;
node_option = [ node_option = [
0.4, // maxForce 0.4, // maxForce
0.5, // maxSpeed 0.5, // maxSpeed
@@ -30,13 +31,15 @@ smoothed = smooth ? midpt_smooth(poly, smooth_times, true) : poly;
sphere_r = norm(max(smoothed)); sphere_r = norm(max(smoothed));
sphere_path = [for(p = smoothed) ptf_c2sphere(p, sphere_r)]; sphere_path = [for(p = smoothed) ptf_c2sphere(p, sphere_r)];
triangles = [ if(filled) {
for(t = tri_delaunay(smoothed)) triangles = [
let(tri = [for(i = t) smoothed[i]]) for(t = tri_delaunay(smoothed))
if(in_shape(smoothed, tri_incenter(tri))) t let(tri = [for(i = t) smoothed[i]])
]; if(in_shape(smoothed, tri_incenter(tri))) t
];
sf_thickenT(sphere_path, line_r, triangles); sf_thickenT(sphere_path, line_r, triangles);
}
polyline_join([each sphere_path, sphere_path[0]]) polyline_join([each sphere_path, sphere_path[0]])
icosahedron(line_r); icosahedron(line_r);