1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-12 09:44:16 +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) = function _nz_cell_classic(cells, p, dist) =
let( let(
dists = [ dists =
for(cell = cells) dist == "euclidean" ? [for(cell = cells) norm(cell - p)] :
dist == "euclidean" ? norm(cell - p) : dist == "manhattan" ? [for(cell = cells) _manhattan(cell - p)] :
dist == "manhattan" ? _manhattan(cell - p) : dist == "chebyshev" ? [for(cell = cells) _chebyshev(cell, p)] :
dist == "chebyshev" ? _chebyshev(cell, p) : assert("Unknown distance option")
assert("Unknown distance option")
]
) )
min(dists); min(dists);