mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-14 02:34:12 +02:00
refactor
This commit is contained in:
@@ -4,8 +4,7 @@ function _tri_subdivide(points, detail) =
|
|||||||
dr = (points[2] - points[0]) / rows,
|
dr = (points[2] - points[0]) / rows,
|
||||||
dc = (points[1] - points[0]) / rows,
|
dc = (points[1] - points[0]) / rows,
|
||||||
pts = [
|
pts = [
|
||||||
for(ri = [0:rows])
|
for(ri = [0:rows], ci = [0:rows - ri])
|
||||||
for(ci = [0:rows - ri])
|
|
||||||
points[0] + ci * dc + ri * dr
|
points[0] + ci * dc + ri * dr
|
||||||
],
|
],
|
||||||
ri_base = [for(ri = 0, acc = 0; ri <= rows; ri = ri + 1, acc = acc + rows - ri + 2) acc],
|
ri_base = [for(ri = 0, acc = 0; ri <= rows; ri = ri + 1, acc = acc + rows - ri + 2) acc],
|
||||||
@@ -14,15 +13,10 @@ function _tri_subdivide(points, detail) =
|
|||||||
for(ri = [0:rows - 1])
|
for(ri = [0:rows - 1])
|
||||||
let(cols = rows - ri - 1)
|
let(cols = rows - ri - 1)
|
||||||
for(ci = [0:cols])
|
for(ci = [0:cols])
|
||||||
each (ci == cols ?
|
each [
|
||||||
[
|
|
||||||
[idx(ci + 1, ri), idx(ci, ri + 1), idx(ci, ri)]
|
|
||||||
] :
|
|
||||||
[
|
|
||||||
[idx(ci + 1, ri), idx(ci, ri + 1), idx(ci, ri)],
|
[idx(ci + 1, ri), idx(ci, ri + 1), idx(ci, ri)],
|
||||||
[idx(ci + 1, ri + 1), idx(ci, ri + 1), idx(ci + 1, ri)]
|
if(ci != cols) [idx(ci + 1, ri + 1), idx(ci, ri + 1), idx(ci + 1, ri)]
|
||||||
]
|
]
|
||||||
)
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
[pts, faces];
|
[pts, faces];
|
||||||
|
Reference in New Issue
Block a user