public class TetrahedronSampler extends Object implements SharedStateObjectSampler<double[]>
Rocchini, C. and Cignoni, P. (2001)
Generating Random Points in a Tetrahedron.
Journal of Graphics Tools 5(4), pp. 9-12.
Sampling uses:
Modifier and Type | Method and Description |
---|---|
static TetrahedronSampler |
of(UniformRandomProvider rng,
double[] a,
double[] b,
double[] c,
double[] d)
Create a tetrahedron sampler with vertices
a , b , c and d . |
double[] |
sample()
Create an object sample.
|
TetrahedronSampler |
withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given
uniform random provider as the source of randomness.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
samples, samples
public double[] sample()
ObjectSampler
sample
in interface ObjectSampler<double[]>
public TetrahedronSampler withUniformRandomProvider(UniformRandomProvider rng)
withUniformRandomProvider
in interface SharedStateSampler<SharedStateObjectSampler<double[]>>
rng
- Generator of uniformly distributed random numbers.public static TetrahedronSampler of(UniformRandomProvider rng, double[] a, double[] b, double[] c, double[] d)
a
, b
, c
and d
.
Sampled points are uniformly distributed within the tetrahedron.
No test for a volume is performed. If the vertices are coplanar the sampling distribution is undefined.
rng
- Source of randomness.a
- The first vertex.b
- The second vertex.c
- The third vertex.d
- The fourth vertex.IllegalArgumentException
- If the vertices do not have length 3;
or vertices have non-finite coordinatesCopyright © 2016–2022 The Apache Software Foundation. All rights reserved.