Struct nannou::geom::tri::Tri[][src]

pub struct Tri<V = Default>(pub [V; 3]);

A triangle as three vertices.

Methods

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

Create a Tri by indexing into the given buffer.

Panics if any of the given indices are out of range of the given vertices slice.

Create a Tri from the next three vertices yielded by the given vertices iterator.

Returns None if there were not at least 3 vertices in the given iterator.

Important traits for Vertices<V>

Produce an iterator yielding each of the vertices of the triangle.

Produce the centroid of the triangle aka the "mean"/"average" of all the points.

Maps the underlying vertices to a new type and returns the resulting Tri.

impl<V> Tri<V> where
    V: Vertex2d
[src]

Returns true if the given 2D vertex is contained within the 2D Tri.

Example

let a = Point2 { x: -0.5, y: 0.0 };
let b = Point2 { x: 0.0, y: 1.0 };
let c = Point2 { x: 0.5, y: -0.75 };
let tri = Tri([a, b, c]);
assert!(tri.contains(&Point2 { x: 0.0, y: 0.0 }));
assert!(!tri.contains(&Point2 { x: 3.0, y: 3.0 }));

The bounding Rect of the triangle.

The bounding Rect of the triangle.

Trait Implementations

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

Performs the conversion.

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Formats the value using the given formatter. Read more

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

impl<V: Hash> Hash for Tri<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 Tri<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 Tri<V> where
    V: Vertex
[src]

The resulting type after dereferencing.

Dereferences the value.

impl<V> From<[V; 3]> for Tri<V> where
    V: Vertex
[src]

Performs the conversion.

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

Performs the conversion.

impl<V> Into<[V; 3]> for Tri<V> where
    V: Vertex
[src]

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

impl<V> AsRef<[V; 3]> for Tri<V> where
    V: Vertex
[src]

Performs the conversion.

Auto Trait Implementations

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

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