Description
Create a sampler to sample uniformly within a line:
public abstract class LineSampler implements SharedStateSampler<LineSampler> { public static LineSampler of(double[] a, double[] b, UniformRandomProvider rng); }
Sampling can be performed using the same method as the TriangleSampler without the third coordinate:
v = b - a p = a + s * v with s a uniform deviate in [0, 1]
To allow computation with any finite coordinates the vector does not require computation:
p = a + s * (b - a) = a + sb - sa = (1 - s)a + sb
This is the same method used in the ContinuousUniformSampler but extended to N-dimensions.
Attachments
Issue Links
- is a child of
-
RNG-132 Package rng.sampling.shape for sampling coordinates from shapes
- Closed