1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-01 04:20:27 +02:00

refactor: extract dist cond

This commit is contained in:
Justin Lin
2022-04-03 14:22:59 +08:00
parent 8ce96f9128
commit 047731d7d6

View File

@@ -8,13 +8,11 @@ function _chebyshev(p1, p2) =
function _nz_cell_classic(cells, p, dist) =
let(
dists = [
for(cell = cells)
dist == "euclidean" ? norm(cell - p) :
dist == "manhattan" ? _manhattan(cell - p) :
dist == "chebyshev" ? _chebyshev(cell, p) :
assert("Unknown distance option")
]
dists =
dist == "euclidean" ? [for(cell = cells) norm(cell - p)] :
dist == "manhattan" ? [for(cell = cells) _manhattan(cell - p)] :
dist == "chebyshev" ? [for(cell = cells) _chebyshev(cell, p)] :
assert("Unknown distance option")
)
min(dists);