1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-18 06:38:14 +01:00
dotSCAD/examples/hollow_out/hollow_out_cylinder.scad

41 lines
995 B
OpenSCAD
Raw Normal View History

2020-03-02 11:01:33 +08:00
use <hull_polyline3d.scad>;
use <experimental/tri_delaunay.scad>;
use <experimental/tri_bisectors.scad>;
2020-03-24 17:12:21 +08:00
use <ptf/ptf_bend.scad>;
2020-03-02 11:01:33 +08:00
size = [100, 40];
pt_nums = 20;
2021-02-18 10:45:44 +08:00
line_diameter = 1;
2020-03-02 11:01:33 +08:00
radius = 15;
fn = 12;
xs = rands(0, size[0], pt_nums);
ys = rands(0, size[1], pt_nums);
half_fn = fn / 2;
dx = size[0] / fn;
dy = size[1] / half_fn;
points = concat(
[
[0, 0], [size[0], 0],
[size[0], size[1]], [0, size[1]]
],
[for(i = [1:fn - 1]) [i * dx, 0]],
[for(i = [1:fn - 1]) [i * dx, size[1]]],
[for(i = [1:half_fn - 1]) [0, dy * i]],
[for(i = [1:half_fn - 1]) [size[0], dy * i]],
[for(i = [0:len(xs) - 1]) [xs[i], ys[i]]]
);
bisectors = [
for(tri = tri_delaunay(points))
each tri_bisectors([points[tri[0]], points[tri[1]], points[tri[2]]])
];
for(line = bisectors) {
pts = [for(p = line) ptf_bend(size, p, radius, 360)];
hull_polyline3d(
concat(pts, [pts[0]]),
2021-02-18 10:45:44 +08:00
line_diameter = line_diameter,
2020-03-02 11:01:33 +08:00
$fn = 4
);
}