Struct nannou::geom::quad::Quad[][src]

pub struct Quad<V = Default>(pub [V; 4]);

A quad represented by its four vertices.

Methods

impl<V> Quad<V> where
    V: Vertex
[src]

Important traits for Vertices<V>

Produce an iterator yielding each vertex in the Quad.

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

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

Example

The following rectangle

This example is not tested
 a        b
  --------
  |      |
  |      |
  |      |
  --------
 d        c

given as

This example is not tested
triangles([a, b, c, d])

returns

This example is not tested
(Tri([a, b, c]), Tri([a, c, d]))

Here's a basic code example:

extern crate nannou;

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

Important traits for Triangles<V>

The same as triangles but provided as an Iterator.

The bounding Rect of the quad.

The bounding Rect of the triangle.

Map the Quad's vertices to a new type.

Trait Implementations

impl<S> From<Quad<Point3<S>>> for Quad<S> where
    S: BaseFloat
[src]

Performs the conversion.

impl<V: Copy> Copy for Quad<V>
[src]

impl<V: Clone> Clone for Quad<V>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<V: Debug> Debug for Quad<V>
[src]

Formats the value using the given formatter. Read more

impl<V: Eq> Eq for Quad<V>
[src]

impl<V: Hash> Hash for Quad<V>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<V: PartialEq> PartialEq for Quad<V>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<V> Deref for Quad<V>
[src]

The resulting type after dereferencing.

Dereferences the value.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

impl<V> AsRef<Quad<V>> for Quad<V> where
    V: Vertex
[src]

Performs the conversion.

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

Performs the conversion.

impl<V> Index<usize> for Quad<V> where
    V: Vertex
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

Auto Trait Implementations

impl<V> Send for Quad<V> where
    V: Send

impl<V> Sync for Quad<V> where
    V: Sync