1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00

can be negative point

This commit is contained in:
Justin Lin
2020-03-30 10:10:15 +08:00
parent d53b573be5
commit 99d29bb4aa
6 changed files with 6 additions and 6 deletions

View File

@@ -7,7 +7,7 @@ function _neighbors(fcord, seed, cell_w) = [
let(
nx = fcord[0] + x,
ny = fcord[1] + y,
sd_base = nx + ny * cell_w,
sd_base = abs(nx + ny * cell_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]

View File

@@ -9,7 +9,7 @@ function _neighbors(fcord, seed, cell_w) = [
nx = fcord[0] + x,
ny = fcord[1] + y,
nz = fcord[2] + z,
sd_base = nx + ny * cell_w + nz * cell_w * cell_w,
sd_base = abs(nx + ny * cell_w + nz * cell_w * cell_w),
sd1 = _lookup_noise_table(seed + sd_base),
sd2 = _lookup_noise_table(sd1 * 255 + sd_base),
sd3 = _lookup_noise_table(sd2 * 255 + sd_base),

View File

@@ -2,5 +2,5 @@ use <util/rand.scad>;
use <experimental/_impl/_nz_worley2_impl.scad>;
function nz_worley2(x, y, seed, cell_w = 10, dist = "euclidean") =
let(sd = 6 + (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);

View File

@@ -2,5 +2,5 @@ use <util/rand.scad>;
use <experimental/_impl/_nz_worley2_impl.scad>;
function nz_worley2s(points, seed, cell_w = 10, dist = "euclidean") =
let(sd = 6 + (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)];

View File

@@ -2,5 +2,5 @@ use <util/rand.scad>;
use <experimental/_impl/_nz_worley3_impl.scad>;
function nz_worley3(x, y, z, seed, cell_w = 10, dist = "euclidean") =
let(sd = 6 + (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);

View File

@@ -2,5 +2,5 @@ use <util/rand.scad>;
use <experimental/_impl/_nz_worley3_impl.scad>;
function nz_worley3s(points, seed, cell_w = 10, dist = "euclidean") =
let(sd = 6 + (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)];