Class StratifiedSampling


  • public class StratifiedSampling
    extends java.lang.Object
    Creates samples on a unit quad using an NxN strata grid.
    Author:
    Kai Burjack
    • Constructor Summary

      Constructors 
      Constructor Description
      StratifiedSampling​(long seed)
      Create a new instance of StratifiedSampling and initialize the random number generator with the given seed.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void generateCentered​(int n, float centering, Callback2d callback)
      Generate n * n random sample positions in the unit square of x, y = [-1..+1].
      void generateRandom​(int n, Callback2d callback)
      Generate n * n random sample positions in the unit square of x, y = [-1..+1].
      • Methods inherited from class java.lang.Object

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

      • StratifiedSampling

        public StratifiedSampling​(long seed)
        Create a new instance of StratifiedSampling and initialize the random number generator with the given seed.
        Parameters:
        seed - the seed to initialize the random number generator with
    • Method Detail

      • generateRandom

        public void generateRandom​(int n,
                                   Callback2d callback)
        Generate n * n random sample positions in the unit square of x, y = [-1..+1].

        Each sample within its stratum is distributed randomly.

        Parameters:
        n - the number of strata in each dimension
        callback - will be called for each generated sample position
      • generateCentered

        public void generateCentered​(int n,
                                     float centering,
                                     Callback2d callback)
        Generate n * n random sample positions in the unit square of x, y = [-1..+1].

        Each sample within its stratum is confined to be within [-centering/2..1-centering] of its stratum.

        Parameters:
        n - the number of strata in each dimension
        centering - determines how much the random samples in each stratum are confined to be near the center of the stratum. Possible values are [0..1]
        callback - will be called for each generated sample position