pub struct AABB { /* private fields */ }Expand description
Axis-aligned bounding box
Implementations§
source§impl AABB
impl AABB
sourcepub fn from_points(p0: &Point3, p1: &Point3) -> Self
pub fn from_points(p0: &Point3, p1: &Point3) -> Self
Create a new axis-aligned bounding box
sourcepub const fn from_corners(top_left: &Point3, bottom_right: &Point3) -> Self
pub const fn from_corners(top_left: &Point3, bottom_right: &Point3) -> Self
Create a new axis-aligned bounding box
source§impl AABB
impl AABB
sourcepub const TOP_NORMAL: Vector3 = Vector3::UNIT_Y
pub const TOP_NORMAL: Vector3 = Vector3::UNIT_Y
Get the normal for the top of the box.
sourcepub const BOTTOM_NORMAL: Vector3 = Vector3::NEG_UNIT_Y
pub const BOTTOM_NORMAL: Vector3 = Vector3::NEG_UNIT_Y
Get the normal for the bottom of the box.
sourcepub const FRONT_NORMAL: Vector3 = Vector3::UNIT_Z
pub const FRONT_NORMAL: Vector3 = Vector3::UNIT_Z
Get the normal for the front of the box.
sourcepub const BACK_NORMAL: Vector3 = Vector3::NEG_UNIT_Z
pub const BACK_NORMAL: Vector3 = Vector3::NEG_UNIT_Z
Get the normal for the back of the box.
sourcepub const LEFT_NORMAL: Vector3 = Vector3::NEG_UNIT_X
pub const LEFT_NORMAL: Vector3 = Vector3::NEG_UNIT_X
Get the normal for the left of the box.
sourcepub const RIGHT_NORMAL: Vector3 = Vector3::UNIT_X
pub const RIGHT_NORMAL: Vector3 = Vector3::UNIT_X
Get the normal for the right of the box.
sourcepub const fn bottom_plane(&self) -> Plane
pub const fn bottom_plane(&self) -> Plane
Get the bottom-right corner of the bounding box
sourcepub const fn front_plane(&self) -> Plane
pub const fn front_plane(&self) -> Plane
Get the front plane of the bounding box
sourcepub const fn back_plane(&self) -> Plane
pub const fn back_plane(&self) -> Plane
Get the back plane of the bounding box
sourcepub fn left_plane(&self) -> Plane
pub fn left_plane(&self) -> Plane
Get the left plane of the bounding box
sourcepub const fn right_plane(&self) -> Plane
pub const fn right_plane(&self) -> Plane
Get the right plane of the bounding box
sourcepub const fn top(&self) -> Vector3
pub const fn top(&self) -> Vector3
Get a vector of the sized normal of the top-face of the bounding box.
sourcepub const fn bottom(&self) -> Vector3
pub const fn bottom(&self) -> Vector3
Get a vector of the sized normal of the bottom-face of the bounding box.
sourcepub const fn front(&self) -> Vector3
pub const fn front(&self) -> Vector3
Get a vector of the sized normal of the front-face of the bounding box.
sourcepub const fn back(&self) -> Vector3
pub const fn back(&self) -> Vector3
Get a vector of the sized normal of the back-face of the bounding box.
sourcepub const fn left(&self) -> Vector3
pub const fn left(&self) -> Vector3
Get a vector of the sized normal of the left-face of the bounding box.
sourcepub const fn right(&self) -> Vector3
pub const fn right(&self) -> Vector3
Get a vector of the sized normal of the right-face of the bounding box.
source§impl AABB
impl AABB
sourcepub fn contains_point(&self, point: &Point3) -> bool
pub fn contains_point(&self, point: &Point3) -> bool
Check if the bounding box contains a point
source§impl AABB
impl AABB
sourcepub fn nearest_point(&self, point: &Point3) -> Point3
pub fn nearest_point(&self, point: &Point3) -> Point3
Get the nearest point on the bounding box to a point
§Parameters
point- The point to find the nearest point to
sourcepub fn distance_to(&self, point: &Point3) -> f32
pub fn distance_to(&self, point: &Point3) -> f32
Get the distance to the nearest point on the bounding box to a point
§Parameters
point- The point to find the nearest point to
sourcepub fn square_distance_to(&self, point: &Point3) -> f32
pub fn square_distance_to(&self, point: &Point3) -> f32
Get the square distance to the nearest point on the bounding box to a point
§Parameters
point- The point to find the nearest point to