1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-29 01:11:30 +02:00

use [each lt, v] to replace concat(lt, [v])

This commit is contained in:
Justin Lin
2022-02-28 11:22:58 +08:00
parent 9a143a9f72
commit e04381bdea
10 changed files with 36 additions and 40 deletions

View File

@@ -1,5 +1,6 @@
use <experimental/tile_truchet.scad>;
use <polyline_join.scad>;
use <polyhedra/icosahedron.scad>;
radius = 15;
height = 10;
@@ -12,28 +13,23 @@ module tiled_line_ring(radius, height, line_diameter) {
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]
]
]
);
lines = [
for(tile = tile_truchet(size))
let(
x = tile[0],
y = tile[1],
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]
]
];
a = 360 / size[0];
for(line = lines) {
pts = [
@@ -41,7 +37,7 @@ module tiled_line_ring(radius, height, line_diameter) {
[radius * cos(a * p[0]), radius * sin(a * p[0]), p[1]]
];
polyline_join(pts)
sphere(half_line_diameter);
icosahedron(half_line_diameter);
}
}