pub struct PoissonDisk { /* private fields */ }Expand description
Poisson-disk sampling in a box (SciPy’s qmc.PoissonDisk): random points no two of which are
closer than radius, by Bridson’s algorithm. A background grid with cells of side r/√d
holds at most one point each, so the test for nearby points looks only at the surrounding
cells; new points are drawn as candidates around a random active point and kept if no
existing point is within r.
Implementations§
Source§impl PoissonDisk
impl PoissonDisk
Sourcepub fn new(
d: usize,
radius: f64,
hypersphere: Hypersphere,
ncandidates: usize,
bounds: Option<(&[f64], &[f64])>,
) -> Result<Self, ErrorsJSL>
pub fn new( d: usize, radius: f64, hypersphere: Hypersphere, ncandidates: usize, bounds: Option<(&[f64], &[f64])>, ) -> Result<Self, ErrorsJSL>
A sampler in [lower, upper] (the unit cube by default, None), with SciPy’s defaults
ncandidates = 30 and Hypersphere::Volume.
Sourcepub fn random<G: UniformGenerator>(
&mut self,
n: usize,
rng: &mut G,
) -> Vec<Vec<f64>>
pub fn random<G: UniformGenerator>( &mut self, n: usize, rng: &mut G, ) -> Vec<Vec<f64>>
Up to n new points (fewer when the box is full).
Sourcepub fn fill_space<G: UniformGenerator>(&mut self, rng: &mut G) -> Vec<Vec<f64>>
pub fn fill_space<G: UniformGenerator>(&mut self, rng: &mut G) -> Vec<Vec<f64>>
Points until no more fit (SciPy’s fill_space).
Trait Implementations§
Source§impl Clone for PoissonDisk
impl Clone for PoissonDisk
Auto Trait Implementations§
impl Freeze for PoissonDisk
impl RefUnwindSafe for PoissonDisk
impl Send for PoissonDisk
impl Sync for PoissonDisk
impl Unpin for PoissonDisk
impl UnsafeUnpin for PoissonDisk
impl UnwindSafe for PoissonDisk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more