pub enum BoundingBox {
    Empty,
    Box {
        min: Vec3,
        max: Vec3,
    },
}
Expand description

A bounding box.

Variants§

§

Empty

The bounding box has no points in it.

§

Box

Fields

§min: Vec3

The minimum bounds of the bounding box.

§max: Vec3

The maximum bounds of the bounding box. Must be component-wise greather than or equal to min.

The bounding box has some points in it.

Implementations§

source§

impl BoundingBox

source

pub fn new_box(min: Vec3, max: Vec3) -> Self

Creates a box already with some data in it. min and max must already be valid - this is unchecked.

source

pub fn as_box(&self) -> (Vec3, Vec3)

Returns the bounds of the box, assuming it is non-empty.

source

pub fn size(&self) -> Vec3

Computes the size of the bounding box. Returns 0 if the bounds are empty.

source

pub fn is_valid(&self) -> bool

Determines if the bounding box is valid (min <= max).

source

pub fn expand_to_bounds(&self, other: &Self) -> Self

Expands the bounding box to contain the other.

source

pub fn expand_to_point(&self, point: Vec3) -> Self

Expands the bounding box to contain point. If the box was empty, it will now hold only the point.

source

pub fn expand_by_size(&self, size: Vec3) -> BoundingBox

Expands the bounding box by size. An empty bounding box will still be empty after this.

source

pub fn contains_point(&self, point: Vec3) -> bool

Determines if point is in self.

source

pub fn contains_bounds(&self, other: &Self) -> bool

Determines if other is fully contained by self.

source

pub fn intersects_bounds(&self, other: &Self) -> bool

Detemrines if other intersects self at all.

source

pub fn transform(&self, transform: Transform) -> Self

Creates a conservative bounding box around self after transforming it by transform.

Trait Implementations§

source§

impl Clone for BoundingBox

source§

fn clone(&self) -> BoundingBox

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BoundingBox

source§

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

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

impl PartialEq for BoundingBox

source§

fn eq(&self, other: &BoundingBox) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for BoundingBox

source§

impl StructuralPartialEq for BoundingBox

Auto Trait Implementations§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V