Class TriangleSampler.TriangleSampler3D
java.lang.Object
org.apache.commons.rng.sampling.shape.TriangleSampler
org.apache.commons.rng.sampling.shape.TriangleSampler.TriangleSampler3D
- All Implemented Interfaces:
ObjectSampler<double[]>, SharedStateObjectSampler<double[]>, SharedStateSampler<SharedStateObjectSampler<double[]>>
- Enclosing class:
TriangleSampler
Sample uniformly from a triangle in 3D. This is an non-array based specialisation of
TriangleSampler.TriangleSamplerND for performance.- Since:
- 1.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleThe x component of vertex a.private final doubleThe y component of vertex a.private final doubleThe z component of vertex a.private final doubleThe x component of vertex b.private final doubleThe y component of vertex b.private final doubleThe z component of vertex b.private final doubleThe x component of vertex c.private final doubleThe y component of vertex c.private final doubleThe z component of vertex c. -
Constructor Summary
ConstructorsConstructorDescriptionTriangleSampler3D(UniformRandomProvider rng, double[] a, double[] b, double[] c) -
Method Summary
Modifier and TypeMethodDescriptiondouble[]createSample(double p1msmt, double s, double t) Creates the sample given the random variatessandtin the interval[0, 1]ands + t <= 1.Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.Methods inherited from class TriangleSampler
of, sampleMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ObjectSampler
samples, samples
-
Field Details
-
ax
private final double axThe x component of vertex a. -
ay
private final double ayThe y component of vertex a. -
az
private final double azThe z component of vertex a. -
bx
private final double bxThe x component of vertex b. -
by
private final double byThe y component of vertex b. -
bz
private final double bzThe z component of vertex b. -
cx
private final double cxThe x component of vertex c. -
cy
private final double cyThe y component of vertex c. -
cz
private final double czThe z component of vertex c.
-
-
Constructor Details
-
TriangleSampler3D
TriangleSampler3D(UniformRandomProvider rng, double[] a, double[] b, double[] c) - Parameters:
rng- Source of randomness.a- The first vertex.b- The second vertex.c- The third vertex.
-
TriangleSampler3D
TriangleSampler3D(UniformRandomProvider rng, TriangleSampler.TriangleSampler3D source) - Parameters:
rng- Generator of uniformly distributed random numberssource- Source to copy.
-
-
Method Details
-
createSample
public double[] createSample(double p1msmt, double s, double t) Description copied from class:TriangleSamplerCreates the sample given the random variatessandtin the interval[0, 1]ands + t <= 1. The sum1 - s - tis provided. The sample can be obtained from the triangle abc using:p = a(1 - s - t) + sb + tc
- Specified by:
createSamplein classTriangleSampler- Parameters:
p1msmt- plus 1 minus s minus t (1 - s - t)s- the first variate st- the second variate t- Returns:
- the sample
-
withUniformRandomProvider
Description copied from class:TriangleSamplerCreate a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProviderin interfaceSharedStateSampler<SharedStateObjectSampler<double[]>>- Specified by:
withUniformRandomProviderin classTriangleSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-