za.co.luma.math.sampling
Class PoissonDiskSampler

java.lang.Object
  extended by za.co.luma.math.sampling.PoissonDiskSampler
All Implemented Interfaces:
Sampler<Vector2DDouble>

public class PoissonDiskSampler
extends java.lang.Object
implements Sampler<Vector2DDouble>

Algorithm based on Fast Poisson Disk Sampling in Arbitrary Dimensions by Robert Bridson, but with an arbitrary minimum distance function. See also the paper A Spatial Data Structure for Fast Poisson-Disk Sample Generation Daniel Dunbar and Greg Humphreys for other algorithms and a comparrisson.

Author:
Herman Tulleken

Field Summary
static int MAX_POINTS
          A safety measure - no more than this number of points are produced by ther algorithm.
 
Constructor Summary
PoissonDiskSampler(double x0, double y0, double x1, double y1, double minDist, RealFunction2DDouble distribution)
          Construct a new PoissonDisk object, with a given domain and minimum distance between points.
PoissonDiskSampler(double x0, double y0, double x1, double y1, double minDist, RealFunction2DDouble distribution, int pointsToGenerate)
          Construct a new PoissonDisk object, with a given domain and minimum distance between points.
 
Method Summary
 java.util.List<Vector2DDouble> sample()
          Generates a list of points following the Poisson distribution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_POINTS

public static final int MAX_POINTS
A safety measure - no more than this number of points are produced by ther algorithm.

See Also:
Constant Field Values
Constructor Detail

PoissonDiskSampler

public PoissonDiskSampler(double x0,
                          double y0,
                          double x1,
                          double y1,
                          double minDist,
                          RealFunction2DDouble distribution,
                          int pointsToGenerate)
Construct a new PoissonDisk object, with a given domain and minimum distance between points.

Parameters:
x0 - x-coordinate of bottom left corner of domain.
y0 - x-coordinate of bottom left corner of domain.
x1 - x-coordinate of bottom left corner of domain.
y1 - x-coordinate of bottom left corner of domain.
distribution - A function that gives the minimum radius between points in the vicinity of a point.

PoissonDiskSampler

public PoissonDiskSampler(double x0,
                          double y0,
                          double x1,
                          double y1,
                          double minDist,
                          RealFunction2DDouble distribution)
Construct a new PoissonDisk object, with a given domain and minimum distance between points.

Parameters:
x0 - x-coordinate of bottom left corner of domain.
y0 - x-coordinate of bottom left corner of domain.
x1 - x-coordinate of bottom left corner of domain.
y1 - x-coordinate of bottom left corner of domain.
distribution - A function that gives the minimum radius between points in the vicinity of a point.
Method Detail

sample

public java.util.List<Vector2DDouble> sample()
Generates a list of points following the Poisson distribution. No more than MAX_POINTS are produced.

Specified by:
sample in interface Sampler<Vector2DDouble>
Returns:
The sample set.