1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00
dotSCAD/examples/differential_line_growth_bowl.scad

46 lines
1.1 KiB
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <shape_circle.scad>
use <midpt_smooth.scad>
use <polyline_join.scad>
use <in_shape.scad>
use <polyhedra/icosahedron.scad>
use <triangle/tri_delaunay.scad>
use <triangle/tri_incenter.scad>
use <surface/sf_thickenT.scad>
use <experimental/differential_line_growth.scad>
use <experimental/ptf_c2sphere.scad>
2022-05-28 15:59:17 +08:00
$fn = 24;
r = 10;
2022-05-29 12:11:39 +08:00
times = 50;
2022-05-28 15:59:17 +08:00
line_r = 2;
smooth = true;
smooth_times = 2;
2022-05-29 12:10:35 +08:00
filled = true;
2022-05-28 15:59:17 +08:00
node_option = [
0.4, // maxForce
0.5, // maxSpeed
5, // separationDistance
1.2, // separationCohesionRatio
4 // maxEdgeLength
];
init_shape = shape_circle(r);
poly = differential_line_growth(init_shape, node_option, times);
smoothed = smooth ? midpt_smooth(poly, smooth_times, true) : poly;
2022-05-29 11:28:48 +08:00
sphere_r = norm(max(smoothed));
2022-05-29 12:09:50 +08:00
sphere_path = [for(p = smoothed) ptf_c2sphere(p, sphere_r)];
2022-05-29 12:10:35 +08:00
if(filled) {
triangles = [
for(t = tri_delaunay(smoothed))
let(tri = [for(i = t) smoothed[i]])
if(in_shape(smoothed, tri_incenter(tri))) t
];
2022-05-29 12:09:50 +08:00
2022-05-29 12:10:35 +08:00
sf_thickenT(sphere_path, line_r, triangles);
}
2022-05-29 12:09:50 +08:00
polyline_join([each sphere_path, sphere_path[0]])
2022-05-28 15:59:17 +08:00
icosahedron(line_r);