Package org.joml.sampling
Class BestCandidateSampling.Sphere
- java.lang.Object
-
- org.joml.sampling.BestCandidateSampling.Sphere
-
- Enclosing class:
- BestCandidateSampling
public static class BestCandidateSampling.Sphere extends java.lang.ObjectGenerates Best Candidate samples on a unit sphere.References:
- Author:
- Kai Burjack
-
-
Constructor Summary
Constructors Constructor Description Sphere()Create a new instance ofBestCandidateSampling.Sphereto configure and generate 'best candidate' sample positions on the unit sphere.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BestCandidateSampling.Spheregenerate(float[] xyzs)Generate 'best candidate' sample positions and store the coordinates of all generated samples into the givenxyzsfloat array.BestCandidateSampling.Spheregenerate(java.nio.FloatBuffer xyzs)Generate 'best candidate' sample positions and store the coordinates of all generated samples into the givenxyzsFloatBuffer.BestCandidateSampling.Spheregenerate(Callback3d callback)Generate 'best candidate' sample call the givencallbackfor each generated sample.BestCandidateSampling.SpherenumCandidates(int numCandidates)Set the number of candidates to try for each generated sample.BestCandidateSampling.SpherenumSamples(int numSamples)Set the number of samples to generate.BestCandidateSampling.SphereonHemisphere(boolean onHemisphere)Set whether to generate samples on a hemisphere around the+Zaxis.BestCandidateSampling.Sphereseed(long seed)Set the seed to initialize the pseudo-random number generator with.
-
-
-
Constructor Detail
-
Sphere
public Sphere()
Create a new instance ofBestCandidateSampling.Sphereto configure and generate 'best candidate' sample positions on the unit sphere.
-
-
Method Detail
-
generate
public BestCandidateSampling.Sphere generate(float[] xyzs)
Generate 'best candidate' sample positions and store the coordinates of all generated samples into the givenxyzsfloat 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.Sphere generate(java.nio.FloatBuffer xyzs)
Generate 'best candidate' sample positions and store the coordinates of all generated samples into the givenxyzsFloatBuffer.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 leastnumSamplesremaining elements. The position of the buffer will not be modified by this method- Returns:
- this
-
seed
public BestCandidateSampling.Sphere seed(long seed)
Set the seed to initialize the pseudo-random number generator with.- Parameters:
seed- the seed value- Returns:
- this
-
numSamples
public BestCandidateSampling.Sphere numSamples(int numSamples)
Set the number of samples to generate.- Parameters:
numSamples- the number of samples- Returns:
- this
-
numCandidates
public BestCandidateSampling.Sphere numCandidates(int numCandidates)
Set the number of candidates to try for each generated sample.- Parameters:
numCandidates- the number of candidates to try- Returns:
- this
-
onHemisphere
public BestCandidateSampling.Sphere onHemisphere(boolean onHemisphere)
Set whether to generate samples on a hemisphere around the+Zaxis.The default is
false, which will generate samples on the whole unit sphere.- Parameters:
onHemisphere- whether to generate samples on the hemisphere- Returns:
- this
-
generate
public BestCandidateSampling.Sphere generate(Callback3d callback)
Generate 'best candidate' sample call the givencallbackfor 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
-
-