Struct ark_api::BoundingBox
source · [−]Expand description
A 3-dimensional axis-aligned bounding box
Fields
min: Vec3Bounding box minimum (inclusive).
max: Vec3Bounding box maximum (inclusive).
Implementations
sourceimpl BoundingBox
impl BoundingBox
sourcepub const ZERO: BoundingBox = Self{ min: Vec3::ZERO, max: Vec3::ZERO,}
pub const ZERO: BoundingBox = Self{ min: Vec3::ZERO, max: Vec3::ZERO,}
A BoundingBox that only contains Vec3::ZERO.
sourcepub fn nothing() -> BoundingBox
pub fn nothing() -> BoundingBox
A BoundingBox that contains no points.
This is useful as the seed for bounding bounding boxes.
sourcepub fn everything() -> BoundingBox
pub fn everything() -> BoundingBox
A BoundingBox that contains every point.
sourcepub fn from_min_max(min: Vec3, max: Vec3) -> BoundingBox
pub fn from_min_max(min: Vec3, max: Vec3) -> BoundingBox
Create a bounding box from a minimum and maximum position.
pub fn from_min_size(min: Vec3, size: Vec3) -> BoundingBox
sourcepub fn from_center_size(center: Vec3, size: Vec3) -> BoundingBox
pub fn from_center_size(center: Vec3, size: Vec3) -> BoundingBox
Create a bounding box from a center position and a size.
sourcepub fn from_points(points: impl Iterator<Item = Vec3>) -> BoundingBox
pub fn from_points(points: impl Iterator<Item = Vec3>) -> BoundingBox
Create a bounding box from an iterator of points that the bounding box will cover.
sourcepub fn is_something(&self) -> bool
pub fn is_something(&self) -> bool
sourcepub fn is_nothing(&self) -> bool
pub fn is_nothing(&self) -> bool
True if and only if there is no point for which bb.contains(point) is true.
The opposite of is_something().
sourcepub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
Returns true if, and only if, all elements are finite.
If any element is either NaN, positive or negative infinity, this will return false.
sourcepub fn bounding_sphere_radius(&self) -> f32
pub fn bounding_sphere_radius(&self) -> f32
The minimum radius of a sphere, centered at the origin, fully containing the box.
Requires a well-formed box for the result to be valid.
sourcepub fn centered_bounding_sphere_radius(&self) -> f32
pub fn centered_bounding_sphere_radius(&self) -> f32
The minimum radius of a sphere, centered at the bounding box, fully containing the box.
Requires a well-formed box for the result to be valid.
pub fn union(self, other: BoundingBox) -> BoundingBox
sourcepub fn intersection(self, other: BoundingBox) -> BoundingBox
pub fn intersection(self, other: BoundingBox) -> BoundingBox
Returns the smallest volume that is covered by both self and other,
or Self::nothing if the boxes are disjoint.
sourcepub fn contains(&self, point: Vec3) -> bool
pub fn contains(&self, point: Vec3) -> bool
Returns true if the point is within (or on the edge of) the box.
sourcepub fn expanded(&self, padding: Vec3) -> BoundingBox
pub fn expanded(&self, padding: Vec3) -> BoundingBox
Expand with this much padding on each side.
sourcepub fn translated(&self, translation: Vec3) -> BoundingBox
pub fn translated(&self, translation: Vec3) -> BoundingBox
Translate (move) the box by this much.
sourcepub fn rotated_around_origin(&self, q: &Quat) -> BoundingBox
pub fn rotated_around_origin(&self, q: &Quat) -> BoundingBox
Return a bounding box that contains this box after it has been rotated around Vec3::ZERO.
Note that the rotated bounding box is very likely larger than the original, since it must be large enough to contain the now rotated box.
sourcepub fn transform_iso(&self, m: &IsoTransform) -> BoundingBox
pub fn transform_iso(&self, m: &IsoTransform) -> BoundingBox
Return a bounding box that contains this box after it has been transformed.
Note that the rotated bounding box is very likely larger than the original, since it must be large enough to contain the now rotated box.
sourcepub fn transform_affine3(&self, m: &Affine3A) -> BoundingBox
pub fn transform_affine3(&self, m: &Affine3A) -> BoundingBox
Return a bounding box that contains this box after it has been transformed.
Note that the rotated bounding box is very likely larger than the original, since it must be large enough to contain the now rotated box.
sourcepub fn transform_conformal3(&self, m: &Conformal3) -> BoundingBox
pub fn transform_conformal3(&self, m: &Conformal3) -> BoundingBox
Return a bounding box that contains this box after it has been transformed.
Note that the rotated bounding box is very likely larger than the original, since it must be large enough to contain the now rotated box.
Trait Implementations
sourceimpl Clone for BoundingBox
impl Clone for BoundingBox
sourcefn clone(&self) -> BoundingBox
fn clone(&self) -> BoundingBox
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more