Package org.joml.sampling
Class StratifiedSampling
java.lang.Object
org.joml.sampling.StratifiedSampling
Creates samples on a unit quad using an NxN strata grid.
- Author:
- Kai Burjack
-
Constructor Summary
ConstructorDescriptionStratifiedSampling
(long seed) Create a new instance ofStratifiedSampling
and initialize the random number generator with the givenseed
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
generateCentered
(int n, float centering, Callback2d callback) Generaten * n
random sample positions in the unit square ofx, y = [-1..+1]
.void
generateRandom
(int n, Callback2d callback) Generaten * n
random sample positions in the unit square ofx, y = [-1..+1]
.
-
Constructor Details
-
StratifiedSampling
public StratifiedSampling(long seed) Create a new instance ofStratifiedSampling
and initialize the random number generator with the givenseed
.- Parameters:
seed
- the seed to initialize the random number generator with
-
-
Method Details
-
generateRandom
Generaten * n
random sample positions in the unit square ofx, y = [-1..+1]
.Each sample within its stratum is distributed randomly.
- Parameters:
n
- the number of strata in each dimensioncallback
- will be called for each generated sample position
-
generateCentered
Generaten * n
random sample positions in the unit square ofx, 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 dimensioncentering
- 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
-