mod bounds¶
- module bounds¶
Box bounds on N-dimensional points. Box bounds on N-dimensional points with sampling and clipping.
Structs and Unions
- struct Bounds<T: Float>¶
Box bounds on an N-dimensional position.
Boundsrepresents the hyperrectangle[low, high]inflated byslackfor membership tests, supporting uniform sampling and clipping. The dimensionalitydimsmatcheslow.len() == high.len().- low: Array1<T>¶
Lower corner of the box.
- high: Array1<T>¶
Upper corner of the box.
- slack: T¶
Tolerance for membership tests; a point is considered in-bounds if each coordinate is within
slackof the correspondinglow/high.
- dims: usize¶
Number of dimensions, equal to
low.len().
Implementations
-
impl<T> Bounds<T>¶
where
T: Float + SampleUniform + 'static,
Uniform<T>: Distribution<T>
¶ Functions
- fn clip(&self, x: ArrayView1<T>) -> Array1<T>¶
Clips each coordinate of
xto the closed[low, high]interval.
- fn contains(&self, x: ArrayView1<T>) -> bool¶
True if every coordinate of
xlies withinslackof the box.
- fn mkpoint<R: Rng>(&self, rng: &mut R) -> Array1<T>¶
Draws a uniform random point inside the box.
- fn new(low: Array1<T>, high: Array1<T>, slack: T) -> Self¶
Constructs
Boundsand assertslow.len() == high.len().