Struct inter_val::BoxN

source ·
pub struct BoxN<const N: usize, T, L = Inclusive, R = L>(/* private fields */);
Expand description

n-dimensional axis-aligned box as a cartesian product set of intervals, i.g., [a, b)^n.

Implementations§

source§

impl<const N: usize, T, L, R> BoxN<N, T, L, R>

source

pub fn from_array(src: [Interval<T, L, R>; N]) -> Self

source

pub fn into_array(self) -> [Interval<T, L, R>; N]

source§

impl<T, L, R> BoxN<2, T, L, R>

source

pub fn new(x: Interval<T, L, R>, y: Interval<T, L, R>) -> Self

source§

impl<T, L, R> BoxN<3, T, L, R>

source

pub fn new( x: Interval<T, L, R>, y: Interval<T, L, R>, z: Interval<T, L, R> ) -> Self

source§

impl<T, L, R> BoxN<4, T, L, R>

source

pub fn new( x: Interval<T, L, R>, y: Interval<T, L, R>, z: Interval<T, L, R>, w: Interval<T, L, R> ) -> Self

source§

impl<const N: usize, T: PartialOrd + Clone, L: BoundaryOf<Left>, R: BoundaryOf<Right>> BoxN<N, T, L, R>

source

pub fn try_between(a: &[T; N], b: &[T; N]) -> Option<Self>
where T: Into<Bound<T, L>> + Into<Bound<T, R>>,

use inter_val::{Box2, Exclusive};
let a: Box2<i32> = Box2::try_between(&[0, 0], &[10, 20]).unwrap();
assert_eq!(a.x.inf(), &0);
assert_eq!(a.y.sup(), &20);

assert!(Box2::<i32, Exclusive>::try_between(&[0, 0], &[0, 1]).is_none());
source

pub fn between(a: &[T; N], b: &[T; N]) -> Self
where T: Into<Bound<T, L>> + Into<Bound<T, R>>,

use inter_val::Box2;
let a: Box2<i32> = Box2::between(&[0, 0], &[10, 20]);
assert_eq!(a.inf(), [0, 0]);
assert_eq!(a.sup(), [10, 20]);
source

pub fn inf(&self) -> NDim<N, T>

source

pub fn sup(&self) -> NDim<N, T>

source

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

source

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

source

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

source

pub fn closure(&self) -> BoxN<N, T, Inclusive>

source

pub fn interior(&self) -> Option<BoxN<N, T, Exclusive>>

source

pub fn intersection(&self, other: &Self) -> Option<Self>

source

pub fn span(&self, other: &Self) -> Self

source

pub fn dilate(&self, delta: T) -> Self
where T: Add<Output = T> + Sub<Output = T>,

source

pub fn hull(self, p: &[T; N]) -> Self

use inter_val::Box2;
let a: Box2<i32> = Box2::between(&[0, 0], &[10, 10]);
let b = a.hull(&[20, 5]);
assert_eq!(b, Box2::between(&[0, 0], &[20, 10]));
source

pub fn span_many<A: Into<Self>>( items: impl IntoIterator<Item = A> ) -> Option<Self>

source

pub fn hull_many<'a>( items: impl IntoIterator<Item = &'a [T; N]> ) -> Option<Self>
where T: Clone + Into<Bound<T, L>> + Into<Bound<T, R>> + 'a,

source§

impl<const N: usize, T, L, R> BoxN<N, T, L, R>
where T: PartialOrd + Clone + Num, L: BoundaryOf<Left>, R: BoundaryOf<Right>,

source

pub fn size(&self) -> NDim<N, T>

source

pub fn measure(&self) -> T

source§

impl<const N: usize, T: Float, L: BoundaryOf<Left>, R: BoundaryOf<Right>> BoxN<N, T, L, R>

source

pub fn center(&self) -> NDim<N, T>

Methods from Deref<Target = NDim<N, Interval<T, L, R>>>§

source

pub fn as_array(&self) -> &[T; N]

source

pub fn as_array_mut(&mut self) -> &mut [T; N]

source

pub fn iter(&self) -> Iter<'_, T>

Trait Implementations§

source§

impl<const N: usize, T, L, R> AsRef<[Interval<T, L, R>; N]> for BoxN<N, T, L, R>

source§

fn as_ref(&self) -> &[Interval<T, L, R>; N]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<const N: usize, T: Clone, L: Clone, R: Clone> Clone for BoxN<N, T, L, R>

source§

fn clone(&self) -> BoxN<N, T, L, R>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<const N: usize, T: Debug, L: Debug, R: Debug> Debug for BoxN<N, T, L, R>

source§

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

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

impl<const N: usize, T, L, R> Deref for BoxN<N, T, L, R>

§

type Target = NDim<N, Interval<T, L, R>>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<const N: usize, T, L, R> DerefMut for BoxN<N, T, L, R>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<const N: usize, T, L, R> From<[Interval<T, L, R>; N]> for BoxN<N, T, L, R>

source§

fn from(src: [Interval<T, L, R>; N]) -> Self

Converts to this type from the input type.
source§

impl<const N: usize, T, L, R> From<BoxN<N, T, L, R>> for [Interval<T, L, R>; N]

source§

fn from(src: BoxN<N, T, L, R>) -> Self

Converts to this type from the input type.
source§

impl<const N: usize, T: PartialEq, L: PartialEq, R: PartialEq> PartialEq for BoxN<N, T, L, R>

source§

fn eq(&self, other: &BoxN<N, T, L, R>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize, T: Copy, L: Copy, R: Copy> Copy for BoxN<N, T, L, R>

source§

impl<const N: usize, T: Eq, L: Eq, R: Eq> Eq for BoxN<N, T, L, R>

source§

impl<const N: usize, T, L, R> StructuralEq for BoxN<N, T, L, R>

source§

impl<const N: usize, T, L, R> StructuralPartialEq for BoxN<N, T, L, R>

Auto Trait Implementations§

§

impl<const N: usize, T, L, R> RefUnwindSafe for BoxN<N, T, L, R>

§

impl<const N: usize, T, L, R> Send for BoxN<N, T, L, R>
where L: Send, R: Send, T: Send,

§

impl<const N: usize, T, L, R> Sync for BoxN<N, T, L, R>
where L: Sync, R: Sync, T: Sync,

§

impl<const N: usize, T, L, R> Unpin for BoxN<N, T, L, R>
where L: Unpin, R: Unpin, T: Unpin,

§

impl<const N: usize, T, L, R> UnwindSafe for BoxN<N, T, L, R>
where L: UnwindSafe, R: UnwindSafe, T: 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> 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,

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.