[−]Struct geng::prelude::AABB
Axis aligned bounding box.
Fields
x_min: T
x_max: T
y_min: T
y_max: T
Implementations
impl<T> AABB<T> where
T: UNum,
T: UNum,
pub fn bottom_left(&self) -> Vec2<T>
pub fn bottom_right(&self) -> Vec2<T>
pub fn top_left(&self) -> Vec2<T>
pub fn top_right(&self) -> Vec2<T>
pub fn center(&self) -> Vec2<T>
pub fn from_corners(p1: Vec2<T>, p2: Vec2<T>) -> AABB<T>
pub fn pos_size(pos: Vec2<T>, size: Vec2<T>) -> AABB<T>
pub fn map<U, F>(self, f: F) -> AABB<U> where
F: Fn(T) -> U,
U: UNum,
F: Fn(T) -> U,
U: UNum,
pub fn width(&self) -> T
pub fn height(&self) -> T
Get rect's height.
pub fn size(&self) -> Vec2<T>
Get rect's size.
pub fn contains(&self, point: Vec2<T>) -> bool
Check if a point is inside the rect.
Examples
use batbox::*; let rect = AABB::from_corners(vec2(1, 2), vec2(3, 4)); assert!(rect.contains(vec2(2, 3))); assert!(!rect.contains(vec2(5, 5)));
pub fn intersects(&self, other: &AABB<T>) -> bool
pub fn translate(self, v: Vec2<T>) -> AABB<T>
pub fn points(&self) -> impl Iterator<Item = Vec2<T>> where
Range<T>: Iterator,
<Range<T> as Iterator>::Item == T,
Range<T>: Iterator,
<Range<T> as Iterator>::Item == T,
impl<T> AABB<T> where
T: Float,
T: Float,
pub fn distance_to(&self, other: &AABB<T>) -> T
Trait Implementations
impl<T> Clone for AABB<T> where
T: Clone,
T: Clone,
fn clone(&self) -> AABB<T>
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Copy for AABB<T> where
T: Copy,
T: Copy,
impl<T> Debug for AABB<T> where
T: Debug,
T: Debug,
impl<T> Eq for AABB<T> where
T: Eq,
T: Eq,
impl<T> PartialEq<AABB<T>> for AABB<T> where
T: PartialEq<T>,
T: PartialEq<T>,
Auto Trait Implementations
impl<T> RefUnwindSafe for AABB<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for AABB<T> where
T: Send,
T: Send,
impl<T> Sync for AABB<T> where
T: Sync,
T: Sync,
impl<T> Unpin for AABB<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for AABB<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow(&self) -> &TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,