mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-06 14:56:47 +02:00
add tiled_line_ring
This commit is contained in:
48
examples/tiles/tiled_line_ring.scad
Normal file
48
examples/tiles/tiled_line_ring.scad
Normal 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);
|
Reference in New Issue
Block a user