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.

Bounds represents the hyperrectangle [low, high] inflated by slack for membership tests, supporting uniform sampling and clipping. The dimensionality dims matches low.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 slack of the corresponding low/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 x to the closed [low, high] interval.

fn contains(&self, x: ArrayView1<T>) -> bool

True if every coordinate of x lies within slack of 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 Bounds and asserts low.len() == high.len().