[][src]Struct nannou::geom::cuboid::Cuboid

pub struct Cuboid<S = Default> {
    pub x: Range<S>,
    pub y: Range<S>,
    pub z: Range<S>,
}

A light-weight Cuboid type with many helper and utility methods.

The cuboid is also known as a "rectangular prism".

Cuboid is implemented similarly to geom::Rect but with 3 axes instead of 2.

Fields

x: Range<S>

The start and end along the x axis.

y: Range<S>

The start and end along the y axis.

z: Range<S>

The start and end along the z axis.

Implementations

impl<S> Cuboid<S> where
    S: BaseNum
[src]

pub fn from_xyz_whd(p: Point3<S>, d: Vector3<S>) -> Self[src]

Construct a Rect from a given centre point (x, y, z) and dimensions (width, height, depth).

pub fn from_ranges(x: Range<S>, y: Range<S>, z: Range<S>) -> Self[src]

Construct a cuboid from its x, y and z ranges.

pub fn absolute(&self) -> Self[src]

Converts self to an absolute Cuboid so that the magnitude of each range is always positive.

pub fn x(&self) -> S[src]

The position in the middle of the x range.

pub fn y(&self) -> S[src]

The position in the middle of the y range.

pub fn z(&self) -> S[src]

The position in the middle of the z range.

pub fn xyz(&self) -> Point3<S>[src]

The xyz position in the middle of the bounds.

pub fn x_y_z(&self) -> (S, S, S)[src]

The centered x, y and z coordinates as a tuple.

pub fn shift_x(self, x: S) -> Self[src]

Shift the cuboid along the x axis.

pub fn shift_y(self, y: S) -> Self[src]

Shift the cuboid along the y axis.

pub fn shift_z(self, z: S) -> Self[src]

Shift the cuboid along the z axis.

pub fn shift(self, v: Vector3<S>) -> Self[src]

Shift the cuboid by the given vector.

pub fn contains(&self, p: Point3<S>) -> bool[src]

Does the given cuboid contain the given point.

pub fn stretch_to_point(self, p: Point3<S>) -> Self[src]

Stretches the closest side(s) to the given point if the point lies outside of the Cuboid area.

pub fn overlap(self, other: Self) -> Option<Self>[src]

The cuboid representing the area in which two cuboids overlap.

pub fn max(self, other: Self) -> Self where
    S: Float
[src]

The cuboid that encompass the two given cuboids.

pub fn left(&self) -> S[src]

The start of the range along the x axis.

pub fn right(&self) -> S[src]

The end of the range along the x axis.

pub fn bottom(&self) -> S[src]

The start of the range along the y axis.

pub fn top(&self) -> S[src]

The end of the range along the y axis.

pub fn front(&self) -> S[src]

The start of the range along the z axis.

pub fn back(&self) -> S[src]

The end of the range along the z axis.

pub fn left_quad(&self) -> FaceQuad<S>[src]

The quad for the face at the start of the range along the x axis.

pub fn right_quad(&self) -> FaceQuad<S>[src]

The quad for the face at the end of the range along the x axis.

pub fn bottom_quad(&self) -> FaceQuad<S>[src]

The quad for the face at the start of the range along the y axis.

pub fn top_quad(&self) -> FaceQuad<S>[src]

The quad for the face at the end of the range along the y axis.

pub fn front_quad(&self) -> FaceQuad<S>[src]

The quad for the face at the start of the range along the z axis.

pub fn back_quad(&self) -> FaceQuad<S>[src]

The quad for the face at the end of the range along the z axis.

pub fn face_quad(&self, face: Face) -> FaceQuad<S>[src]

The quad for the given face.

pub fn corners(&self) -> [Point3<S>; 8][src]

The 8 corners of the cuboid in the following order:

This example is not tested
y
| z
|/
0---x

  6---7
 /|  /|
2---3 |
| 4-|-5
|/  |/
0---1

pub fn corners_iter(&self) -> Corners<'_, S>

Notable traits for Corners<'a, S>

impl<'a, S> Iterator for Corners<'a, S> where
    S: Copy
type Item = Point3<S>;
[src]

The same as corners but produces an iterator rather than a fixed-size array.

pub fn faces(&self) -> [FaceQuad<S>; 6][src]

The 6 faces of the of the cuboid in the order yielded by the Faces iterator.

pub fn faces_iter(&self) -> FaceQuads<'_, S>

Notable traits for FaceQuads<'a, S>

impl<'a, S> Iterator for FaceQuads<'a, S> where
    S: BaseNum
type Item = FaceQuad<S>;
[src]

An iterator yielding a quad for each face on the cuboid.

pub fn triangles_iter(&self) -> Triangles<'_, S>

Notable traits for Triangles<'a, S>

impl<'a, S> Iterator for Triangles<'a, S> where
    S: BaseNum
type Item = Tri<Point3<S>>;
[src]

Produce an iterator yielding every triangle in the cuboid (two for each face).

Uses the faces_iter method internally.

pub fn subdivision_ranges(&self) -> SubdivisionRanges<S>[src]

The six ranges used for the Cuboid's eight subdivisions.

impl<S> Cuboid<S> where
    S: BaseNum + Neg<Output = S>, 
[src]

pub fn w(&self) -> S[src]

The length of the cuboid along the x axis (aka width or w for short).

pub fn h(&self) -> S[src]

The length of the cuboid along the y axis (aka height or h for short).

pub fn d(&self) -> S[src]

The length of the cuboid along the z axis (aka depth or d for short).

pub fn whd(&self) -> Vector3<S>[src]

The dimensions (width, height and depth) of the cuboid as a vector.

pub fn w_h_d(&self) -> (S, S, S)[src]

The dimensions (width, height and depth) of the cuboid as a tuple.

pub fn volume(&self) -> S[src]

The total volume of the cuboid.

pub fn xyz_whd(&self) -> (Point3<S>, Vector3<S>)[src]

The position and dimensions of the cuboid.

pub fn x_y_z_w_h_d(&self) -> (S, S, S, S, S, S)[src]

The position and dimensions of the cuboid.

pub fn pad_left(self, pad: S) -> Self[src]

The cuboid with some padding applied to the left side.

pub fn pad_right(self, pad: S) -> Self[src]

The cuboid with some padding applied to the right side.

pub fn pad_bottom(self, pad: S) -> Self[src]

The cuboid with some padding applied to the bottom side.

pub fn pad_top(self, pad: S) -> Self[src]

The cuboid with some padding applied to the top side.

pub fn pad_front(self, pad: S) -> Self[src]

The cuboid with some padding applied to the front side.

pub fn pad_back(self, pad: S) -> Self[src]

The cuboid with some padding applied to the back side.

pub fn pad(self, pad: S) -> Self[src]

The cuboid with some padding amount applied to each side.

Trait Implementations

impl<S: Clone> Clone for Cuboid<S>[src]

impl<S: Copy> Copy for Cuboid<S>[src]

impl<S: Debug> Debug for Cuboid<S>[src]

impl<S: PartialEq> PartialEq<Cuboid<S>> for Cuboid<S>[src]

impl<S: PartialOrd> PartialOrd<Cuboid<S>> for Cuboid<S>[src]

impl<S> StructuralPartialEq for Cuboid<S>[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for Cuboid<S> where
    S: RefUnwindSafe

impl<S> Send for Cuboid<S> where
    S: Send

impl<S> Sync for Cuboid<S> where
    S: Sync

impl<S> Unpin for Cuboid<S> where
    S: Unpin

impl<S> UnwindSafe for Cuboid<S> where
    S: UnwindSafe

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

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

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

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

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

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

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

impl<T> SetParameter for T

impl<T> Style for T where
    T: Any + Debug + PartialEq<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 = 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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,