pub struct Aabb<T> {
    pub min: Vec3<T>,
    pub max: Vec3<T>,
}
Expand description

Axis-aligned Bounding Box (3D), represented by min and max points.

N.B: You are responsible for ensuring that all respective elements of min are indeed less than or equal to those of max. The is_valid(), make_valid() and made_valid() methods are designed to help you with this.

Fields

min: Vec3<T>

Minimum coordinates of bounds.

max: Vec3<T>

Maximum coordinates of bounds.

Implementations

Is this bounding shape valid ? True only if all elements of self.min are less than or equal to those of self.max.

Makes this bounding shape valid by swapping elements of self.min with self.max as needed.

Returns this bounding shape made valid by swapping elements of self.min with self.max as needed.

Creates a new bounding shape from a single point.

Converts this bounding shape to the matching rectangle representation.

Gets this bounding shape’s center.

Gets this bounding shape’s total size.

Gets this bounding shape’s half size.

Gets the smallest bounding shape that contains both this one and another.

Gets the largest bounding shape contained by both this one and another.

Sets this bounding shape to the union of itself with another.

Sets this bounding shape to the intersection of itself with another.

Gets a copy of this shape so that it contains the given point.

Expands this shape so that it contains the given point.

Does this bounding shape contain the given point ?

Does this bounding shape fully contain another ?

Does this bounding shape collide with another ?

Gets a vector that tells how much self penetrates other.

Project the given point into the bounding shape (equivalent to ‘snapping’ the point to the closest point in the bounding shape).

Get the smallest distance between the bounding shape and a point.

Splits this shape in two, by a straight plane along the x axis. The returned tuple is (low, high).

Panics

sp is assumed to be a position along the x axis that is within this shape’s bounds.

Splits this shape in two, by a straight plane along the y axis. The returned tuple is (low, high).

Panics

sp is assumed to be a position along the y axis that is within this shape’s bounds.

Splits this shape in two, by a straight plane along the z axis. The returned tuple is (low, high).

Panics

sp is assumed to be a position along the z axis that is within this shape’s bounds.

Returns this bounding shape, converted element-wise using the given closure.

Converts this rectangle to a rectangle of another type, using the as conversion.

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

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

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

This method tests for !=.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.