1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 14:18:13 +01:00

add tiled_line_ring

This commit is contained in:
Justin Lin 2021-11-14 10:39:13 +08:00
parent f27250d285
commit 2600504dd5

View File

@ -0,0 +1,48 @@
use <experimental/tile_truchet.scad>;
use <polyline_join.scad>;
radius = 15;
height = 10;
line_diameter = 2;
$fn = 4;
module tiled_line_ring(radius, height, line_diameter) {
half_line_diameter = line_diameter / 2;
size = [
round(2 * radius * PI / line_diameter),
round(height / line_diameter)
];
lines = concat(
[
for(tile = tile_truchet(size))
let(
x = tile[0],
y = tile[1],
i = tile[2]
)
i <= 1 ?
[
[x * half_line_diameter, y * line_diameter],
[(x + 1) * half_line_diameter, (y + 1) * line_diameter]
]
:
[
[(x + 1) * half_line_diameter, y * line_diameter],
[x * half_line_diameter, (y + 1) * line_diameter]
]
]
);
a = 360 / size[0];
for(line = lines) {
pts = [
for(p = line)
[radius * cos(a * p[0]), radius * sin(a * p[0]), p[1]]
];
polyline_join(pts)
sphere(half_line_diameter);
}
}
tiled_line_ring(radius, height, line_diameter);