1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-01 04:20:27 +02:00
This commit is contained in:
Justin Lin
2022-05-05 21:23:03 +08:00
parent ba4c8e36a4
commit 748719d639
2 changed files with 19 additions and 2 deletions

View File

@@ -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)
];

View File

@@ -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);