pub struct Aabb2 {
pub min: Point2,
pub max: Point2,
}Expand description
A 2D axis-aligned bounding box.
Fields§
§min: Point2Minimum corner.
max: Point2Maximum corner.
Implementations§
Source§impl Aabb2
impl Aabb2
Sourcepub fn from_points(points: impl IntoIterator<Item = Point2>) -> Self
pub fn from_points(points: impl IntoIterator<Item = Point2>) -> Self
Create an AABB from an iterator of points.
§Panics
Panics if the iterator is empty. Use Aabb2::try_from_points for
a fallible version.
Sourcepub fn try_from_points(points: impl IntoIterator<Item = Point2>) -> Option<Self>
pub fn try_from_points(points: impl IntoIterator<Item = Point2>) -> Option<Self>
Create an AABB from an iterator of points, returning None if empty.
Sourcepub fn intersects(self, other: Self) -> bool
pub fn intersects(self, other: Self) -> bool
Whether this box intersects another.
Sourcepub fn contains_point(self, p: Point2) -> bool
pub fn contains_point(self, p: Point2) -> bool
Whether this box contains a point.
Trait Implementations§
impl Copy for Aabb2
Source§impl<'de> Deserialize<'de> for Aabb2
impl<'de> Deserialize<'de> for Aabb2
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Aabb2
Auto Trait Implementations§
impl Freeze for Aabb2
impl RefUnwindSafe for Aabb2
impl Send for Aabb2
impl Sync for Aabb2
impl Unpin for Aabb2
impl UnsafeUnpin for Aabb2
impl UnwindSafe for Aabb2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more