Skip to main content

BoundingVolume

Trait BoundingVolume 

Source
pub trait BoundingVolume {
    // Required methods
    fn center(&self) -> Vec2;
    fn intersects(&self, _: &Self) -> bool;
    fn contains(&self, _: &Self) -> bool;
    fn merge(&mut self, _: &Self);
    fn merged(&self, _: &Self) -> Self;
    fn loosen(&mut self, _: f32);
    fn loosened(&self, _: f32) -> Self;
    fn tighten(&mut self, _: f32);
    fn tightened(&self, _: f32) -> Self;
}
Expand description

Trait of bounding volumes.

Bounding volumes are coarse approximations of shapes. It usually have constant time intersection, inclusion test. Two bounding volume must also be mergeable into a bigger bounding volume.

Required Methods§

Source

fn center(&self) -> Vec2

Returns a point inside of this bounding volume. This is ideally its center.

Source

fn intersects(&self, _: &Self) -> bool

Checks if this bounding volume intersect with another one.

Source

fn contains(&self, _: &Self) -> bool

Checks if this bounding volume contains another one.

Source

fn merge(&mut self, _: &Self)

Merges this bounding volume with another one. The merge is done in-place.

Due to floating-point rounding, the merged volume is not guaranteed to strictly contain both input volumes. Use loosened with a small margin if strict containment is required.

Source

fn merged(&self, _: &Self) -> Self

Merges this bounding volume with another one.

Due to floating-point rounding, the merged volume is not guaranteed to strictly contain both input volumes. Use loosened with a small margin if strict containment is required.

Source

fn loosen(&mut self, _: f32)

Enlarges this bounding volume.

Source

fn loosened(&self, _: f32) -> Self

Creates a new, enlarged version, of this bounding volume.

Source

fn tighten(&mut self, _: f32)

Tighten this bounding volume.

Source

fn tightened(&self, _: f32) -> Self

Creates a new, tightened version, of this bounding volume.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§