1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-26 16:04:46 +02:00

move into dir

This commit is contained in:
Justin Lin
2020-02-25 07:31:14 +08:00
parent 7513ae304e
commit 78613f76cd
2 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
use <hull_polyline3d.scad>;
use <util/rand.scad>;
use <experimental/tri_bisectors.scad>;
use <experimental/ptf_bend.scad>;
width = 5;
columns = 30;
rows = 15;
radius = 30;
angle = 360;
thickness = 2;
function h_lines_in_square(width) =
let(
w = width / 2,
i = ceil(rand() * 10) % 2,
tris = i == 0 ?
[
[[0, 0], [width, 0], [width, width]],
[[0, 0], [width, width], [0, width]]
]
:
[
[[width, 0], [0, width], [0, 0]],
[[width, 0], [width, width], [0, width]]
]
)
concat(tri_bisectors(tris[0]), tri_bisectors(tris[1]));
function hollow_out_square(size, width) =
let(
columns = size[0],
rows = size[1]
)
[
for(y = [0:width:width * rows - width])
for(x = [0:width:width * columns - width])
for(line = h_lines_in_square(width))
[for(p = line) p + [x, y]]
];
lines = concat(
hollow_out_square([columns, rows], width),
[[
for(x = [0:width:width * columns]) [x, rows * width]
]]
);
for(line = lines) {
transformed = [for(pt = line) ptf_bend([columns * width, rows * width], pt, radius, angle)];
hull_polyline3d(transformed, thickness, $fn = 4);
}
translate([0, 0, -thickness / 2])
linear_extrude(thickness)
rotate(180 / columns)
circle(radius + thickness / 2, $fn = columns);

View File

@@ -0,0 +1,35 @@
use <shape_starburst.scad>;
use <hull_polyline3d.scad>;
use <experimental/tri_bisectors.scad>;
r1 = 30;
r2 = 12;
h = 10;
n = 5;
thickness = 1.75;
half = true;
module hollow_out_starburst(r1, r2, h, n, thickness, half = false) {
star = [for(p = shape_starburst(r1, r2, n)) [p[0], p[1], 0]];
leng = len(star);
tris = concat(
[for(i = [0:leng - 2]) [[0, 0, h], star[i], star[i + 1]]],
[[[0, 0, h], star[leng - 1], star[0]]]
);
module half_star() {
for(tri = tris) {
hull_polyline3d(concat(tri, [tri[0]]), thickness = thickness);
for(line = tri_bisectors(tri)) {
hull_polyline3d(concat(line, [line[0]]), thickness = thickness);
}
}
}
half_star();
if(!half) {
mirror([0, 0, 1]) half_star();
}
}
hollow_out_starburst(r1, r2, h, n, thickness, half);