mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-12 01:34:12 +02:00
random start
This commit is contained in:
@@ -8,13 +8,13 @@ function grid_replace(g, x, y, z, p) =
|
||||
else g[i]
|
||||
];
|
||||
|
||||
function sampling(size, r, start, k) =
|
||||
function sampling(size, r, start, k, sd) =
|
||||
let(
|
||||
w = r / sqrt(3),
|
||||
layers = floor(size.z / w),
|
||||
rows = floor(size.y / w),
|
||||
columns = floor(size.x / w),
|
||||
pt = is_undef(start) ? size / 2 : start,
|
||||
pt = is_undef(start) ? [rands(0, size.x, 1, sd)[0], rands(0, size.y, 1, sd + 1)[0], rands(0, size.z, 1, sd + 2)[0]] : start,
|
||||
active = [pt],
|
||||
px = floor(pt.x / w),
|
||||
py = floor(pt.y / w),
|
||||
|
@@ -2,7 +2,8 @@ use <_impl/_pp_poisson3.scad>
|
||||
|
||||
function pp_poisson3(size, r, start = undef, k = 30, seed = undef, history = false) =
|
||||
let(
|
||||
s = _pp_poisson(sampling(size, r, start, k), is_undef(seed) ? floor(rands(0, 1000, 1)[0]) : seed),
|
||||
sd = is_undef(seed) ? floor(rands(0, 1000, 1)[0]) : seed,
|
||||
s = _pp_poisson(sampling(size, r, start, k, sd), sd),
|
||||
samples = [
|
||||
for(layer = sampling_grid(s), row = layer, sample = row)
|
||||
if(!is_undef(sample)) sample
|
||||
|
Reference in New Issue
Block a user