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

32 lines
791 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_torus.scad>
2020-02-15 21:11:09 +08:00
size = [20, 50];
2021-02-18 10:45:44 +08:00
line_diameter = 1;
2020-02-15 21:11:09 +08:00
twist = 180;
$fn = 4;
2021-07-30 11:02:42 +08:00
module tiled_line_torus(size, twist, line_diameter = 1) {
lines = [
for(tile = tile_truchet(size))
let(
2022-04-06 17:02:32 +08:00
x = tile.x,
y = tile.y
2021-07-30 11:02:42 +08:00
)
2022-04-06 17:02:32 +08:00
tile[2] <= 1 ? [[x, y], [x + 1, y + 1]] : [[x + 1, y], [x, y + 1]]
2021-07-30 11:02:42 +08:00
];
2020-02-15 21:11:09 +08:00
2021-10-08 09:36:01 +08:00
half_line_diameter = line_diameter / 2;
2020-02-15 21:11:09 +08:00
for(line = lines) {
2020-02-24 10:10:51 +08:00
pts = [for(p = line) ptf_torus(size, p, [size[0], size[0] / 2], twist = twist)];
2021-10-08 09:36:01 +08:00
polyline_join(pts)
sphere(half_line_diameter);
2020-02-15 21:11:09 +08:00
}
}
2021-07-30 11:02:42 +08:00
tiled_line_torus(size, twist, line_diameter);
2020-02-15 21:11:09 +08:00
color("black")
rotate_extrude($fn = 36)
translate([size[0] * 1.5, 0, 0])
2021-07-30 11:02:42 +08:00
circle(size[0] / 2);