1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-20 05:21:38 +02:00

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

This commit is contained in:
Justin Lin
2022-02-28 11:05:50 +08:00
parent c9370160a7
commit 8f76446bd8
9 changed files with 58 additions and 51 deletions

View File

@@ -36,6 +36,20 @@ module dragon_claw() {
rotate_extrude($fn = 7)
polygon(pts);
linear_extrude(5)
polygon(dedup(concat(claw_path1, claw_path2, claw_path3, claw_path4, [[-2, -.75], [-1.45, -1.45]], claw_path5, [[1.45, -1.45], [2, -.75]])));
polygon(
dedup(
[
each claw_path1,
each claw_path2,
each claw_path3,
each claw_path4,
[-2, -.75],
[-1.45, -1.45],
each claw_path5,
[1.45, -1.45],
[2, -.75]
]
)
);
}
}

View File

@@ -9,14 +9,14 @@ function one_body_scale(body_r, body_fn, scale_fn, scale_tilt_a) =
scale_r = PI * body_r / body_fn,
double_scale_r = scale_r * 2,
shape_scale = shape_circle(scale_r, $fn = scale_fn),
scale_pts = concat(
[[0, 0, scale_r / 2 + body_r]],
[
scale_pts = [
[0, 0, scale_r / 2 + body_r],
each [
for(p = shape_scale)
ptf_rotate([p[0], p[1] * 2.01, body_r], [scale_tilt_a, 0, 0])
],
[for(p = shape_scale) [p[0], p[1] * 2.01, 0]]
)
],
each [for(p = shape_scale) [p[0], p[1] * 2.01, 0]]
]
)
convex_hull3(scale_pts);

View File

@@ -34,11 +34,7 @@ module hilbert_dragon() {
scale_tilt_a = -3;
lines = hilbert_curve();
hilbert_path = dedup(
concat(
[for(line = lines) line[0]],
[lines[len(lines) - 1][1]])
);
hilbert_path = dedup([each [for(line = lines) line[0]], lines[len(lines) - 1][1]]);
smoothed_hilbert_path = bezier_smooth(hilbert_path, 0.45, t_step = 0.15);
dragon_body_path = reverse([for(i = [1:len(smoothed_hilbert_path) - 2]) smoothed_hilbert_path[i]]);

View File

@@ -11,11 +11,7 @@ hilbert_dragon_low_poly();
module hilbert_dragon_low_poly() {
lines = hilbert_curve();
hilbert_path = dedup(
concat(
[for(line = lines) line[0]],
[lines[len(lines) - 1][1]])
);
hilbert_path = dedup([each [for(line = lines) line[0]], lines[len(lines) - 1][1]]);
smoothed_hilbert_path = bezier_smooth(hilbert_path, 0.48, t_step = 0.2);
dragon_body_path = reverse([for(i = [1:len(smoothed_hilbert_path) - 2]) smoothed_hilbert_path[i]]);
@@ -37,7 +33,11 @@ module hilbert_dragon_low_poly() {
pts = [for(p = body_shape) p * 0.007];
p = dragon_body_path[0];
path_extrude(pts, concat([p + [0.0155, 0, 0.175]], [for(i = [1:len(dragon_body_path) - 1]) dragon_body_path[i]]), scale = 0.9);
path_extrude(
pts,
[p + [0.0155, 0, 0.175], each [for(i = [1:len(dragon_body_path) - 1]) dragon_body_path[i]]],
scale = 0.9
);
translate([0.125, 0, -2.73])
scale(0.009)

View File

@@ -31,7 +31,7 @@ module torus_knot_dragon_low_poly() {
pts = [for(p = body_shape) p * 0.015];
p = dragon_body_path[0];
path_extrude(pts, concat([p + [0.00001, 0.0000055, 0.000008]], dragon_body_path), scale = 0.9);
path_extrude(pts, [p + [0.00001, 0.0000055, 0.000008], each dragon_body_path], scale = 0.9);
translate([2.975, -0.75, -0.75])
scale(0.01825)