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

44 lines
995 B
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <experimental/tile_truchet.scad>
use <polyline_join.scad>
use <polyhedra/icosahedron.scad>
2021-11-14 10:39:13 +08:00
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 = [
for(tile = tile_truchet(size))
let(
2022-04-06 17:02:32 +08:00
x = tile.x,
y = tile.y,
i = tile[2]
)
if(i <= 1) [
[x * half_line_diameter, y * line_diameter],
[(x + 1) * half_line_diameter, (y + 1) * line_diameter]
]
else [
[(x + 1) * half_line_diameter, y * line_diameter],
[x * half_line_diameter, (y + 1) * line_diameter]
]
];
2021-11-14 10:39:13 +08:00
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)
icosahedron(half_line_diameter);
2021-11-14 10:39:13 +08:00
}
}
tiled_line_ring(radius, height, line_diameter);