1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-23 06:43:10 +02:00
This commit is contained in:
Justin Lin
2021-07-30 11:02:42 +08:00
parent 2e1959f3ef
commit 574e4b695a

View File

@@ -1,27 +1,22 @@
use <util/rand.scad>; use <experimental/tile_truchet.scad>;
use <hull_polyline3d.scad>; use <hull_polyline3d.scad>;
use <ptf/ptf_torus.scad>; use <ptf/ptf_torus.scad>;
size = [20, 50]; size = [20, 50];
line_diameter = 1; line_diameter = 1;
step = 1;
twist = 180; twist = 180;
$fn = 4; $fn = 4;
module tiled_line_torus(size, twist, step, line_diameter = 1) { module tiled_line_torus(size, twist, line_diameter = 1) {
sizexy = is_num(size) ? [size, size] : size; lines = [
s = is_undef(step) ? line_diameter * 2 : step; for(tile = tile_truchet(size))
let(
function rand_diagonal_line_pts(x, y, size) = x = tile[0],
rand(0, 1) >= 0.5 ? [[x, y], [x + size, y + size]] : [[x + size, y], [x, y + size]]; y = tile[1],
i = tile[2]
lines = concat( )
[ i <= 1 ? [[x, y], [x + 1, y + 1]] : [[x + 1, y], [x, y + 1]]
for(x = [0:s:sizexy[0] - s]) ];
for(y = [0:s:sizexy[1] - s])
rand_diagonal_line_pts(x, y, s)
]
);
for(line = lines) { for(line = lines) {
pts = [for(p = line) ptf_torus(size, p, [size[0], size[0] / 2], twist = twist)]; pts = [for(p = line) ptf_torus(size, p, [size[0], size[0] / 2], twist = twist)];
@@ -29,8 +24,8 @@ module tiled_line_torus(size, twist, step, line_diameter = 1) {
} }
} }
tiled_line_torus(size, twist, step, line_diameter); tiled_line_torus(size, twist, line_diameter);
color("black") color("black")
rotate_extrude($fn = 36) rotate_extrude($fn = 36)
translate([size[0] * 1.5, 0, 0]) translate([size[0] * 1.5, 0, 0])
circle(size[0] / 2); circle(size[0] / 2);