Class: PoissonDisk

PoissonDisk

PoissonDisk is a class that allows generating 2D points in a poisson distribution.


new PoissonDisk( [mode] [, initialDistance] [, decayFactor] [, maxTests])

Parameters:
Name Type Argument Description
mode <optional>

Whether the points should be contained in a square (PoissonDisk#SQUARE) or a circle (PoissonDisk#CIRCULAR). Defaults to circular.

initialDistance <optional>
decayFactor <optional>
maxTests <optional>
Properties:
Name Type Description
points

An array of all points currently generated.

Author:
  • derschmale <http://www.derschmale.com>

Members


<static> CIRCULAR

Generates points in a circle.


<static> SQUARE

Generates points in a square.

Methods


generatePoint()

Generates a single point and adds it to the set.


generatePoints(numPoints)

Generates new points and add them to the set. This does not return a set of points.

Parameters:
Name Type Description
numPoints

The amount of points to generate.


reset()

Clears all generated points.