Package micycle.pgs.commons
Class PoissonDistributionJRUS
java.lang.Object
micycle.pgs.commons.PoissonDistributionJRUS
Generates sets of random points via Poisson Disk Sampling.
Poisson-disc sampling produces points that are tightly-packed, but no closer to each other than a specified minimum distance, resulting in a natural and desirable pattern for many applications. This distribution is also described as blue noise.
The algorithm in this class is a Fork of Martin Roberts’s tweak to Bridson's Algorithm for Poisson Disk sampling. This approach is faster and better than the Bridson Algorithm, and balances performance with distribution quality compared to Robert's tweak.
For more, see this analysis of different Poisson disk sampling functions.
- Author:
- Jacob Rus, Java port by Michael Carleton
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<processing.core.PVector>
generate
(double xmin, double ymin, double xmax, double ymax, double minDist) Generates a random point set, having a poisson/blue noise distribution.List<processing.core.PVector>
generate
(double xmin, double ymin, double xmax, double ymax, double minDist, int rejectionLimit) Generates a random point set, having a poisson/blue noise distribution.List<processing.core.PVector>
generate
(double xmin, double ymin, double xmax, double ymax, int n) Generates a poisson point set havingN
points.List<processing.core.PVector>
Returns the point set generated by most recent call togenerate()
.
-
Constructor Details
-
PoissonDistributionJRUS
public PoissonDistributionJRUS() -
PoissonDistributionJRUS
public PoissonDistributionJRUS(long seed)
-
-
Method Details
-
getPoints
Returns the point set generated by most recent call togenerate()
.- Returns:
-
generate
public List<processing.core.PVector> generate(double xmin, double ymin, double xmax, double ymax, double minDist, int rejectionLimit) Generates a random point set, having a poisson/blue noise distribution.- Parameters:
xmin
- x-coordinate of boundary minimumymin
- y-coordinate of boundary minimumxmax
- x-coordinate of boundary maximumymax
- y-coordinate of boundary maximumminDist
- minimum euclidean distance between any two pointsrejectionLimit
- the limit on the number of attempts to generate a random valid point around the previous point. Generally 6 is sufficient.- Returns:
- a set of random points
-
generate
public List<processing.core.PVector> generate(double xmin, double ymin, double xmax, double ymax, double minDist) Generates a random point set, having a poisson/blue noise distribution.- Parameters:
xmin
- x-coordinate of boundary minimumymin
- y-coordinate of boundary minimumxmax
- x-coordinate of boundary maximumymax
- y-coordinate of boundary maximumminDist
- minimum euclidean distance between any two points- Returns:
- a set of random points
-
generate
public List<processing.core.PVector> generate(double xmin, double ymin, double xmax, double ymax, int n) Generates a poisson point set havingN
points. After generating an initial set of approximately N (hereafterN'
) points (the actual number tends to overshoot the target by a few percent),N'-N
points are removed from the initial set.- Parameters:
xmin
- x-coordinate of boundary minimumymin
- y-coordinate of boundary minimumxmax
- x-coordinate of boundary maximumymax
- y-coordinate of boundary maximumn
- target size of poisson point set- Returns:
- a set of random points
-