1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 10:14:41 +02:00
This commit is contained in:
Justin Lin
2022-03-25 10:33:25 +08:00
parent 6292c8989a
commit 73c3e2d54c

View File

@@ -4,8 +4,7 @@ function _tri_subdivide(points, detail) =
dr = (points[2] - points[0]) / rows,
dc = (points[1] - points[0]) / rows,
pts = [
for(ri = [0:rows])
for(ci = [0:rows - ri])
for(ri = [0:rows], ci = [0:rows - ri])
points[0] + ci * dc + ri * dr
],
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])
let(cols = rows - ri - 1)
for(ci = [0:cols])
each (ci == cols ?
[
[idx(ci + 1, ri), idx(ci, ri + 1), idx(ci, ri)]
] :
[
each [
[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];