Struct nannou::geom::tri::Tri [−][src]
A triangle as three vertices.
Methods
impl<V> Tri<V> where
V: Vertex,
[src]
impl<V> Tri<V> where
V: Vertex,
pub fn from_index_tri(vertices: &[V], indices: &[usize; 3]) -> Self where
V: Vertex,
[src]
pub fn from_index_tri(vertices: &[V], indices: &[usize; 3]) -> Self where
V: Vertex,
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.
pub fn from_vertices<I>(vertices: I) -> Option<Self> where
I: IntoIterator<Item = V>,
[src]
pub fn from_vertices<I>(vertices: I) -> Option<Self> where
I: IntoIterator<Item = V>,
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>pub fn vertices(self) -> Vertices<V>
[src]
pub fn vertices(self) -> Vertices<V>
Produce an iterator yielding each of the vertices of the triangle.
pub fn centroid(self) -> V where
V: EuclideanSpace,
[src]
pub fn centroid(self) -> V where
V: EuclideanSpace,
Produce the centroid of the triangle aka the "mean"/"average" of all the points.
pub fn map_vertices<F, V2>(self, map: F) -> Tri<V2> where
F: FnMut(V) -> V2,
[src]
pub fn map_vertices<F, V2>(self, map: F) -> Tri<V2> where
F: FnMut(V) -> V2,
Maps the underlying vertices to a new type and returns the resulting Tri
.
impl<V> Tri<V> where
V: Vertex2d,
[src]
impl<V> Tri<V> where
V: Vertex2d,
pub fn contains(&self, v: &V) -> bool where
V: Vertex2d,
[src]
pub fn contains(&self, v: &V) -> bool where
V: Vertex2d,
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 }));
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 triangle.
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.
Trait Implementations
impl<S> From<Tri<Point3<S>>> for Tri<S> where
S: BaseFloat,
[src]
impl<S> From<Tri<Point3<S>>> for Tri<S> where
S: BaseFloat,
impl<V: Copy> Copy for Tri<V>
[src]
impl<V: Copy> Copy for Tri<V>
impl<V: Clone> Clone for Tri<V>
[src]
impl<V: Clone> Clone for Tri<V>
fn clone(&self) -> Tri<V>
[src]
fn clone(&self) -> Tri<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 Tri<V>
[src]
impl<V: Debug> Debug for Tri<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 Tri<V>
[src]
impl<V: Eq> Eq for Tri<V>
impl<V: Hash> Hash for Tri<V>
[src]
impl<V: Hash> Hash for Tri<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 Tri<V>
[src]
impl<V: PartialEq> PartialEq for Tri<V>
fn eq(&self, other: &Tri<V>) -> bool
[src]
fn eq(&self, other: &Tri<V>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Tri<V>) -> bool
[src]
fn ne(&self, other: &Tri<V>) -> bool
This method tests for !=
.
impl<V> Deref for Tri<V> where
V: Vertex,
[src]
impl<V> Deref for Tri<V> where
V: Vertex,
type Target = [V; 3]
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl<V> From<[V; 3]> for Tri<V> where
V: Vertex,
[src]
impl<V> From<[V; 3]> for Tri<V> where
V: Vertex,
impl<V> From<(V, V, V)> for Tri<V> where
V: Vertex,
[src]
impl<V> From<(V, V, V)> for Tri<V> where
V: Vertex,
impl<V> Into<[V; 3]> for Tri<V> where
V: Vertex,
[src]
impl<V> Into<[V; 3]> for Tri<V> where
V: Vertex,
impl<V> Into<(V, V, V)> for Tri<V> where
V: Vertex,
[src]
impl<V> Into<(V, V, V)> for Tri<V> where
V: Vertex,
impl<V> AsRef<Tri<V>> for Tri<V> where
V: Vertex,
[src]
impl<V> AsRef<Tri<V>> for Tri<V> where
V: Vertex,
impl<V> AsRef<[V; 3]> for Tri<V> where
V: Vertex,
[src]
impl<V> AsRef<[V; 3]> for Tri<V> where
V: Vertex,