pub struct Aabb {
pub min: Point,
pub max: Point,
}Expand description
Axis-aligned bounding box. An empty box has min > max.
Fields§
§min: PointMinimum corner.
max: PointMaximum corner.
Implementations§
Source§impl Aabb
impl Aabb
Sourcepub const EMPTY: Self
pub const EMPTY: Self
The empty box (identity for Aabb::union).
Sourcepub fn from_corners(a: Point, b: Point) -> Self
pub fn from_corners(a: Point, b: Point) -> Self
Box from two corners in any order.
Sourcepub fn from_points<I: IntoIterator<Item = Point>>(points: I) -> Self
pub fn from_points<I: IntoIterator<Item = Point>>(points: I) -> Self
Smallest box containing all points (empty for no points).
Sourcepub fn contains_point(self, p: Point) -> bool
pub fn contains_point(self, p: Point) -> bool
Point inside or on the boundary.
Sourcepub fn intersects(self, o: Self) -> bool
pub fn intersects(self, o: Self) -> bool
Boxes overlap (touching counts).
Sourcepub fn distance_to_point(self, p: Point) -> f64
pub fn distance_to_point(self, p: Point) -> f64
Distance from p to the box (0 inside).
Trait Implementations§
impl Copy for Aabb
Source§impl<'de> Deserialize<'de> for Aabb
impl<'de> Deserialize<'de> for Aabb
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 Aabb
Auto Trait Implementations§
impl Freeze for Aabb
impl RefUnwindSafe for Aabb
impl Send for Aabb
impl Sync for Aabb
impl Unpin for Aabb
impl UnsafeUnpin for Aabb
impl UnwindSafe for Aabb
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