Struct meshx::bbox::BBox

source · []
pub struct BBox<T> { /* private fields */ }
Expand description

General purpose bounding box structure.

Implementations

Construct a bounding box containing points minb and maxb.

Examples
let min_p = [0.0; 3];
let max_p = [1.5, 0.5, 1.0];
let sample_box = BBox::<f32>::new(min_p, max_p);

assert_eq!(sample_box.min_corner(), min_p);
assert_eq!(sample_box.max_corner(), max_p);

Construct a unit bounding box from zero to one in each dimension.

Examples
let unit_box = BBox::<f32>::new(
    [0.0; 3],
    [1.0; 3]);
assert_eq!(BBox::<f32>::unit(), unit_box);

Get the size of the box in each dimension.

Examples
let unit_box = BBox::<f32>::unit();
assert_eq!(unit_box.size(), [1.0, 1.0, 1.0]);

Determine the axis of the maximum side length of the box and return both: the axis index (x => 0, y => 1, z => 2) and the length.

Examples
let min_p = [0.0; 3];
let max_p = [1.5, 0.5, 1.0];
let sample_box = BBox::<f32>::new(min_p, max_p);

assert_eq!(sample_box.max_axis(), (0, 1.5));

Diameter of the bounding box is the distance between the min and max corners.

Trait Implementations

Absorb another object. For example if a = [-1, 2] and b = [3, 4] is are closed intervals, then a.absorb(b) == [-1 4]. Read more

Absorb another object. For example if a = [-1, 2] and b = [3, 4] is are closed intervals, then a.absorb(b) == [-1 4]. Read more

Compute the centroid of the object.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Check if this object contains another.

Formats the value using the given formatter. Read more

Construct an empty object.

Check if this object is empty.

Intersect on one object with another, producing the resulting intersection. For example if [-1, 2] and [0, 4] are two closed intervals, then their intersection is a closed interval [0, 2]. Note that the intersection object can be of a different type Read more

Check if this object intersects another.

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

This method tests for !=.

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

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Return a value at the given index. This is provided as the checked version of get that will panic if the equivalent get call is None, which typically means that the given index is out of bounds. Read more

Return a value at the given index. Read more

Calls U::from(self).

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

Unchecked version of isolate. Read more

Return a value at the given index. This is provided as the checked version of try_isolate that will panic if the equivalent try_isolate call is None, which typically means that the given index is out of bounds. Read more

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

This method tells this type how it can be pushed to a Vec as an array.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

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.