Package org.joml.sampling
Class BestCandidateSampling.Cube
- java.lang.Object
-
- org.joml.sampling.BestCandidateSampling.Cube
-
- Enclosing class:
- BestCandidateSampling
public static class BestCandidateSampling.Cube extends java.lang.Object
Generates Best Candidate samples inside a unit cube.- Author:
- Kai Burjack
-
-
Constructor Summary
Constructors Constructor Description Cube()
Create a new instance ofBestCandidateSampling.Cube
to configure and generate 'best candidate' sample positions on the unit cube with each sample triednumCandidates
number of times, and call the givencallback
for each sample generate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BestCandidateSampling.Cube
generate(float[] xyzs)
Generate 'best candidate' sample positions and store the coordinates of all generated samples into the givenxyzs
float array.BestCandidateSampling.Cube
generate(java.nio.FloatBuffer xyzs)
Generate 'best candidate' sample positions and store the coordinates of all generated samples into the givenxyzs
FloatBuffer.BestCandidateSampling.Cube
generate(Callback3d callback)
Generate 'best candidate' sample positions and call the givencallback
for each generated sample.BestCandidateSampling.Cube
numCandidates(int numCandidates)
Set the number of candidates to try for each generated sample.BestCandidateSampling.Cube
numSamples(int numSamples)
Set the number of samples to generate.BestCandidateSampling.Cube
seed(long seed)
Set the seed to initialize the pseudo-random number generator with.
-
-
-
Constructor Detail
-
Cube
public Cube()
Create a new instance ofBestCandidateSampling.Cube
to configure and generate 'best candidate' sample positions on the unit cube with each sample triednumCandidates
number of times, and call the givencallback
for each sample generate.
-
-
Method Detail
-
seed
public BestCandidateSampling.Cube seed(long seed)
Set the seed to initialize the pseudo-random number generator with.- Parameters:
seed
- the seed value- Returns:
- this
-
numSamples
public BestCandidateSampling.Cube numSamples(int numSamples)
Set the number of samples to generate.- Parameters:
numSamples
- the number of samples- Returns:
- this
-
numCandidates
public BestCandidateSampling.Cube numCandidates(int numCandidates)
Set the number of candidates to try for each generated sample.- Parameters:
numCandidates
- the number of candidates to try- Returns:
- this
-
generate
public BestCandidateSampling.Cube generate(float[] xyzs)
Generate 'best candidate' sample positions and store the coordinates of all generated samples into the givenxyzs
float array.This method performs heap allocations, so should be used sparingly.
- Parameters:
xyzs
- will hold the x, y and z coordinates of all samples in the orderXYZXYZXYZ...
. This array must have a length of at leastnumSamples
- Returns:
- this
-
generate
public BestCandidateSampling.Cube generate(java.nio.FloatBuffer xyzs)
Generate 'best candidate' sample positions and store the coordinates of all generated samples into the givenxyzs
FloatBuffer.The samples will be written starting at the current position of the FloatBuffer. The position of the FloatBuffer will not be modified.
This method performs heap allocations, so should be used sparingly.
- Parameters:
xyzs
- will hold the x, y and z coordinates of all samples in the orderXYZXYZXYZ...
. This FloatBuffer must have at leastnumSamples
remaining elements. The position of the buffer will not be modified by this method- Returns:
- this
-
generate
public BestCandidateSampling.Cube generate(Callback3d callback)
Generate 'best candidate' sample positions and call the givencallback
for each generated sample.This method performs heap allocations, so should be used sparingly.
- Parameters:
callback
- will be called with the coordinates of each generated sample position- Returns:
- this
-
-