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

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

General purpose bounding box structure.

Implementations

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<'a, T: Float> Absorb<BBox<T>> for &'a mut BBox<T>[src]

type Output = &'a mut BBox<T>

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> Centroid<Option<[T; 3]>> for &'a BBox<T>[src]

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

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

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

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

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

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

type Output = Self

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

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

Auto Trait Implementations

impl<T> RefUnwindSafe for BBox<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for BBox<T> where
    T: Send
[src]

impl<T> Sync for BBox<T> where
    T: Sync
[src]

impl<T> Unpin for BBox<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for BBox<T> where
    T: UnwindSafe
[src]

Blanket Implementations

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

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

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

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

impl<T> CloneBytes for T where
    T: 'static + Clone
[src]

impl<T> CopyElem for T where
    T: Any + Copy
[src]

impl<T> DebugBytes for T where
    T: 'static + Debug
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> DropBytes for T where
    T: 'static, 
[src]

impl<T> Elem for T where
    T: Any + DropBytes
[src]

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

impl<'a, S, I> Get<'a, I> for S where
    I: GetIndex<'a, S>, 
[src]

type Output = <I as GetIndex<'a, S>>::Output

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

impl<S, I> Isolate<I> for S where
    I: IsolateIndex<S>, 
[src]

type Output = <I as IsolateIndex<S>>::Output

impl<T> PartialEqBytes for T where
    T: 'static + PartialEq<T>, 
[src]

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

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, N> PushArrayToVec<N> for T where
    T: Clone,
    N: Array<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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 = Infallible

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.