Package org.joml.sampling
Class SpiralSampling
java.lang.Object
org.joml.sampling.SpiralSampling
Creates samples on a spiral around a center point.
- Author:
- Kai Burjack
-
Constructor Summary
ConstructorDescriptionSpiralSampling
(long seed) Create a new instance ofSpiralSampling
and initialize the random number generator with the givenseed
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
createEquiAngle
(float radius, int numRotations, int numSamples, float jitter, Callback2d callback) CreatenumSamples
number of samples on a spiral with maximum radiusradius
around the center usingnumRotations
number of rotations along the spiral, and call the givencallback
for each sample generated.void
createEquiAngle
(float radius, int numRotations, int numSamples, Callback2d callback) CreatenumSamples
number of samples on a spiral with maximum radiusradius
around the center usingnumRotations
number of rotations along the spiral, and call the givencallback
for each sample generated.
-
Constructor Details
-
SpiralSampling
public SpiralSampling(long seed) Create a new instance ofSpiralSampling
and initialize the random number generator with the givenseed
.- Parameters:
seed
- the seed to initialize the random number generator with
-
-
Method Details
-
createEquiAngle
CreatenumSamples
number of samples on a spiral with maximum radiusradius
around the center usingnumRotations
number of rotations along the spiral, and call the givencallback
for each sample generated.The generated sample points are distributed with equal angle differences around the spiral, so they concentrate towards the center.
- Parameters:
radius
- the maximum radius of the spiralnumRotations
- the number of rotations of the spiralnumSamples
- the number of samples to generatecallback
- will be called for each sample generated
-
createEquiAngle
public void createEquiAngle(float radius, int numRotations, int numSamples, float jitter, Callback2d callback) CreatenumSamples
number of samples on a spiral with maximum radiusradius
around the center usingnumRotations
number of rotations along the spiral, and call the givencallback
for each sample generated.The generated sample points are distributed with equal angle differences around the spiral, so they concentrate towards the center.
Additionally, the radius of each sample point is jittered by the given
jitter
factor.- Parameters:
radius
- the maximum radius of the spiralnumRotations
- the number of rotations of the spiralnumSamples
- the number of samples to generatejitter
- the factor by which the radius of each sample point is jittered. Possible values are[0..1]
callback
- will be called for each sample generated
-