mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-02-24 09:33:26 +01:00
c-style for loop
This commit is contained in:
parent
5a0a4a8fa4
commit
643266f4a3
@ -27,8 +27,8 @@ function _trim_sub(lines, leng, epsilon) =
|
||||
let(
|
||||
current_line = lines[0],
|
||||
next_line = lines[1],
|
||||
lines_from_next = [for(j = [1 : leng - 1]) lines[j]],
|
||||
lines_from_next2 = [for(j = [2 : leng - 1]) lines[j]],
|
||||
lines_from_next = [for(j = 1; j < leng; j = j + 1) lines[j]],
|
||||
lines_from_next2 = [for(j = 2; j < leng; j = j + 1) lines[j]],
|
||||
current_p = current_line[0],
|
||||
leng_lines_from_next2 = len(lines_from_next2),
|
||||
inter_p = _trim_shape_any_intersection(lines_from_next2, current_line, leng_lines_from_next2, 0, epsilon)
|
||||
@ -39,7 +39,7 @@ function _trim_sub(lines, leng, epsilon) =
|
||||
(leng == 3 || (inter_p[0] == (leng_lines_from_next2 - 1))) ? [current_p, inter_p[1], lines[leng - 1]] : (
|
||||
// collect current_p, intersecting pt and trim remain lines
|
||||
concat([current_p, inter_p[1]],
|
||||
_trim_shape_trim_lines([for(i = [inter_p[0] + 1 : leng_lines_from_next2 - 1]) lines_from_next2[i]], epsilon)
|
||||
_trim_shape_trim_lines([for(i = inter_p[0] + 1; i < leng_lines_from_next2; i = i + 1) lines_from_next2[i]], epsilon)
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -53,7 +53,7 @@ function _trim_shape_collect_pts_from(lines, leng) =
|
||||
|
||||
function trim_shape(shape_pts, from, to, epsilon = 0.0001) =
|
||||
let(
|
||||
pts = [for(i = [from:to]) shape_pts[i]],
|
||||
pts = [for(i = from; i <= to; i = i + 1) shape_pts[i]],
|
||||
trimmed = _trim_shape_trim_lines(__lines_from(pts), epsilon)
|
||||
)
|
||||
len(shape_pts) == len(trimmed) ? trimmed : trim_shape(trimmed, 0, len(trimmed) - 1, epsilon);
|
||||
|
Loading…
x
Reference in New Issue
Block a user