[−][src]Struct static_aabb2d_index::AABB
Simple 2D axis aligned bounding box which holds the extents of a 2D box.
Fields
min_x: T
Min x extent of the axis aligned bounding box.
min_y: T
Min y extent of the axis aligned bounding box.
max_x: T
Max x extent of the axis aligned bounding box.
max_y: T
Max y extent of the axis aligned bounding box.
Implementations
impl<T> AABB<T> where
T: IndexableNum,
[src]
T: IndexableNum,
pub fn new(min_x: T, min_y: T, max_x: T, max_y: T) -> AABB<T>
[src]
pub fn overlaps_aabb(&self, other: &AABB<T>) -> bool
[src]
Tests if this AABB overlaps another AABB (inclusive).
Examples
use static_aabb2d_index::AABB; let box_a = AABB::new(0, 0, 2, 2); let box_b = AABB::new(1, 1, 3, 3); assert!(box_a.overlaps_aabb(&box_b)); assert!(box_b.overlaps_aabb(&box_a)); let box_c = AABB::new(-1, -1, 0, 0); assert!(!box_c.overlaps_aabb(&box_b)); // note: overlap check is inclusive of edges/corners touching assert!(box_c.overlaps_aabb(&box_a));
pub fn overlaps(&self, min_x: T, min_y: T, max_x: T, max_y: T) -> bool
[src]
Tests if this AABB overlaps another AABB. Same as AABB::overlaps_aabb but accepts AABB extent parameters directly.
pub fn contains_aabb(&self, other: &AABB<T>) -> bool
[src]
Tests if this AABB fully contains another AABB (inclusive).
Examples
use static_aabb2d_index::AABB; let box_a = AABB::new(0, 0, 3, 3); let box_b = AABB::new(1, 1, 2, 2); assert!(box_a.contains_aabb(&box_b)); assert!(!box_b.contains_aabb(&box_a));
pub fn contains(&self, min_x: T, min_y: T, max_x: T, max_y: T) -> bool
[src]
Tests if this AABB fully contains another AABB. Same as AABB::contains but accepts AABB extent parameters directly.
Trait Implementations
impl<T: Clone> Clone for AABB<T>
[src]
impl<T: Copy> Copy for AABB<T>
[src]
impl<T: Debug> Debug for AABB<T>
[src]
impl<T> Default for AABB<T> where
T: IndexableNum,
[src]
T: IndexableNum,
impl<T: Eq> Eq for AABB<T>
[src]
impl<T: Hash> Hash for AABB<T>
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: PartialEq> PartialEq<AABB<T>> for AABB<T>
[src]
impl<T> StructuralEq for AABB<T>
[src]
impl<T> StructuralPartialEq for AABB<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for AABB<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for AABB<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for AABB<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for AABB<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for AABB<T> where
T: UnwindSafe,
[src]
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,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,