mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-21 19:21:54 +02:00
slightly improved run time of vnf_tri_array()
This commit is contained in:
14
vnf.scad
14
vnf.scad
@@ -607,22 +607,22 @@ function vnf_tri_array(
|
|||||||
capfirst = first_defined([cap1,caps,false]),
|
capfirst = first_defined([cap1,caps,false]),
|
||||||
caplast = first_defined([cap2,caps,false]),
|
caplast = first_defined([cap2,caps,false]),
|
||||||
pcumlen = [0, each cumsum(rowstarts)],
|
pcumlen = [0, each cumsum(rowstarts)],
|
||||||
faces = flatten([
|
faces = [
|
||||||
// close first end
|
// close first end
|
||||||
if (capfirst)
|
if (capfirst)
|
||||||
if (reverse) [[ for(i=[0:rowstarts[0]-1-addcol]) i ]]
|
if (reverse) [ for(i=[0:rowstarts[0]-1-addcol]) i ]
|
||||||
else [[ for(i=[rowstarts[0]-1-addcol:-1:0]) i ]],
|
else [ for(i=[rowstarts[0]-1-addcol:-1:0]) i ],
|
||||||
// triangulate between the two polygons
|
// triangulate between the two polygons
|
||||||
for(i = [0:plen-2+(row_wrap?1:0)])
|
for(i = [0:plen-2+(row_wrap?1:0)])
|
||||||
let(
|
let(
|
||||||
j = (i+1)%plen,
|
j = (i+1)%plen,
|
||||||
max_extra_edges = limit_bunching ? max(1, abs(len(st[i])-len(st[j]))) : INF
|
max_extra_edges = limit_bunching ? max(1, abs(len(st[i])-len(st[j]))) : INF
|
||||||
) _lofttri(st[i], st[j], pcumlen[i], pcumlen[j], rowstarts[i], rowstarts[j], reverse, trimax=max_extra_edges),
|
) each _lofttri(st[i], st[j], pcumlen[i], pcumlen[j], rowstarts[i], rowstarts[j], reverse, trimax=max_extra_edges),
|
||||||
// close up the last end
|
// close up the last end
|
||||||
if (caplast)
|
if (caplast)
|
||||||
if (reverse) [[ for(i=[pcumlen[plen]-1-addcol:-1:pcumlen[plen-1]]) i ]]
|
if (reverse) [ for(i=[pcumlen[plen]-1-addcol:-1:pcumlen[plen-1]]) i ]
|
||||||
else [[ for(i=[pcumlen[plen-1]:pcumlen[plen]-1-addcol]) i ]]
|
else [ for(i=[pcumlen[plen-1]:pcumlen[plen]-1-addcol]) i ]
|
||||||
]),
|
],
|
||||||
vnf = [flatten(st), faces]
|
vnf = [flatten(st), faces]
|
||||||
) col_wrap ? vnf_merge_points(vnf) : vnf;
|
) col_wrap ? vnf_merge_points(vnf) : vnf;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user