Struct nannou::geom::cuboid::Cuboid
[−]
[src]
pub struct Cuboid<S = DefaultScalar> { 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.
Methods
impl<S> Cuboid<S> where
S: BaseNum,
[src]
S: BaseNum,
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]
S: Float,
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:
y | z |/ 0---x 6---7 /| /| 2---3 | | 4-|-5 |/ |/ 0---1
ⓘImportant traits for Corners<'a, S>pub fn corners_iter(&self) -> Corners<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.
ⓘImportant traits for FaceQuads<'a, S>pub fn faces_iter(&self) -> FaceQuads<S>
[src]
An iterator yielding a quad for each face on the cuboid.
ⓘImportant traits for Triangles<'a, S>pub fn triangles_iter(&self) -> Triangles<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]
S: BaseNum + Neg<Output = S>,
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: Copy> Copy for Cuboid<S>
[src]
impl<S: Clone> Clone for Cuboid<S>
[src]
fn clone(&self) -> Cuboid<S>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<S: Debug> Debug for Cuboid<S>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<S: PartialEq> PartialEq for Cuboid<S>
[src]
fn eq(&self, __arg_0: &Cuboid<S>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Cuboid<S>) -> bool
[src]
This method tests for !=
.
impl<S: PartialOrd> PartialOrd for Cuboid<S>
[src]
fn partial_cmp(&self, __arg_0: &Cuboid<S>) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Cuboid<S>) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Cuboid<S>) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Cuboid<S>) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Cuboid<S>) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more