Struct nannou::prelude::geom::Tri [−][src]
Expand description
A triangle as three vertices.
Implementations
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.
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
.
Returns true
if the given 2D vertex is contained within the 2D Tri
.
Example
let a = [-0.5, 0.0]; let b = [0.0, 1.0]; let c = [0.5, -0.75]; let tri = Tri([a, b, c]); assert!(tri.contains(&[0.0, 0.0])); assert!(!tri.contains(&[3.0, 3.0]));
The bounding Rect
of the triangle.
Methods from Deref<Target = [V; 3]>
🔬 This is a nightly-only experimental API. (array_methods
)
array_methods
)Returns a slice containing the entire array. Equivalent to &s[..]
.
🔬 This is a nightly-only experimental API. (array_methods
)
array_methods
)Borrows each element and returns an array of references with the same
size as self
.
Example
#![feature(array_methods)] let floats = [3.1, 2.7, -1.0]; let float_refs: [&f64; 3] = floats.each_ref(); assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);
This method is particularly useful if combined with other methods, like
map
. This way, you can avoid moving the original
array if its elements are not Copy
.
#![feature(array_methods, array_map)] let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()]; let is_ascii = strings.each_ref().map(|s| s.is_ascii()); assert_eq!(is_ascii, [true, false, true]); // We can still access the original array: it has not been moved. assert_eq!(strings.len(), 3);
Trait Implementations
Auto Trait Implementations
impl<V> RefUnwindSafe for Tri<V> where
V: RefUnwindSafe,
impl<V> UnwindSafe for Tri<V> where
V: UnwindSafe,
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
Mutably borrows from an owned value. Read more
impl<T> CallHasher for T where
T: Hash,
impl<T> CallHasher for T where
T: Hash,
Convert into T with values clamped to the color defined bounds Read more
Convert into T. The resulting color might be invalid in its color space Read more
Convert into T, returning ok if the color is inside of its defined range,
otherwise an OutOfBounds
error is returned which contains the unclamped color. Read more
Compare self to key
and return true
if they are equal.
pub fn vzip(self) -> V