- All Implemented Interfaces:
public class TetrahedronSampler extends Object implements SharedStateObjectSampler<double>Generate points uniformly distributed within a tetrahedron.
Uses the algorithm described in:
Rocchini, C. and Cignoni, P. (2001)
Generating Random Points in a Tetrahedron.
Journal of Graphics Tools 5(4), pp. 9-12.
- See Also:
- Rocchini, C. & Cignoni, P. (2001) Journal of Graphics Tools 5, pp. 9-12
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description
of(UniformRandomProvider rng, double a, double b, double c, double d)Create a tetrahedron sampler with vertices
sample()Create a sample.
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.
public double sample()Description copied from interface:
ObjectSamplerCreate a sample.
public static TetrahedronSampler of(UniformRandomProvider rng, double a, double b, double c, double d)Create a tetrahedron sampler with vertices
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.
- the sampler
IllegalArgumentException- If the vertices do not have length 3; or vertices have non-finite coordinates