mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-29 17:30:11 +02:00
use [each lt, v] to replace concat(lt, [v])
This commit is contained in:
@@ -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