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

37 lines
900 B
OpenSCAD
Raw Normal View History

2022-06-06 13:11:46 +08:00
use <experimental/tile_truchet.scad>
use <polyline_join.scad>
use <ptf/ptf_ring.scad>
2020-02-13 17:40:44 +08:00
2020-02-15 21:09:26 +08:00
size = [20, 100];
2021-02-18 10:45:44 +08:00
line_diameter = 1;
2020-02-15 21:09:26 +08:00
twist = 180;
$fn = 8;
2021-07-30 11:06:47 +08:00
module tiled_line_mobius(size, twist, line_diameter = 1) {
2020-02-13 17:40:44 +08:00
lines = concat(
[
2021-07-30 11:06:47 +08:00
for(tile = tile_truchet(size))
let(
2022-04-06 12:11:38 +08:00
x = tile.x,
y = tile.y
2021-07-30 11:06:47 +08:00
)
2022-04-06 12:11:38 +08:00
tile[2] <= 1 ? [[x, y], [x + 1, y + 1]] : [[x + 1, y], [x, y + 1]]
2020-02-13 17:40:44 +08:00
],
[
2021-07-30 11:06:47 +08:00
for(i = [0:size[1] - 1])
[[0, i], [0, i + 1]]
2020-02-13 17:40:44 +08:00
],
[
2021-07-30 11:06:47 +08:00
for(i = [0:size[1] - 1])
[[size[0], i], [size[0], i + 1]]
2020-02-13 17:40:44 +08:00
]
);
2020-02-13 20:56:00 +08:00
2021-10-08 09:36:01 +08:00
half_line_diameter = line_diameter / 2;
2020-02-13 17:40:44 +08:00
for(line = lines) {
2020-02-24 10:10:51 +08:00
pts = [for(p = line) ptf_ring(size, p, size[0], twist = twist)];
2021-10-08 09:36:01 +08:00
polyline_join(pts) sphere(half_line_diameter);
2020-02-13 17:40:44 +08:00
}
}
2021-07-30 11:06:47 +08:00
tiled_line_mobius(size, twist, line_diameter);