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:
@@ -41,7 +41,7 @@ module hollow_out_torus_knot(shape, p, q, phi_step, thickness, line_style) {
|
||||
[0, 90 - a[0], a[1]]
|
||||
]
|
||||
)
|
||||
cross_sections(shape, path, concat([angles[0]], angles));
|
||||
cross_sections(shape, path, [angles[0], each angles]);
|
||||
|
||||
pts = torus_knot(p, q, phi_step);
|
||||
sects = sects_by_path(shape, pts);
|
||||
|
@@ -21,7 +21,7 @@ module torus_knot_maze() {
|
||||
cell_width = 1;
|
||||
torus_knot_path = torus_knot(p, q, phi_step) * rows;
|
||||
columns = len(torus_knot_path);
|
||||
path = concat(torus_knot_path, [torus_knot_path[0]]);
|
||||
path = [each torus_knot_path, torus_knot_path[0]];
|
||||
|
||||
angle_yz_path = [
|
||||
for(i = [0:len(path) - 2])
|
||||
@@ -34,7 +34,7 @@ module torus_knot_maze() {
|
||||
[90 - phi, theta]
|
||||
];
|
||||
|
||||
angle_yz = concat(angle_yz_path, [angle_yz_path[0]]);
|
||||
angle_yz = [each angle_yz_path, angle_yz_path[0]];
|
||||
|
||||
walls = mz_square_walls(
|
||||
mz_square_cells(rows, columns, x_wrapping = true),
|
||||
|
@@ -55,7 +55,5 @@ function _px_spiral(from, leng, max_leng, clockwise, dir) =
|
||||
leng > max_leng ? [] : _px_spiral_go_turn(from, leng, max_leng, clockwise, dir);
|
||||
|
||||
function px_spiral(init_leng, max_leng, clockwise = false) =
|
||||
let(
|
||||
org = [0, 0]
|
||||
)
|
||||
concat([org], _px_spiral(org, init_leng, max_leng, clockwise, 0));
|
||||
let(org = [0, 0])
|
||||
[org, each _px_spiral(org, init_leng, max_leng, clockwise, 0)];
|
||||
|
@@ -24,7 +24,7 @@ module spiral_polygons(beginning_radius, line_width, fn, n) {
|
||||
|
||||
module drawPolygon(r) {
|
||||
pts = shape_circle(radius = r, $fn = fn);
|
||||
polyline_join(concat(pts, [pts[0]]))
|
||||
polyline_join([each pts, pts[0]])
|
||||
circle(half_line_width, $fn = 12);
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ module square_pursuit_3d(length, diff_scale, diameter, n) {
|
||||
|
||||
npts = [for(i = [0:3]) inter_p(pts[i], pts[(i + 1) % 4], leng, d)];
|
||||
|
||||
polyline_join(concat(npts, [npts[3], npts[0]]))
|
||||
polyline_join([each npts, npts[3], npts[0]])
|
||||
sphere(d = diameter);
|
||||
|
||||
_square_pursuit_3d(npts, diff_scale, diameter, n - 1);
|
||||
@@ -37,7 +37,7 @@ module square_pursuit_3d(length, diff_scale, diameter, n) {
|
||||
[0, length, 0]
|
||||
];
|
||||
|
||||
polyline_join(concat(pts, [pts[3], pts[0]]))
|
||||
polyline_join([each pts, pts[3], pts[0]])
|
||||
sphere(d = diameter);
|
||||
|
||||
_square_pursuit_3d(pts, diff_scale, diameter, n - 1);
|
||||
|
@@ -1,5 +1,6 @@
|
||||
use <experimental/tile_truchet.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <polyhedra/icosahedron.scad>;
|
||||
|
||||
radius = 15;
|
||||
height = 10;
|
||||
@@ -12,27 +13,22 @@ module tiled_line_ring(radius, height, line_diameter) {
|
||||
round(2 * radius * PI / line_diameter),
|
||||
round(height / line_diameter)
|
||||
];
|
||||
lines = concat(
|
||||
[
|
||||
for(tile = tile_truchet(size))
|
||||
let(
|
||||
x = tile[0],
|
||||
y = tile[1],
|
||||
i = tile[2]
|
||||
)
|
||||
i <= 1 ?
|
||||
[
|
||||
[x * half_line_diameter, y * line_diameter],
|
||||
[(x + 1) * half_line_diameter, (y + 1) * line_diameter]
|
||||
]
|
||||
:
|
||||
[
|
||||
[(x + 1) * half_line_diameter, y * line_diameter],
|
||||
[x * half_line_diameter, (y + 1) * line_diameter]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
lines = [
|
||||
for(tile = tile_truchet(size))
|
||||
let(
|
||||
x = tile[0],
|
||||
y = tile[1],
|
||||
i = tile[2]
|
||||
)
|
||||
if(i <= 1) [
|
||||
[x * half_line_diameter, y * line_diameter],
|
||||
[(x + 1) * half_line_diameter, (y + 1) * line_diameter]
|
||||
]
|
||||
else [
|
||||
[(x + 1) * half_line_diameter, y * line_diameter],
|
||||
[x * half_line_diameter, (y + 1) * line_diameter]
|
||||
]
|
||||
];
|
||||
|
||||
a = 360 / size[0];
|
||||
for(line = lines) {
|
||||
@@ -41,7 +37,7 @@ module tiled_line_ring(radius, height, line_diameter) {
|
||||
[radius * cos(a * p[0]), radius * sin(a * p[0]), p[1]]
|
||||
];
|
||||
polyline_join(pts)
|
||||
sphere(half_line_diameter);
|
||||
icosahedron(half_line_diameter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,11 +7,7 @@ diameter = 0.3;
|
||||
corner_r = 0.5;
|
||||
|
||||
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, corner_r);
|
||||
|
||||
polyline_join(smoothed_hilbert_path)
|
||||
|
@@ -14,7 +14,7 @@ module voronoi_melon(eyelets, radius) {
|
||||
|
||||
color("DarkKhaki")
|
||||
for(cell = cells) {
|
||||
polyline_join(concat(cell, [cell[0]]))
|
||||
polyline_join([each cell, cell[0]])
|
||||
sphere(radius / 60, $fn = 4);
|
||||
}
|
||||
|
||||
|
@@ -60,7 +60,7 @@ module voronoi_sphere(pts, region_hollow, region_offset, region_height) {
|
||||
}
|
||||
|
||||
|
||||
polyline_join(concat(cell, [cell[0]]))
|
||||
polyline_join([each cell, cell[0]])
|
||||
sphere(region_offset / 2, $fn = 5);
|
||||
}
|
||||
}
|
@@ -50,7 +50,13 @@ module voronoi_vase(r, h, thickness, num_of_pts, fn, profile_step) {
|
||||
intersection() {
|
||||
sweep(sections);
|
||||
render()
|
||||
vrn3_from(concat([for(i = indices) pts[i]], [sections[0][0], sections[0][half_fn], sections[last_section_i][0], sections[last_section_i][half_fn]]));
|
||||
vrn3_from([
|
||||
each [for(i = indices) pts[i]],
|
||||
sections[0][0],
|
||||
sections[0][half_fn],
|
||||
sections[last_section_i][0],
|
||||
sections[last_section_i][half_fn]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user