Type Alias nannou::geom::cuboid::FaceQuad

source ·
pub type FaceQuad<S> = Quad<[S; 3]>;
Expand description

A quad representing a single face of a cuboid.

Aliased Type§

struct FaceQuad<S>(pub [[S; 3]; 4]);

Fields§

§0: [[S; 3]; 4]

Implementations

source§

impl<V> Quad<V>
where V: Vertex,

source

pub fn vertices(self) -> Vertices<V>

Produce an iterator yielding each vertex in the Quad.

source

pub fn centroid(&self) -> V
where V: Average,

Produce the centroid of the quad, aka the “mean”/“average” vertex.

source

pub fn triangles(&self) -> (Tri<V>, Tri<V>)

Triangulates the given quad, represented by four points that describe its edges in either clockwise or anti-clockwise order.

Example

The following rectangle

 a        b
  --------
  |      |
  |      |
  |      |
  --------
 d        c

given as

triangles([a, b, c, d])

returns

(Tri([a, b, c]), Tri([a, c, d]))

Here’s a basic code example:

use nannou::geom::{self, pt2, Quad, Tri};

fn main() {
    let a = pt2(0.0, 1.0);
    let b = pt2(1.0, 1.0);
    let c = pt2(1.0, 0.0);
    let d = pt2(0.0, 0.0);
    let quad = Quad([a, b, c, d]);
    let triangles = geom::quad::triangles(&quad);
    assert_eq!(triangles, (Tri([a, b, c]), Tri([a, c, d])));
}
source

pub fn triangles_iter(&self) -> Triangles<V>

The same as triangles but provided as an Iterator.

source

pub fn bounding_rect(self) -> Rect<<V as Vertex>::Scalar>
where V: Vertex2d,

The bounding Rect of the quad.

source

pub fn bounding_cuboid(self) -> Cuboid<<V as Vertex>::Scalar>
where V: Vertex3d,

The bounding Rect of the triangle.

source

pub fn map_vertices<F, V2>(self, map: F) -> Quad<V2>
where F: FnMut(V) -> V2,

Map the Quad’s vertices to a new type.

Trait Implementations

source§

impl<V> Index<usize> for Quad<V>
where V: Vertex,

§

type Output = V

The returned type after indexing.
source§

fn index(&self, index: usize) -> &<Quad<V> as Index<usize>>::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<V> AsRef<[V; 4]> for Quad<V>
where V: Vertex,

source§

fn as_ref(&self) -> &[V; 4]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<V> AsRef<Quad<V>> for Quad<V>
where V: Vertex,

source§

fn as_ref(&self) -> &Quad<V>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<V> Into<(V, V, V, V)> for Quad<V>
where V: Vertex,

source§

fn into(self) -> (V, V, V, V)

Converts this type into the (usually inferred) input type.
source§

impl<V> Into<[V; 4]> for Quad<V>
where V: Vertex,

source§

fn into(self) -> [V; 4]

Converts this type into the (usually inferred) input type.
source§

impl<V> Hash for Quad<V>
where V: Hash,

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<V> Clone for Quad<V>
where V: Clone,

source§

fn clone(&self) -> Quad<V>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<V> Eq for Quad<V>
where V: Eq,

source§

impl<V> StructuralPartialEq for Quad<V>

source§

impl<V> StructuralEq for Quad<V>

source§

impl<V> Deref for Quad<V>

§

type Target = [V; 4]

The resulting type after dereferencing.
source§

fn deref(&self) -> &<Quad<V> as Deref>::Target

Dereferences the value.
source§

impl<V> Debug for Quad<V>
where V: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<V> From<[V; 4]> for Quad<V>
where V: Vertex,

source§

fn from(points: [V; 4]) -> Quad<V>

Converts to this type from the input type.
source§

impl<V> From<(V, V, V, V)> for Quad<V>
where V: Vertex,

source§

fn from(_: (V, V, V, V)) -> Quad<V>

Converts to this type from the input type.
source§

impl<V> PartialEq for Quad<V>
where V: PartialEq,

source§

fn eq(&self, other: &Quad<V>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<V> Copy for Quad<V>
where V: Copy,