Struct AABB

Source
pub struct AABB {
    pub min: Point,
    pub max: Point,
}
Expand description

An Axis-Aligned Bounding Box (AABB).

Fields§

§min: Point

The lowest point on the X and Y axes of the AABB.

§max: Point

The highest point on the X and Y axes of the AABB.

Implementations§

Source§

impl AABB

Source

pub fn new_position(x: f32, y: f32) -> Self

Creates a new AABB with a size of 1 unit, centered at a given co-ordinates.

Source

pub fn new_size(width: f32, height: f32) -> Self

Creates a new AABB with a given width and height, centered at the origin (0, 0).

Source

pub fn new_position_and_size(x: f32, y: f32, width: f32, height: f32) -> Self

Creates a new AABB with a given width and height, centered at the given co-ordinates.

Trait Implementations§

Source§

impl Collide<AABB> for AABB

AABB and AABB Collison

Source§

fn collide_with(&self, _other: &AABB) -> bool

Checks if two Colliders intersect. Read more
Source§

impl Collide<AABB> for Circle

Circle and AABB Collision

Source§

fn collide_with(&self, _other: &AABB) -> bool

Checks if two Colliders intersect. Read more
Source§

impl Collide<AABB> for Point

Point and AABB Collison

Source§

fn collide_with(&self, _other: &AABB) -> bool

Checks if two Colliders intersect. Read more
Source§

impl Collide<Circle> for AABB

AABB and Circle Collision

Source§

fn collide_with(&self, _other: &Circle) -> bool

Checks if two Colliders intersect. Read more
Source§

impl Collide<Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>> for AABB

AABB and Point Collision

Source§

fn collide_with(&self, _other: &Point) -> bool

Checks if two Colliders intersect. Read more
Source§

impl Collider for AABB

Source§

fn get_bounding_box(&self) -> AABB

Return the tight bounding box of the AABB, as a copy of itself

Source§

fn get_center(&self) -> Point

Get the center of the AABB Collider

Source§

impl Debug for AABB

Source§

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

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

impl Default for AABB

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for AABB

§

impl RefUnwindSafe for AABB

§

impl Send for AABB

§

impl Sync for AABB

§

impl Unpin for AABB

§

impl UnwindSafe for AABB

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> 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> Same for T

Source§

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, 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.