za.co.luma.math.sampling
Class PoissonDiskMultiSampler

java.lang.Object
  extended by za.co.luma.math.sampling.PoissonDiskMultiSampler

public class PoissonDiskMultiSampler
extends java.lang.Object


Nested Class Summary
static class PoissonDiskMultiSampler.Circle
           
 
Field Summary
 java.util.List<java.util.List<PoissonDiskMultiSampler.Circle>[][]> grids
           
static int MAX_POINTS
          A safety measure - no more than this number of points are produced by ther algorithm.
 
Constructor Summary
PoissonDiskMultiSampler(double x0, double y0, double x1, double y1, double[] minDist, double[] minRadii, double[] radii, RealFunction2DDouble distribution, boolean multiLayer)
          Construct a new PoissonDisk object, with a given domain and minimum distance between points.
PoissonDiskMultiSampler(double x0, double y0, double x1, double y1, double[] minDist, double[] minRadii, double[] radii, RealFunction2DDouble distribution, boolean multiLayer, int pointsToGenerate)
          Construct a new PoissonDisk object, with a given domain and minimum distance between points.
 
Method Summary
static PoissonDiskMultiSampler.Circle generateAround(Vector2DDouble centre, double minDist, double minRadius, double radius, double distanceScale, double angleScale, double radiusScale)
          Generates a random point in the analus around the given point.
static Vector2DInt pointDoubleToInt(Vector2DDouble pointDouble, Vector2DDouble origin, double cellSize)
          Converts a PointDouble to a PointInt that represents the index coordinates of the point in the background grid.
 java.util.List<PoissonDiskMultiSampler.Circle>[] sample()
          Generates an array of lists 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

grids

public java.util.List<java.util.List<PoissonDiskMultiSampler.Circle>[][]> grids
Constructor Detail

PoissonDiskMultiSampler

public PoissonDiskMultiSampler(double x0,
                               double y0,
                               double x1,
                               double y1,
                               double[] minDist,
                               double[] minRadii,
                               double[] radii,
                               RealFunction2DDouble distribution,
                               boolean multiLayer,
                               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.

PoissonDiskMultiSampler

public PoissonDiskMultiSampler(double x0,
                               double y0,
                               double x1,
                               double y1,
                               double[] minDist,
                               double[] minRadii,
                               double[] radii,
                               RealFunction2DDouble distribution,
                               boolean multiLayer)
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<PoissonDiskMultiSampler.Circle>[] sample()
Generates an array of lists of points following the Poisson distribution. No more than MAX_POINTS are produced. If multilayer is true, then a check is performed removing any points that collide with points in lower layers.

Returns:
The sample set.

pointDoubleToInt

public static Vector2DInt pointDoubleToInt(Vector2DDouble pointDouble,
                                           Vector2DDouble origin,
                                           double cellSize)
Converts a PointDouble to a PointInt that represents the index coordinates of the point in the background grid.


generateAround

public static PoissonDiskMultiSampler.Circle generateAround(Vector2DDouble centre,
                                                            double minDist,
                                                            double minRadius,
                                                            double radius,
                                                            double distanceScale,
                                                            double angleScale,
                                                            double radiusScale)
Generates a random point in the analus around the given point. The analus has inner radius minimum distance and outer radius twice that.

Parameters:
centre - The point around which the random point should be.
distanceScale - TODO
angleScale - TODO
radiusScale - TODO
Returns:
A new point, randomly selected.