mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-01 04:20:27 +02:00
refactor
This commit is contained in:
@@ -20,4 +20,21 @@ function _nz_worley3(p, seed, grid_w, dist) =
|
||||
dist == "manhattan" ? _nz_worley_manhattan(p, nbrs) :
|
||||
dist == "chebyshev" ? _nz_worley_chebyshev(p, nbrs) :
|
||||
dist == "border" ? _nz_worley_border(p, nbrs) :
|
||||
assert("Unknown distance option");
|
||||
assert("Unknown distance option");
|
||||
|
||||
function _nz_worley3s(points, seed, grid_w, dist) =
|
||||
let(
|
||||
noise = dist == "euclidean" ? function(p, nbrs) _nz_worley_euclidean(p, nbrs) :
|
||||
dist == "manhattan" ? function(p, nbrs) _nz_worley_manhattan(p, nbrs) :
|
||||
dist == "chebyshev" ? function(p, nbrs) _nz_worley_chebyshev(p, nbrs) :
|
||||
dist == "border" ? function(p, nbrs) _nz_worley_border(p, nbrs) :
|
||||
assert("Unknown distance option")
|
||||
)
|
||||
[
|
||||
for(p = points)
|
||||
let(
|
||||
fcord = [floor(p.x / grid_w), floor(p.y / grid_w), floor(p.z / grid_w)],
|
||||
nbrs = _neighbors(fcord, seed, grid_w)
|
||||
)
|
||||
noise(p, nbrs)
|
||||
];
|
@@ -13,4 +13,4 @@ use <_impl/_nz_worley3_impl.scad>;
|
||||
|
||||
function nz_worley3s(points, seed, grid_w = 10, dist = "euclidean") =
|
||||
let(sd = is_undef(seed) ? rand() : seed)
|
||||
[for(p = points) _nz_worley3(p, sd, grid_w, dist)];
|
||||
_nz_worley3s(points, sd, grid_w, dist);
|
Reference in New Issue
Block a user