mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-01 04:20:27 +02:00
use [each lt, v] to replace concat(lt, [v])
This commit is contained in:
@@ -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]
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -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);
|
||||
|
||||
|
@@ -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]]);
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
|
@@ -14,17 +14,15 @@ ys = rands(0, size[1], pt_nums);
|
||||
half_fn = fn / 2;
|
||||
dx = size[0] / fn;
|
||||
dy = size[1] / half_fn;
|
||||
points = concat(
|
||||
[
|
||||
[0, 0], [size[0], 0],
|
||||
[size[0], size[1]], [0, size[1]]
|
||||
],
|
||||
[for(i = [1:fn - 1]) [i * dx, 0]],
|
||||
[for(i = [1:fn - 1]) [i * dx, size[1]]],
|
||||
[for(i = [1:half_fn - 1]) [0, dy * i]],
|
||||
[for(i = [1:half_fn - 1]) [size[0], dy * i]],
|
||||
[for(i = [0:len(xs) - 1]) [xs[i], ys[i]]]
|
||||
);
|
||||
points = [
|
||||
[0, 0], [size[0], 0],
|
||||
[size[0], size[1]], [0, size[1]],
|
||||
each [for(i = [1:fn - 1]) [i * dx, 0]],
|
||||
each [for(i = [1:fn - 1]) [i * dx, size[1]]],
|
||||
each [for(i = [1:half_fn - 1]) [0, dy * i]],
|
||||
each [for(i = [1:half_fn - 1]) [size[0], dy * i]],
|
||||
each [for(i = [0:len(xs) - 1]) [xs[i], ys[i]]]
|
||||
];
|
||||
|
||||
bisectors = [
|
||||
for(tri = tri_delaunay(points))
|
||||
@@ -33,6 +31,6 @@ bisectors = [
|
||||
|
||||
for(line = bisectors) {
|
||||
pts = [for(p = line) ptf_bend(size, p, radius, 360)];
|
||||
polyline_join(concat(pts, [pts[0]]))
|
||||
polyline_join([each pts, pts[0]])
|
||||
sphere(d = line_diameter, $fn = 4);
|
||||
}
|
@@ -9,12 +9,10 @@ radius = 30;
|
||||
angle = 360;
|
||||
diameter = 2;
|
||||
|
||||
lines = concat(
|
||||
hollow_out_square([columns, rows], width),
|
||||
[[
|
||||
for(x = [0:width:width * columns]) [x, rows * width]
|
||||
]]
|
||||
);
|
||||
lines = [
|
||||
each hollow_out_square([columns, rows], width),
|
||||
[for(x = [0:width:width * columns]) [x, rows * width]]
|
||||
];
|
||||
|
||||
for(line = lines) {
|
||||
transformed = [for(pt = line) ptf_bend([columns * width, rows * width], pt, radius, angle)];
|
||||
|
@@ -12,17 +12,17 @@ half = true;
|
||||
module hollow_out_starburst(r1, r2, h, n, line_diameter, half = false) {
|
||||
star = [for(p = shape_star(r1, r2, n)) [p[0], p[1], 0]];
|
||||
leng = len(star);
|
||||
tris = concat(
|
||||
[for(i = [0:leng - 2]) [[0, 0, h], star[i], star[i + 1]]],
|
||||
[[[0, 0, h], star[leng - 1], star[0]]]
|
||||
);
|
||||
tris = [
|
||||
each [for(i = [0:leng - 2]) [[0, 0, h], star[i], star[i + 1]]],
|
||||
[[0, 0, h], star[leng - 1], star[0]]
|
||||
];
|
||||
|
||||
module half_star() {
|
||||
for(tri = tris) {
|
||||
polyline_join(concat(tri, [tri[0]]))
|
||||
polyline_join([each tri, tri[0]])
|
||||
sphere(d = line_diameter);
|
||||
for(line = tri_bisectors(tri)) {
|
||||
polyline_join(concat(line, [line[0]]))
|
||||
polyline_join([each line, line[0]])
|
||||
sphere(d = line_diameter);
|
||||
}
|
||||
}
|
||||
|
@@ -39,10 +39,11 @@ module hollow_out_vase(ctrl_pts, t_step, line_diameter, fn, line_style) {
|
||||
|
||||
// bottom
|
||||
fst_sect = sects[0];
|
||||
fst_tris = concat(
|
||||
[for(i = [0:leng_sect - 2]) [[0, 0, 0], fst_sect[i], fst_sect[i + 1]]],
|
||||
[[[0, 0, 0], fst_sect[leng_sect - 1], fst_sect[0]]]
|
||||
);
|
||||
fst_tris = [
|
||||
each [for(i = [0:leng_sect - 2]) [[0, 0, 0], fst_sect[i], fst_sect[i + 1]]],
|
||||
[[0, 0, 0], fst_sect[leng_sect - 1], fst_sect[0]]
|
||||
];
|
||||
|
||||
for(tri = fst_tris) {
|
||||
lines = tri_bisectors(tri);
|
||||
for(line = lines) {
|
||||
@@ -55,10 +56,10 @@ module hollow_out_vase(ctrl_pts, t_step, line_diameter, fn, line_style) {
|
||||
|
||||
// mouth
|
||||
lst_sect = sects[len(sects) - 1];
|
||||
lst_tris = concat(
|
||||
[for(i = [0:leng_sect - 2]) [[0, 0, fpt[2]], lst_sect[i], lst_sect[i + 1]]],
|
||||
[[[0, 0, fpt[2]], lst_sect[leng_sect - 1], lst_sect[0]]]
|
||||
);
|
||||
lst_tris = [
|
||||
each [for(i = [0:leng_sect - 2]) [[0, 0, fpt[2]], lst_sect[i], lst_sect[i + 1]]],
|
||||
[[0, 0, fpt[2]], lst_sect[leng_sect - 1], lst_sect[0]]
|
||||
];
|
||||
dangling_pts = [for(tri = lst_tris) tri_bisectors(tri)[1][1]];
|
||||
offset_z = [0, 0, line_diameter];
|
||||
for(i = [0: leng_sect - 1]) {
|
||||
|
Reference in New Issue
Block a user