[][src]Struct gut::bbox::BBox

pub struct BBox<T> { /* fields omitted */ }

General purpose bounding box structure.

Methods

impl<T: Float> BBox<T>[src]

pub fn new(minb: [T; 3], maxb: [T; 3]) -> Self[src]

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);

pub fn unit() -> BBox<T>[src]

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);

pub fn size(&self) -> [T; 3][src]

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]);

pub fn max_axis(&self) -> (u8, T)[src]

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));

pub fn min_corner(&self) -> [T; 3][src]

pub fn max_corner(&self) -> [T; 3][src]

pub fn diameter(&self) -> T where
    T: BaseFloat
[src]

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

pub fn corner<C: Copy + Into<Corner>>(&self, which: C) -> [T; 3][src]

Trait Implementations

impl<T: Float> Empty for BBox<T>[src]

impl<T: PartialOrd + Copy> Contains<[T; 3]> for BBox<T>[src]

impl<'a, T: Float, P> Absorb<P> for &'a mut BBox<T> where
    P: Into<[T; 3]>, 
[src]

type Output = &'a mut BBox<T>

impl<'a, T: Float> Absorb<BBox<T>> for &'a mut BBox<T>[src]

type Output = &'a mut BBox<T>

impl<T: Float> Intersect<BBox<T>> for BBox<T>[src]

type Output = Self

impl<'a, T: Float> Centroid<Option<[T; 3]>> for &'a BBox<T>[src]

impl<T: Clone> Clone for BBox<T>[src]

impl<T: Copy> Copy for BBox<T>[src]

impl<T: PartialEq> PartialEq<BBox<T>> for BBox<T>[src]

impl<T: Debug> Debug for BBox<T>[src]

impl<T> StructuralPartialEq for BBox<T>[src]

Auto Trait Implementations

impl<T> Send for BBox<T> where
    T: Send

impl<T> Sync for BBox<T> where
    T: Sync

impl<T> Unpin for BBox<T> where
    T: Unpin

impl<T> UnwindSafe for BBox<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for BBox<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Bytes for T[src]

impl<T> Pod for T where
    T: 'static + Copy + Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]