vectorial

Struct Rect3

Source
pub struct Rect3<T>(pub Vector3<T>, pub Vector3<T>);
Expand description

3-dimensional, axis-aligned rectangular prism structure defined as two opposite points.

Tuple Fields§

§0: Vector3<T>§1: Vector3<T>

Implementations§

Source§

impl<T> Rect3<T>

Source

pub fn depth<'a>(&'a self) -> <&'a T as Sub>::Output
where &'a T: Sub,

Returns &self.1.z - &self.0.z.

Source§

impl<T> Rect3<T>

Source

pub fn convert<U>(self) -> Rect3<U>
where T: Into<U>,

Converts the rectangle’s scalar components to another type.

Source

pub fn expand(self, rhs: Rect3<T>) -> Rect3<T>
where T: PartialOrd,

Returns the smallest possible rectangle that includes self and rhs, assuming that both rectangles are positive. Simply returns self if either rectangle is not positive.

Source

pub fn height<'a>(&'a self) -> <&'a T as Sub>::Output
where &'a T: Sub,

Returns &self.1.y - &self.0.y.

Source

pub fn intersect(self, rhs: Rect3<T>) -> Option<Rect3<T>>
where T: PartialOrd,

Returns the intersection of two positive rectangles. Returns None if either rectangle’s points are not ordered or if the rectangles do not intersect.

Source

pub fn is_ordered(&self) -> bool
where T: Ord,

Returns true if each field in self.1 is greater than or equal to the corresponding field in self.0.

Source

pub fn is_partially_ordered(&self) -> bool
where T: PartialOrd,

Returns true if each field in self.1 is greater than or equal to the corresponding field in self.0.

Source

pub fn is_partially_positive(&self) -> bool
where T: PartialOrd,

Returns true if each field in self.1 is greater than the corresponding field in self.0.

Source

pub fn is_positive(&self) -> bool
where T: Ord,

Returns true if each field in self.1 is greater than the corresponding field in self.0.

Source

pub const fn new(x0: T, y0: T, z0: T, x1: T, y1: T, z1: T) -> Rect3<T>

Constructs a rectangle from decomposed vectors.

Source

pub fn ordered(self) -> Rect3<T>
where T: Ord,

Sorts the corresponding fields of self.0 and self.1 in ascending order.

Source

pub fn partially_ordered(self) -> Rect3<T>
where T: PartialOrd,

Sorts the corresponding fields of self.0 and self.1 in ascending order.

Source

pub fn ref_convert<'a, U>(&'a self) -> Rect3<U>
where &'a T: Into<U>,

Converts the rectangle’s scalar components to another type.

Source

pub fn size<'a>(&'a self) -> Vector3<<&'a T as Sub>::Output>
where &'a T: Sub,

Returns self.1 - self.0.

Source

pub fn try_convert<U>(self) -> Result<Rect3<U>, <T as TryInto<U>>::Error>
where T: TryInto<U>,

Attempts to convert the rectangle’s scalar components to another type.

Source

pub fn try_ref_convert<'a, U>( &'a self, ) -> Result<Rect3<U>, <&'a T as TryInto<U>>::Error>
where &'a T: TryInto<U>,

Attempts to convert the rectangle’s scalar components to another type.

Source

pub fn width<'a>(&'a self) -> <&'a T as Sub>::Output
where &'a T: Sub,

Returns &self.1.x - &self.0.x.

Trait Implementations§

Source§

impl<'a, 'r, T> Add<&'r Vector3<T>> for &'a Rect3<T>
where &'a T: Add<&'r T>,

Source§

type Output = Rect3<<&'a T as Add<&'r T>>::Output>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'r Vector3<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'r, T> Add<&'r Vector3<T>> for Rect3<T>
where T: Add<&'r T>,

Source§

type Output = Rect3<<T as Add<&'r T>>::Output>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'r Vector3<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, T> Add<Vector3<T>> for &'a Rect3<T>
where T: Copy, &'a T: Add<T>,

Source§

type Output = Rect3<<&'a T as Add<T>>::Output>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T> Add<Vector3<T>> for Rect3<T>
where T: Copy + Add,

Source§

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

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'r, T> AddAssign<&'r Vector3<T>> for Rect3<T>
where T: AddAssign<&'r T>,

Source§

fn add_assign(&mut self, rhs: &'r Vector3<T>)

Performs the += operation. Read more
Source§

impl<T> AddAssign<Vector3<T>> for Rect3<T>
where T: Copy + AddAssign,

Source§

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

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Rect3<T>

Source§

fn clone(&self) -> Rect3<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 Rect3<T>

Source§

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

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

impl<T: Default> Default for Rect3<T>

Source§

fn default() -> Rect3<T>

Returns the “default value” for a type. Read more
Source§

impl<'a, 'r, T> Div<&'r T> for &'a Rect3<T>
where &'a T: Div<&'r T>,

Source§

type Output = Rect3<<&'a T as Div<&'r T>>::Output>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'r T) -> Self::Output

Performs the / operation. Read more
Source§

impl<'r, T> Div<&'r T> for Rect3<T>
where T: Div<&'r T>,

Source§

type Output = Rect3<<T as Div<&'r T>>::Output>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'r T) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a, 'r, T> Div<&'r Vector3<T>> for &'a Rect3<T>
where &'a T: Div<&'r T>,

Source§

type Output = Rect3<<&'a T as Div<&'r T>>::Output>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'r Vector3<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<'r, T> Div<&'r Vector3<T>> for Rect3<T>
where T: Div<&'r T>,

Source§

type Output = Rect3<<T as Div<&'r T>>::Output>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'r Vector3<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<'a, T> Div<T> for &'a Rect3<T>
where T: Copy, &'a T: Div<T>,

Source§

type Output = Rect3<<&'a T as Div<T>>::Output>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T> Div<T> for Rect3<T>
where T: Copy + Div,

Source§

type Output = Rect3<<T as Div>::Output>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<'a, T> Div<Vector3<T>> for &'a Rect3<T>
where T: Copy, &'a T: Div<T>,

Source§

type Output = Rect3<<&'a T as Div<T>>::Output>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T> Div<Vector3<T>> for Rect3<T>
where T: Copy + Div,

Source§

type Output = Rect3<<T as Div>::Output>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<'r, T> DivAssign<&'r T> for Rect3<T>
where T: DivAssign<&'r T>,

Source§

fn div_assign(&mut self, rhs: &'r T)

Performs the /= operation. Read more
Source§

impl<'r, T> DivAssign<&'r Vector3<T>> for Rect3<T>
where T: DivAssign<&'r T>,

Source§

fn div_assign(&mut self, rhs: &'r Vector3<T>)

Performs the /= operation. Read more
Source§

impl<T> DivAssign<T> for Rect3<T>
where T: Copy + DivAssign,

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign<Vector3<T>> for Rect3<T>
where T: Copy + DivAssign,

Source§

fn div_assign(&mut self, rhs: Vector3<T>)

Performs the /= operation. Read more
Source§

impl<T> From<(T, T, T)> for Rect3<T>
where T: Default,

Source§

fn from(size: (T, T, T)) -> Rect3<T>

Converts to this type from the input type.
Source§

impl<T> From<(T, T, T, T, T, T)> for Rect3<T>

Source§

fn from(t: (T, T, T, T, T, T)) -> Rect3<T>

Converts to this type from the input type.
Source§

impl<T> From<Vector3<T>> for Rect3<T>
where T: Default,

Source§

fn from(size: Vector3<T>) -> Rect3<T>

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for Rect3<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<'a, 'r, T> Mul<&'r T> for &'a Rect3<T>
where &'a T: Mul<&'r T>,

Source§

type Output = Rect3<<&'a T as Mul<&'r T>>::Output>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'r, T> Mul<&'r T> for Rect3<T>
where T: Mul<&'r T>,

Source§

type Output = Rect3<<T as Mul<&'r T>>::Output>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a, 'r, T> Mul<&'r Vector3<T>> for &'a Rect3<T>
where &'a T: Mul<&'r T>,

Source§

type Output = Rect3<<&'a T as Mul<&'r T>>::Output>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'r Vector3<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'r, T> Mul<&'r Vector3<T>> for Rect3<T>
where T: Mul<&'r T>,

Source§

type Output = Rect3<<T as Mul<&'r T>>::Output>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'r Vector3<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, T> Mul<T> for &'a Rect3<T>
where T: Copy, &'a T: Mul<T>,

Source§

type Output = Rect3<<&'a T as Mul<T>>::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<T> for Rect3<T>
where T: Copy + Mul,

Source§

type Output = Rect3<<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<'a, T> Mul<Vector3<T>> for &'a Rect3<T>
where T: Copy, &'a T: Mul<T>,

Source§

type Output = Rect3<<&'a T as Mul<T>>::Output>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T> Mul<Vector3<T>> for Rect3<T>
where T: Copy + Mul,

Source§

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

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'r, T> MulAssign<&'r T> for Rect3<T>
where T: MulAssign<&'r T>,

Source§

fn mul_assign(&mut self, rhs: &'r T)

Performs the *= operation. Read more
Source§

impl<'r, T> MulAssign<&'r Vector3<T>> for Rect3<T>
where T: MulAssign<&'r T>,

Source§

fn mul_assign(&mut self, rhs: &'r Vector3<T>)

Performs the *= operation. Read more
Source§

impl<T> MulAssign<T> for Rect3<T>
where T: Copy + MulAssign,

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign<Vector3<T>> for Rect3<T>
where T: Copy + MulAssign,

Source§

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

Performs the *= operation. Read more
Source§

impl<'a, T> Neg for &'a Rect3<T>
where &'a T: Neg,

Source§

type Output = Rect3<<&'a 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> Neg for Rect3<T>
where T: Neg,

Source§

type Output = Rect3<<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: PartialEq> PartialEq for Rect3<T>

Source§

fn eq(&self, other: &Rect3<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, 'r, T> Sub<&'r Vector3<T>> for &'a Rect3<T>
where &'a T: Sub<&'r T>,

Source§

type Output = Rect3<<&'a T as Sub<&'r T>>::Output>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'r Vector3<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'r, T> Sub<&'r Vector3<T>> for Rect3<T>
where T: Sub<&'r T>,

Source§

type Output = Rect3<<T as Sub<&'r T>>::Output>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'r Vector3<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T> Sub<Vector3<T>> for &'a Rect3<T>
where T: Copy, &'a T: Sub<T>,

Source§

type Output = Rect3<<&'a T as Sub<T>>::Output>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T> Sub<Vector3<T>> for Rect3<T>
where T: Copy + Sub,

Source§

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

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'r, T> SubAssign<&'r Vector3<T>> for Rect3<T>
where T: SubAssign<&'r T>,

Source§

fn sub_assign(&mut self, rhs: &'r Vector3<T>)

Performs the -= operation. Read more
Source§

impl<T> SubAssign<Vector3<T>> for Rect3<T>
where T: Copy + SubAssign,

Source§

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

Performs the -= operation. Read more
Source§

impl<T: Copy> Copy for Rect3<T>

Source§

impl<T: Eq> Eq for Rect3<T>

Source§

impl<T> StructuralPartialEq for Rect3<T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Rect3<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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 = 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>,

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.