logo
pub struct BoundingBox {
    pub min: Vec3,
    pub max: Vec3,
}
Expand description

A 3-dimensional axis-aligned bounding box

Fields

min: Vec3

Bounding box minimum (inclusive).

max: Vec3

Bounding box maximum (inclusive).

Implementations

A BoundingBox that only contains Vec3::ZERO.

A BoundingBox that contains no points.

This is useful as the seed for bounding bounding boxes.

A BoundingBox that contains every point.

Create a bounding box from a minimum and maximum position.

Create a bounding box from a center position and a size.

Create a bounding box from an iterator of points that the bounding box will cover.

Returns the center point of the bounding box.

Returns the 3D axis size of the bounding box.

Returns half the size (similar to a radius).

Only correct for positively sized boxes.

True if and only if there is at least one point for which bb.contains(point) is true.

Will return true if Self::min == Self::max. The opposite of is_nothing().

True if and only if there is no point for which bb.contains(point) is true.

The opposite of is_something().

True if this box contains exactly one point.

true if Self::min == Self::max.

Returns true if, and only if, all elements are finite.

If any element is either NaN, positive or negative infinity, this will return false.

Returns true if any elements are NaN.

The eight corners of this bounding box.

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.

The twelve edges of this bounding box.

Enlarge the box to include this point.

Returns the smallest volume that is covered by both self and other, or Self::nothing if the boxes are disjoint.

Returns true if the point is within (or on the edge of) the box.

Expand with this much padding on each side.

Translate (move) the box by this much.

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.

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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.