Struct parry3d::utils::Interval

source ·
pub struct Interval<T>(pub T, pub T);
Expand description

An interval implementing interval arithmetic.

Tuple Fields§

§0: T§1: T

Implementations§

source§

impl<T> Interval<T>

source

pub fn sort(a: T, b: T) -> Self
where T: PartialOrd,

Create the interval [min(a, b), max(a, b)].

source

pub fn splat(e: T) -> Self
where T: Clone,

Create the interval [e, e] (single value).

source

pub fn contains(&self, t: T) -> bool
where T: PartialOrd<T>,

Does this interval contain the given value?

source

pub fn width(self) -> T::Output
where T: Sub<T>,

The width of this inverval.

source

pub fn midpoint(self) -> T
where T: RealField + Copy,

The average of the two interval endpoints.

source

pub fn split(self) -> [Self; 2]
where T: RealField + Copy,

Splits this interval at its mitpoint.

source

pub fn enclose(self, t: T) -> Self
where T: PartialOrd,

Computes a new interval that contains both self and t.

source

pub fn intersect(self, rhs: Self) -> Option<Self>

Computes the intersection between two intervals.

Returns None if the intervals are disjoint.

source

pub fn sin_cos(self) -> (Self, Self)
where T: RealField + Copy,

Bounds the image of thesin and cos functions on this interval.

source

pub fn sin(self) -> Self
where T: RealField + Copy,

Bounds the image of the sinus function on this interval.

source

pub fn cos(self) -> Self
where T: RealField + Copy,

Bounds the image of the cosinus function on this interval.

Trait Implementations§

source§

impl<T: Add<T> + Copy> Add<T> for Interval<T>

§

type Output = Interval<<T as Add>::Output>

The resulting type after applying the + operator.
source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Add<T>> Add for Interval<T>

§

type Output = Interval<<T as Add>::Output>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Copy + Add<T, Output = T>> AddAssign for Interval<T>

source§

fn add_assign(&mut self, rhs: Interval<T>)

Performs the += operation. Read more
source§

impl<T: Clone> Clone for Interval<T>

source§

fn clone(&self) -> Interval<T>

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<T: Debug> Debug for Interval<T>

source§

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

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

impl<T> Div for Interval<T>
where T: RealField + Copy + Div<T>, <T as Div<T>>::Output: SimdPartialOrd,

§

type Output = (Interval<<T as Div>::Output>, Option<Interval<<T as Div>::Output>>)

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
source§

impl<T: Hash> Hash for Interval<T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> Mul<T> for Interval<T>
where T: Copy + PartialOrd + Zero + Mul<T>,

§

type Output = Interval<<T as Mul>::Output>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T> Mul for Interval<T>
where T: Copy + PartialOrd + Zero + Mul<T>, <T as Mul<T>>::Output: SimdPartialOrd,

§

type Output = Interval<<T as Mul>::Output>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl<T> MulAssign for Interval<T>
where T: Copy + PartialOrd + Zero + Mul<T, Output = T>, <T as Mul<T>>::Output: SimdPartialOrd,

source§

fn mul_assign(&mut self, rhs: Interval<T>)

Performs the *= operation. Read more
source§

impl<T: Neg> Neg for Interval<T>

§

type Output = Interval<<T as Neg>::Output>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<T: One + Mul<T>> One for Interval<T>
where Interval<T>: Mul<Interval<T>, Output = Interval<T>>,

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

impl<T: PartialEq> PartialEq for Interval<T>

source§

fn eq(&self, other: &Interval<T>) -> 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<T: Sub<T> + Copy> Sub<T> for Interval<T>

§

type Output = Interval<<T as Sub>::Output>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T: Sub<T> + Copy> Sub for Interval<T>

§

type Output = Interval<<T as Sub>::Output>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<T: Copy + Sub<T, Output = T>> SubAssign for Interval<T>

source§

fn sub_assign(&mut self, rhs: Interval<T>)

Performs the -= operation. Read more
source§

impl<T: Zero + Add<T>> Zero for Interval<T>

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl<T: Copy> Copy for Interval<T>

source§

impl<T: Eq> Eq for Interval<T>

source§

impl<T> StructuralPartialEq for Interval<T>

Auto Trait Implementations§

§

impl<T> Freeze for Interval<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Interval<T>
where T: RefUnwindSafe,

§

impl<T> Send for Interval<T>
where T: Send,

§

impl<T> Sync for Interval<T>
where T: Sync,

§

impl<T> Unpin for Interval<T>
where T: Unpin,

§

impl<T> UnwindSafe for Interval<T>
where 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> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,