Class PoissonDistributionJRUS

java.lang.Object
micycle.pgs.commons.PoissonDistributionJRUS

public final class PoissonDistributionJRUS extends Object
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
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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 having N points.
    List<processing.core.PVector>
    Returns the point set generated by most recent call to generate().

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PoissonDistributionJRUS

      public PoissonDistributionJRUS()
    • PoissonDistributionJRUS

      public PoissonDistributionJRUS(long seed)
  • Method Details

    • getPoints

      public List<processing.core.PVector> getPoints()
      Returns the point set generated by most recent call to generate().
      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 minimum
      ymin - y-coordinate of boundary minimum
      xmax - x-coordinate of boundary maximum
      ymax - y-coordinate of boundary maximum
      minDist - minimum euclidean distance between any two points
      rejectionLimit - 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 minimum
      ymin - y-coordinate of boundary minimum
      xmax - x-coordinate of boundary maximum
      ymax - y-coordinate of boundary maximum
      minDist - 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 having N points. After generating an initial set of approximately N (hereafter N') 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 minimum
      ymin - y-coordinate of boundary minimum
      xmax - x-coordinate of boundary maximum
      ymax - y-coordinate of boundary maximum
      n - target size of poisson point set
      Returns:
      a set of random points