diff --git a/examples/worley_noise_ball.scad b/examples/worley_noise_ball.scad index 1819e814..22db2341 100644 --- a/examples/worley_noise_ball.scad +++ b/examples/worley_noise_ball.scad @@ -3,7 +3,7 @@ use ; radius = 25; a_step = 5; -cell_w = 10; +tile_w = 10; dist = "euclidean"; // [euclidean, manhattan, chebyshev, "border"] noise_style = "CELL_R"; // [CELL_R, NOISE] noise_factor = 1; @@ -34,7 +34,7 @@ module worley_noise_ball() { nz_worley3s( [for(theta_tau = row) to_xyz([radius, theta_tau[0], theta_tau[1]])], seed, - cell_w, + tile_w, dist ) ]; diff --git a/src/experimental/demo/nz_worley2_demo.scad b/src/experimental/demo/nz_worley2_demo.scad index 6587d4e3..b18c3370 100644 --- a/src/experimental/demo/nz_worley2_demo.scad +++ b/src/experimental/demo/nz_worley2_demo.scad @@ -2,7 +2,7 @@ use ; use ; size = [100, 50]; -cell_w = 10; +tile_w = 10; dist = "euclidean"; // [euclidean, manhattan, chebyshev, border] seed = 51; @@ -12,7 +12,7 @@ points = [ [x, y] ]; -cells = [for(p = points) nz_worley2(p[0], p[1], seed, cell_w, dist)]; +cells = [for(p = points) nz_worley2(p[0], p[1], seed, tile_w, dist)]; max_dist = max([for(c = cells) c[2]]); for(i = [0:len(cells) - 1]) { diff --git a/src/experimental/demo/nz_worley2s_demo.scad b/src/experimental/demo/nz_worley2s_demo.scad index 7aac6981..5f4f1b83 100644 --- a/src/experimental/demo/nz_worley2s_demo.scad +++ b/src/experimental/demo/nz_worley2s_demo.scad @@ -2,7 +2,7 @@ use ; use ; size = [100, 50]; -cell_w = 10; +tile_w = 10; dist = "euclidean"; // [euclidean, manhattan, chebyshev, border] seed = 51; @@ -12,7 +12,7 @@ points = [ [x, y] ]; -cells = nz_worley2s(points, seed, cell_w, dist); +cells = nz_worley2s(points, seed, tile_w, dist); max_dist = max([for(c = cells) c[2]]); for(i = [0:len(cells) - 1]) { diff --git a/src/experimental/demo/nz_worley3_demo.scad b/src/experimental/demo/nz_worley3_demo.scad index a60c53f8..ef39ddb6 100644 --- a/src/experimental/demo/nz_worley3_demo.scad +++ b/src/experimental/demo/nz_worley3_demo.scad @@ -1,7 +1,7 @@ use ; size = [20, 20, 20]; -cell_w = 10; +tile_w = 10; dist = "euclidean"; // [euclidean, manhattan, chebyshev, border] seed = 51; @@ -12,7 +12,7 @@ points = [ [x, y, z] ]; -cells = [for(p = points) nz_worley3(p[0], p[1], p[2], seed, cell_w, dist)]; +cells = [for(p = points) nz_worley3(p[0], p[1], p[2], seed, tile_w, dist)]; max_dist = max([for(c = cells) c[3]]); for(i = [0:len(cells) - 1]) { diff --git a/src/experimental/demo/nz_worley3s_demo.scad b/src/experimental/demo/nz_worley3s_demo.scad index 7fb791b1..96793593 100644 --- a/src/experimental/demo/nz_worley3s_demo.scad +++ b/src/experimental/demo/nz_worley3s_demo.scad @@ -2,7 +2,7 @@ use ; use ; size = [20, 20, 20]; -cell_w = 10; +tile_w = 10; dist = "euclidean"; // [euclidean, manhattan, chebyshev, border] seed = 51; @@ -13,7 +13,7 @@ points = [ [x, y, z] ]; -cells = nz_worley3s(points, seed, cell_w, dist); +cells = nz_worley3s(points, seed, tile_w, dist); max_dist = max([for(c = cells) c[3]]); for(i = [0:len(cells) - 1]) { diff --git a/src/noise/_impl/_nz_worley2_impl.scad b/src/noise/_impl/_nz_worley2_impl.scad index 0de3c716..8fd8b217 100644 --- a/src/noise/_impl/_nz_worley2_impl.scad +++ b/src/noise/_impl/_nz_worley2_impl.scad @@ -1,16 +1,16 @@ use ; use ; -function _neighbors(fcord, seed, cell_w) = [ +function _neighbors(fcord, seed, tile_w) = [ for(y = [-1:1]) for(x = [-1:1]) let( nx = fcord[0] + x, ny = fcord[1] + y, - sd_base = abs(nx + ny * cell_w), + sd_base = abs(nx + ny * tile_w), sd1 = _lookup_noise_table(seed + sd_base), sd2 = _lookup_noise_table(sd1 * 255 + sd_base), - nbr = [(nx + sd1) * cell_w, (ny + sd2) * cell_w] + nbr = [(nx + sd1) * tile_w, (ny + sd2) * tile_w] ) nbr ]; @@ -38,10 +38,10 @@ function _nz_worley2_border(p, nbrs) = ) [a[0], a[1], (p - m) * (a - m)]; -function _nz_worley2(p, seed, cell_w, dist) = +function _nz_worley2(p, seed, tile_w, dist) = let( - fcord = [floor(p[0] / cell_w), floor(p[1] / cell_w)], - nbrs = _neighbors(fcord, seed, cell_w) + fcord = [floor(p[0] / tile_w), floor(p[1] / tile_w)], + nbrs = _neighbors(fcord, seed, tile_w) ) dist == "border" ? _nz_worley2_border(p, nbrs) : _nz_worley2_classic(p, nbrs, dist); \ No newline at end of file diff --git a/src/noise/_impl/_nz_worley3_impl.scad b/src/noise/_impl/_nz_worley3_impl.scad index e6271e24..5c69b215 100644 --- a/src/noise/_impl/_nz_worley3_impl.scad +++ b/src/noise/_impl/_nz_worley3_impl.scad @@ -1,7 +1,7 @@ use ; use ; -function _neighbors(fcord, seed, cell_w) = [ +function _neighbors(fcord, seed, tile_w) = [ for(z = [-1:1]) for(y = [-1:1]) for(x = [-1:1]) @@ -9,11 +9,11 @@ function _neighbors(fcord, seed, cell_w) = [ nx = fcord[0] + x, ny = fcord[1] + y, nz = fcord[2] + z, - sd_base = abs(nx + ny * cell_w + nz * cell_w * cell_w), + sd_base = abs(nx + ny * tile_w + nz * tile_w * tile_w), sd1 = _lookup_noise_table(seed + sd_base), sd2 = _lookup_noise_table(sd1 * 255 + sd_base), sd3 = _lookup_noise_table(sd2 * 255 + sd_base), - nbr = [(nx + sd1) * cell_w, (ny + sd2) * cell_w, (nz + sd3) * cell_w] + nbr = [(nx + sd1) * tile_w, (ny + sd2) * tile_w, (nz + sd3) * tile_w] ) nbr ]; @@ -41,10 +41,10 @@ function _nz_worley3_border(p, nbrs) = ) [a[0], a[1], a[2], (p - m) * (a - m)]; -function _nz_worley3(p, seed, cell_w, dist) = +function _nz_worley3(p, seed, tile_w, dist) = let( - fcord = [floor(p[0] / cell_w), floor(p[1] / cell_w), floor(p[2] / cell_w)], - nbrs = _neighbors(fcord, seed, cell_w) + fcord = [floor(p[0] / tile_w), floor(p[1] / tile_w), floor(p[2] / tile_w)], + nbrs = _neighbors(fcord, seed, tile_w) ) dist == "border" ? _nz_worley3_border(p, nbrs) : _nz_worley3_classic(p, nbrs, dist); \ No newline at end of file diff --git a/src/noise/nz_worley2.scad b/src/noise/nz_worley2.scad index fcc81bcd..f2449850 100644 --- a/src/noise/nz_worley2.scad +++ b/src/noise/nz_worley2.scad @@ -1,6 +1,6 @@ use ; use ; -function nz_worley2(x, y, seed, cell_w = 10, dist = "euclidean") = +function nz_worley2(x, y, seed, tile_w = 10, dist = "euclidean") = let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256) - _nz_worley2([x, y], sd, cell_w, dist); \ No newline at end of file + _nz_worley2([x, y], sd, tile_w, dist); \ No newline at end of file diff --git a/src/noise/nz_worley2s.scad b/src/noise/nz_worley2s.scad index e2e9e88c..76c56ce3 100644 --- a/src/noise/nz_worley2s.scad +++ b/src/noise/nz_worley2s.scad @@ -1,6 +1,6 @@ use ; use ; -function nz_worley2s(points, seed, cell_w = 10, dist = "euclidean") = +function nz_worley2s(points, seed, tile_w = 10, dist = "euclidean") = let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256) - [for(p = points) _nz_worley2(p, sd, cell_w, dist)]; \ No newline at end of file + [for(p = points) _nz_worley2(p, sd, tile_w, dist)]; \ No newline at end of file diff --git a/src/noise/nz_worley3.scad b/src/noise/nz_worley3.scad index 43579183..75db5f4f 100644 --- a/src/noise/nz_worley3.scad +++ b/src/noise/nz_worley3.scad @@ -1,6 +1,6 @@ use ; use ; -function nz_worley3(x, y, z, seed, cell_w = 10, dist = "euclidean") = +function nz_worley3(x, y, z, seed, tile_w = 10, dist = "euclidean") = let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256) - _nz_worley3([x, y, z], sd, cell_w, dist); \ No newline at end of file + _nz_worley3([x, y, z], sd, tile_w, dist); \ No newline at end of file diff --git a/src/noise/nz_worley3s.scad b/src/noise/nz_worley3s.scad index 424cc6fc..fc54b3ca 100644 --- a/src/noise/nz_worley3s.scad +++ b/src/noise/nz_worley3s.scad @@ -1,6 +1,6 @@ use ; use ; -function nz_worley3s(points, seed, cell_w = 10, dist = "euclidean") = +function nz_worley3s(points, seed, tile_w = 10, dist = "euclidean") = let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256) - [for(p = points) _nz_worley3(p, sd, cell_w, dist)]; \ No newline at end of file + [for(p = points) _nz_worley3(p, sd, tile_w, dist)]; \ No newline at end of file