Skip to main content

UniformBox

Struct UniformBox 

Source
pub struct UniformBox<const N: usize> { /* private fields */ }
Expand description

Samples uniformly from the axis-aligned box [lower, upper) in R^N.

Implementations§

Source§

impl<const N: usize> UniformBox<N>

Source

pub fn new(lower: [f64; N], upper: [f64; N]) -> Self

Creates a sampler for the box spanned by lower and upper.

§Panics

Panics if any bound is not finite or lower > upper on any axis.

Source

pub const fn lower(&self) -> &[f64; N]

The inclusive lower corner.

Source

pub const fn upper(&self) -> &[f64; N]

The upper corner.

Source

pub fn volume(&self) -> f64

The volume of the box.

Source

pub fn contains(&self, state: &[f64; N]) -> bool

Whether state lies inside the closed box.

Trait Implementations§

Source§

impl<const N: usize> Clone for UniformBox<N>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> Copy for UniformBox<N>

Source§

impl<const N: usize> Debug for UniformBox<N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const N: usize> PartialEq for UniformBox<N>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<const N: usize> Sampler<[f64; N]> for UniformBox<N>

Source§

fn sample_informed<Sp, R>( &mut self, space: &Sp, rng: &mut R, start: &[f64; N], goal: &[f64; N], max_cost: f64, ) -> Option<[f64; N]>
where Sp: StateSpace<State = [f64; N]>, R: Rng + ?Sized,

Samples the ProlateHyperspheroid with foci start and goal and transverse diameter max_cost, rejecting samples outside the box, which is uniform over the intersection.

Returns None without drawing when space is not Euclidean, the set is degenerate, or its volume is at least the box volume (then rejection from the box accepts more often). Returns None after INFORMED_BOX_ATTEMPTS samples outside the box, which happens when the set reaches far out of the box.

Source§

fn sample<R: Rng + ?Sized>(&mut self, rng: &mut R) -> [f64; N]

Draws one state.
Source§

impl<const N: usize> StructuralPartialEq for UniformBox<N>

Auto Trait Implementations§

§

impl<const N: usize> Forget for UniformBox<N>

§

impl<const N: usize> Freeze for UniformBox<N>
where [f64; N]: Freeze,

§

impl<const N: usize> Move for UniformBox<N>

§

impl<const N: usize> RefUnwindSafe for UniformBox<N>
where [f64; N]: RefUnwindSafe,

§

impl<const N: usize> Send for UniformBox<N>
where [f64; N]: Send,

§

impl<const N: usize> Sync for UniformBox<N>
where [f64; N]: Sync,

§

impl<const N: usize> Unpin for UniformBox<N>
where [f64; N]: Unpin,

§

impl<const N: usize> UnsafeUnpin for UniformBox<N>
where [f64; N]: UnsafeUnpin,

§

impl<const N: usize> UnwindSafe for UniformBox<N>
where [f64; N]: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.