Struct nannou_core::geom::quad::Quad [−][src]
Expand description
A quad represented by its four vertices.
Tuple Fields
0: [V; 4]
Implementations
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
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:
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])));
}
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
Auto Trait Implementations
impl<V> RefUnwindSafe for Quad<V> where
V: RefUnwindSafe,
impl<V> UnwindSafe for Quad<V> where
V: UnwindSafe,
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
Mutably borrows from an owned value. Read more
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