Struct nannou::geom::quad::Quad [−][src]
A quad represented by its four vertices.
Methods
impl<V> Quad<V> where
V: Vertex,
[src]
impl<V> Quad<V> where
V: Vertex,
ⓘImportant traits for Vertices<V>pub fn vertices(self) -> Vertices<V>
[src]
pub fn vertices(self) -> Vertices<V>
Produce an iterator yielding each vertex in the Quad
.
pub fn centroid(&self) -> V where
V: EuclideanSpace,
[src]
pub fn centroid(&self) -> V where
V: EuclideanSpace,
Produce the centroid of the quad, aka the "mean"/"average" vertex.
pub fn triangles(&self) -> (Tri<V>, Tri<V>)
[src]
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:
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>pub fn triangles_iter(&self) -> Triangles<V>
[src]
pub fn triangles_iter(&self) -> Triangles<V>
The same as triangles
but provided as an Iterator.
pub fn bounding_rect(self) -> Rect<V::Scalar> where
V: Vertex2d,
[src]
pub fn bounding_rect(self) -> Rect<V::Scalar> where
V: Vertex2d,
The bounding Rect
of the quad.
pub fn bounding_cuboid(self) -> Cuboid<V::Scalar> where
V: Vertex3d,
[src]
pub fn bounding_cuboid(self) -> Cuboid<V::Scalar> where
V: Vertex3d,
The bounding Rect
of the triangle.
pub fn map_vertices<F, V2>(self, map: F) -> Quad<V2> where
F: FnMut(V) -> V2,
[src]
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
impl<S> From<Quad<Point3<S>>> for Quad<S> where
S: BaseFloat,
[src]
impl<S> From<Quad<Point3<S>>> for Quad<S> where
S: BaseFloat,
impl<V: Copy> Copy for Quad<V>
[src]
impl<V: Copy> Copy for Quad<V>
impl<V: Clone> Clone for Quad<V>
[src]
impl<V: Clone> Clone for Quad<V>
fn clone(&self) -> Quad<V>
[src]
fn clone(&self) -> Quad<V>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<V: Debug> Debug for Quad<V>
[src]
impl<V: Debug> Debug for Quad<V>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<V: Eq> Eq for Quad<V>
[src]
impl<V: Eq> Eq for Quad<V>
impl<V: Hash> Hash for Quad<V>
[src]
impl<V: Hash> Hash for Quad<V>
fn hash<__HV: Hasher>(&self, state: &mut __HV)
[src]
fn hash<__HV: Hasher>(&self, state: &mut __HV)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<V: PartialEq> PartialEq for Quad<V>
[src]
impl<V: PartialEq> PartialEq for Quad<V>
fn eq(&self, other: &Quad<V>) -> bool
[src]
fn eq(&self, other: &Quad<V>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Quad<V>) -> bool
[src]
fn ne(&self, other: &Quad<V>) -> bool
This method tests for !=
.
impl<V> Deref for Quad<V>
[src]
impl<V> Deref for Quad<V>
type Target = [V; 4]
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl<V> From<[V; 4]> for Quad<V> where
V: Vertex,
[src]
impl<V> From<[V; 4]> for Quad<V> where
V: Vertex,
impl<V> From<(V, V, V, V)> for Quad<V> where
V: Vertex,
[src]
impl<V> From<(V, V, V, V)> for Quad<V> where
V: Vertex,
impl<V> Into<[V; 4]> for Quad<V> where
V: Vertex,
[src]
impl<V> Into<[V; 4]> for Quad<V> where
V: Vertex,
impl<V> Into<(V, V, V, V)> for Quad<V> where
V: Vertex,
[src]
impl<V> Into<(V, V, V, V)> for Quad<V> where
V: Vertex,
impl<V> AsRef<Quad<V>> for Quad<V> where
V: Vertex,
[src]
impl<V> AsRef<Quad<V>> for Quad<V> where
V: Vertex,
impl<V> AsRef<[V; 4]> for Quad<V> where
V: Vertex,
[src]
impl<V> AsRef<[V; 4]> for Quad<V> where
V: Vertex,
impl<V> Index<usize> for Quad<V> where
V: Vertex,
[src]
impl<V> Index<usize> for Quad<V> where
V: Vertex,