diff --git a/src/pp/_impl/_pp_poisson2.scad b/src/pp/_impl/_pp_poisson2.scad index 078b4e59..d77ff5e9 100644 --- a/src/pp/_impl/_pp_poisson2.scad +++ b/src/pp/_impl/_pp_poisson2.scad @@ -1,12 +1,12 @@ use <../../matrix/m_replace.scad> use <../../util/every.scad> -function sampling(size, r, start, k) = +function sampling(size, r, start, k, sd) = let( w = r / sqrt(2), 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]] : start, active = [pt], px = floor(pt.x / w), py = floor(pt.y / w), diff --git a/src/pp/pp_poisson2.scad b/src/pp/pp_poisson2.scad index d3f543f7..56c10973 100644 --- a/src/pp/pp_poisson2.scad +++ b/src/pp/pp_poisson2.scad @@ -1,8 +1,9 @@ use <_impl/_pp_poisson2.scad> -function pp_poisson2(size, r, start = undef, k = 30, seed = undef, history = false) = +function pp_poisson2(size, r, start, 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(row = sampling_grid(s), sample = row) if(!is_undef(sample)) sample