mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-13 18:24:28 +02:00
use [each lt, v] to replace concat(lt, [v])
This commit is contained in:
@@ -23,12 +23,12 @@ module crystal_cluster(base_r, crystals) {
|
||||
);
|
||||
|
||||
polyhedron_hull(
|
||||
concat(
|
||||
[for(p = bottom_shape) [p.x, p.y, 0]],
|
||||
[for(p = neck_shape) [p.x, p.y, rand(h * 0.7, h * 0.75)]],
|
||||
[[rand(0, r * 0.1), rand(0, r * 0.1), rand(h * 0.8, h)]],
|
||||
[for(i = [0:2]) if(rand(0, 1) > 0.5) [rand(0, r * 0.15), rand(0, r * 0.15), rand(h * 0.9, h * 1.05)]]
|
||||
)
|
||||
[
|
||||
each [for(p = bottom_shape) [p.x, p.y, 0]],
|
||||
each [for(p = neck_shape) [p.x, p.y, rand(h * 0.7, h * 0.75)]],
|
||||
[rand(0, r * 0.1), rand(0, r * 0.1), rand(h * 0.8, h)],
|
||||
each [for(i = [0:2]) if(rand(0, 1) > 0.5) [rand(0, r * 0.15), rand(0, r * 0.15), rand(h * 0.9, h * 1.05)]]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -57,20 +57,10 @@ module klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) {
|
||||
|
||||
degree = 2;
|
||||
bs_curve = bspline_curve(t_step, degree, mid_pts);
|
||||
tube_path = [[0, 0, bottom_height], each bs_curve, [0, 0, 0]];
|
||||
tube_path2 = [[0, 0, bottom_height - thickness], each bs_curve, [0, 0, -thickness]];
|
||||
|
||||
tube_path = concat(
|
||||
[[0, 0, bottom_height]],
|
||||
bs_curve,
|
||||
[[0, 0, 0]]
|
||||
);
|
||||
|
||||
tube_path2 = concat(
|
||||
[[0, 0, bottom_height - thickness]],
|
||||
bs_curve,
|
||||
[[0, 0, -thickness]]
|
||||
);
|
||||
|
||||
difference() {
|
||||
difference() {
|
||||
union() {
|
||||
bottom();
|
||||
|
||||
|
@@ -13,7 +13,7 @@ shape_pentagram_pts = shape_pentagram(star_radius);
|
||||
|
||||
path_extrude(
|
||||
shape_pentagram_pts,
|
||||
concat(pts, [pts[0]]),
|
||||
[each pts, pts[0]],
|
||||
closed = true,
|
||||
method = "EULER_ANGLE"
|
||||
);
|
||||
|
@@ -204,7 +204,20 @@ module owl(detail, head_angles) {
|
||||
rotate_extrude($fn = 7)
|
||||
polygon(pts);
|
||||
linear_extrude(5)
|
||||
polygon(dedup(concat(claw_path1, claw_path2, claw_path3, [[-2, -.75], [-1.45, -1.45]], claw_path4, [[1.45, -1.45], [2, -.75]])));
|
||||
polygon(
|
||||
dedup(
|
||||
[
|
||||
each claw_path1,
|
||||
each claw_path2,
|
||||
each claw_path3,
|
||||
[-2, -.75],
|
||||
[-1.45, -1.45],
|
||||
each claw_path4,
|
||||
[1.45, -1.45],
|
||||
[2, -.75]
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,7 @@ function _packing_circles(size, min_radius, max_radius, total_circles, attempts,
|
||||
i == total_circles ? circles :
|
||||
let(c = _packing_circles_new_circle(size, min_radius, max_radius, attempts, circles))
|
||||
c == [] ? _packing_circles(size, min_radius, max_radius, total_circles, attempts, circles) :
|
||||
_packing_circles(size, min_radius, max_radius, total_circles, attempts, concat(circles, [c]), i + 1);
|
||||
_packing_circles(size, min_radius, max_radius, total_circles, attempts, [each circles, c], i + 1);
|
||||
|
||||
function packing_circles(size, min_radius, max_radius, total_circles, attempts = 100) =
|
||||
_packing_circles(is_num(size) ? [size, size] : size, min_radius, max_radius, total_circles, attempts);
|
||||
|
@@ -14,13 +14,10 @@ module perlin_noise_cylinder(radius, height, thickness_scale, step) {
|
||||
|
||||
surface_inside = [
|
||||
for(y = [0:step:size[1]])
|
||||
concat(
|
||||
[
|
||||
for(x = [0:step:size[0] - 1])
|
||||
[x / 10, y / 10, 0]
|
||||
],
|
||||
[[size[0] / 10, y / 10, 0]]
|
||||
)
|
||||
[
|
||||
each [for(x = [0:step:size[0] - 1]) [x / 10, y / 10, 0]],
|
||||
[size[0] / 10, y / 10, 0]
|
||||
]
|
||||
];
|
||||
|
||||
seed = rand(0, 256);
|
||||
@@ -29,7 +26,10 @@ module perlin_noise_cylinder(radius, height, thickness_scale, step) {
|
||||
for(ri = [0:len(surface_inside) - 1])
|
||||
let(
|
||||
row = surface_inside[ri],
|
||||
row_for_noise = concat(slice(row, 0, leng_row - 1), [[0, row[leng_row - 1][1], 0]]),
|
||||
row_for_noise = [
|
||||
each slice(row, 0, leng_row - 1),
|
||||
[0, row[leng_row - 1][1], 0]
|
||||
],
|
||||
ns = nz_perlin2s(row_for_noise, seed)
|
||||
)
|
||||
[
|
||||
|
@@ -27,11 +27,11 @@ rotate([90, 0, 0])
|
||||
linear_extrude(1, center = true)
|
||||
difference() {
|
||||
square(120, center = true);
|
||||
polyline_join(concat(shape, [shape[0]]))
|
||||
polyline_join([each shape, shape[0]])
|
||||
circle(2.5);
|
||||
}
|
||||
|
||||
wire = shape2wire(shape, 150);
|
||||
rotate(-$t * 360)
|
||||
polyline_join(concat(wire, [wire[0]]))
|
||||
polyline_join([each wire, wire[0]])
|
||||
sphere(1.5);
|
@@ -16,11 +16,11 @@ module wormhole(length, width, depth, thickness, hole_r) {
|
||||
r2 = width / 4;
|
||||
half_thickness = thickness / 2;
|
||||
|
||||
plane = concat(
|
||||
[[length - r1, r1]],
|
||||
[for(a = [90:a_step:270]) r1 * [cos(a), sin(a)]],
|
||||
[[length - r1, -r1]]
|
||||
);
|
||||
plane = [
|
||||
[length - r1, r1],
|
||||
each [for(a = [90:a_step:270]) r1 * [cos(a), sin(a)]],
|
||||
[length - r1, -r1]
|
||||
];
|
||||
|
||||
difference() {
|
||||
rotate([90, 0, 0])
|
||||
|
Reference in New Issue
Block a user