mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-17 14:18:13 +01:00
rename param
This commit is contained in:
parent
22a6891f8b
commit
a64a4d2399
@ -3,7 +3,7 @@ use <sweep.scad>;
|
|||||||
|
|
||||||
radius = 25;
|
radius = 25;
|
||||||
a_step = 5;
|
a_step = 5;
|
||||||
cell_w = 10;
|
tile_w = 10;
|
||||||
dist = "euclidean"; // [euclidean, manhattan, chebyshev, "border"]
|
dist = "euclidean"; // [euclidean, manhattan, chebyshev, "border"]
|
||||||
noise_style = "CELL_R"; // [CELL_R, NOISE]
|
noise_style = "CELL_R"; // [CELL_R, NOISE]
|
||||||
noise_factor = 1;
|
noise_factor = 1;
|
||||||
@ -34,7 +34,7 @@ module worley_noise_ball() {
|
|||||||
nz_worley3s(
|
nz_worley3s(
|
||||||
[for(theta_tau = row) to_xyz([radius, theta_tau[0], theta_tau[1]])],
|
[for(theta_tau = row) to_xyz([radius, theta_tau[0], theta_tau[1]])],
|
||||||
seed,
|
seed,
|
||||||
cell_w,
|
tile_w,
|
||||||
dist
|
dist
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
@ -2,7 +2,7 @@ use <noise/nz_worley2.scad>;
|
|||||||
use <util/dedup.scad>;
|
use <util/dedup.scad>;
|
||||||
|
|
||||||
size = [100, 50];
|
size = [100, 50];
|
||||||
cell_w = 10;
|
tile_w = 10;
|
||||||
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
||||||
seed = 51;
|
seed = 51;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ points = [
|
|||||||
[x, y]
|
[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]]);
|
max_dist = max([for(c = cells) c[2]]);
|
||||||
for(i = [0:len(cells) - 1]) {
|
for(i = [0:len(cells) - 1]) {
|
||||||
|
@ -2,7 +2,7 @@ use <noise/nz_worley2s.scad>;
|
|||||||
use <util/dedup.scad>;
|
use <util/dedup.scad>;
|
||||||
|
|
||||||
size = [100, 50];
|
size = [100, 50];
|
||||||
cell_w = 10;
|
tile_w = 10;
|
||||||
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
||||||
seed = 51;
|
seed = 51;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ points = [
|
|||||||
[x, y]
|
[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]]);
|
max_dist = max([for(c = cells) c[2]]);
|
||||||
for(i = [0:len(cells) - 1]) {
|
for(i = [0:len(cells) - 1]) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use <noise/nz_worley3.scad>;
|
use <noise/nz_worley3.scad>;
|
||||||
|
|
||||||
size = [20, 20, 20];
|
size = [20, 20, 20];
|
||||||
cell_w = 10;
|
tile_w = 10;
|
||||||
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
||||||
seed = 51;
|
seed = 51;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ points = [
|
|||||||
[x, y, z]
|
[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]]);
|
max_dist = max([for(c = cells) c[3]]);
|
||||||
for(i = [0:len(cells) - 1]) {
|
for(i = [0:len(cells) - 1]) {
|
||||||
|
@ -2,7 +2,7 @@ use <noise/nz_worley3s.scad>;
|
|||||||
use <util/dedup.scad>;
|
use <util/dedup.scad>;
|
||||||
|
|
||||||
size = [20, 20, 20];
|
size = [20, 20, 20];
|
||||||
cell_w = 10;
|
tile_w = 10;
|
||||||
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
dist = "euclidean"; // [euclidean, manhattan, chebyshev, border]
|
||||||
seed = 51;
|
seed = 51;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ points = [
|
|||||||
[x, y, z]
|
[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]]);
|
max_dist = max([for(c = cells) c[3]]);
|
||||||
for(i = [0:len(cells) - 1]) {
|
for(i = [0:len(cells) - 1]) {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
use <noise/_impl/_nz_worley_comm.scad>;
|
use <noise/_impl/_nz_worley_comm.scad>;
|
||||||
use <util/sort.scad>;
|
use <util/sort.scad>;
|
||||||
|
|
||||||
function _neighbors(fcord, seed, cell_w) = [
|
function _neighbors(fcord, seed, tile_w) = [
|
||||||
for(y = [-1:1])
|
for(y = [-1:1])
|
||||||
for(x = [-1:1])
|
for(x = [-1:1])
|
||||||
let(
|
let(
|
||||||
nx = fcord[0] + x,
|
nx = fcord[0] + x,
|
||||||
ny = fcord[1] + y,
|
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),
|
sd1 = _lookup_noise_table(seed + sd_base),
|
||||||
sd2 = _lookup_noise_table(sd1 * 255 + 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
|
nbr
|
||||||
];
|
];
|
||||||
@ -38,10 +38,10 @@ function _nz_worley2_border(p, nbrs) =
|
|||||||
)
|
)
|
||||||
[a[0], a[1], (p - m) * (a - m)];
|
[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(
|
let(
|
||||||
fcord = [floor(p[0] / cell_w), floor(p[1] / cell_w)],
|
fcord = [floor(p[0] / tile_w), floor(p[1] / tile_w)],
|
||||||
nbrs = _neighbors(fcord, seed, cell_w)
|
nbrs = _neighbors(fcord, seed, tile_w)
|
||||||
)
|
)
|
||||||
dist == "border" ? _nz_worley2_border(p, nbrs) :
|
dist == "border" ? _nz_worley2_border(p, nbrs) :
|
||||||
_nz_worley2_classic(p, nbrs, dist);
|
_nz_worley2_classic(p, nbrs, dist);
|
@ -1,7 +1,7 @@
|
|||||||
use <noise/_impl/_nz_worley_comm.scad>;
|
use <noise/_impl/_nz_worley_comm.scad>;
|
||||||
use <util/sort.scad>;
|
use <util/sort.scad>;
|
||||||
|
|
||||||
function _neighbors(fcord, seed, cell_w) = [
|
function _neighbors(fcord, seed, tile_w) = [
|
||||||
for(z = [-1:1])
|
for(z = [-1:1])
|
||||||
for(y = [-1:1])
|
for(y = [-1:1])
|
||||||
for(x = [-1:1])
|
for(x = [-1:1])
|
||||||
@ -9,11 +9,11 @@ function _neighbors(fcord, seed, cell_w) = [
|
|||||||
nx = fcord[0] + x,
|
nx = fcord[0] + x,
|
||||||
ny = fcord[1] + y,
|
ny = fcord[1] + y,
|
||||||
nz = fcord[2] + z,
|
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),
|
sd1 = _lookup_noise_table(seed + sd_base),
|
||||||
sd2 = _lookup_noise_table(sd1 * 255 + sd_base),
|
sd2 = _lookup_noise_table(sd1 * 255 + sd_base),
|
||||||
sd3 = _lookup_noise_table(sd2 * 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
|
nbr
|
||||||
];
|
];
|
||||||
@ -41,10 +41,10 @@ function _nz_worley3_border(p, nbrs) =
|
|||||||
)
|
)
|
||||||
[a[0], a[1], a[2], (p - m) * (a - m)];
|
[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(
|
let(
|
||||||
fcord = [floor(p[0] / cell_w), floor(p[1] / cell_w), floor(p[2] / cell_w)],
|
fcord = [floor(p[0] / tile_w), floor(p[1] / tile_w), floor(p[2] / tile_w)],
|
||||||
nbrs = _neighbors(fcord, seed, cell_w)
|
nbrs = _neighbors(fcord, seed, tile_w)
|
||||||
)
|
)
|
||||||
dist == "border" ? _nz_worley3_border(p, nbrs) :
|
dist == "border" ? _nz_worley3_border(p, nbrs) :
|
||||||
_nz_worley3_classic(p, nbrs, dist);
|
_nz_worley3_classic(p, nbrs, dist);
|
@ -1,6 +1,6 @@
|
|||||||
use <util/rand.scad>;
|
use <util/rand.scad>;
|
||||||
use <noise/_impl/_nz_worley2_impl.scad>;
|
use <noise/_impl/_nz_worley2_impl.scad>;
|
||||||
|
|
||||||
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)
|
let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256)
|
||||||
_nz_worley2([x, y], sd, cell_w, dist);
|
_nz_worley2([x, y], sd, tile_w, dist);
|
@ -1,6 +1,6 @@
|
|||||||
use <util/rand.scad>;
|
use <util/rand.scad>;
|
||||||
use <noise/_impl/_nz_worley2_impl.scad>;
|
use <noise/_impl/_nz_worley2_impl.scad>;
|
||||||
|
|
||||||
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)
|
let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256)
|
||||||
[for(p = points) _nz_worley2(p, sd, cell_w, dist)];
|
[for(p = points) _nz_worley2(p, sd, tile_w, dist)];
|
@ -1,6 +1,6 @@
|
|||||||
use <util/rand.scad>;
|
use <util/rand.scad>;
|
||||||
use <noise/_impl/_nz_worley3_impl.scad>;
|
use <noise/_impl/_nz_worley3_impl.scad>;
|
||||||
|
|
||||||
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)
|
let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256)
|
||||||
_nz_worley3([x, y, z], sd, cell_w, dist);
|
_nz_worley3([x, y, z], sd, tile_w, dist);
|
@ -1,6 +1,6 @@
|
|||||||
use <util/rand.scad>;
|
use <util/rand.scad>;
|
||||||
use <noise/_impl/_nz_worley3_impl.scad>;
|
use <noise/_impl/_nz_worley3_impl.scad>;
|
||||||
|
|
||||||
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)
|
let(sd = is_undef(seed) ? floor(rand(0, 256)) : seed % 256)
|
||||||
[for(p = points) _nz_worley3(p, sd, cell_w, dist)];
|
[for(p = points) _nz_worley3(p, sd, tile_w, dist)];
|
Loading…
x
Reference in New Issue
Block a user