[][src]Struct fart_aabb::Aabb

pub struct Aabb<T, U = UnknownUnit> { /* fields omitted */ }

An axis-aligned bounding box.

  • T is the numeric type. i32 or f64 etc.
  • U is the unit. ScreenSpace or WorldSpace etc.

Methods

impl<T, U> Aabb<T, U> where
    T: Copy + Num + PartialOrd
[src]

pub fn new(min: TypedPoint2D<T, U>, max: TypedPoint2D<T, U>) -> Aabb<T, U>[src]

Construct a new axis-aligned bounding box.

min's x and y components must be less than or equal to max's.

pub fn for_vertices<I>(vertices: I) -> Aabb<T, U> where
    I: IntoIterator<Item = TypedPoint2D<T, U>>, 
[src]

Construct a new axis-aligned bounding box that contains the given set of vertices.

Panics

Panics if vertices is empty.

pub fn min(&self) -> TypedPoint2D<T, U>[src]

Get this AABB's min.

pub fn max(&self) -> TypedPoint2D<T, U>[src]

Get this AABB's max.

pub fn width(&self) -> T[src]

Get the width of this AABB.

pub fn height(&self) -> T[src]

Get the height of this AABB.

pub fn area(&self) -> T[src]

Get this AABB's area.

pub fn join(&self, other: &Aabb<T, U>) -> Aabb<T, U>[src]

Return the least upper bound of self and other.

pub fn contains(&self, other: &Aabb<T, U>) -> bool[src]

Does self contain other?

pub fn intersects(&self, other: &Aabb<T, U>) -> bool[src]

Does self intersect with other?

Trait Implementations

impl<T: PartialEq, U: PartialEq> PartialEq<Aabb<T, U>> for Aabb<T, U>[src]

impl<T: Clone, U: Clone> Clone for Aabb<T, U>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T, U> Debug for Aabb<T, U> where
    T: Debug
[src]

Auto Trait Implementations

impl<T, U> Send for Aabb<T, U> where
    T: Send,
    U: Send

impl<T, U> Sync for Aabb<T, U> where
    T: Sync,
    U: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.