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

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

A triangle as three vertices.

Tuple Fields

0: [V; 3]

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.

The bounding Rect of the triangle.

Trait Implementations

Performs the conversion.

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Convert the source color to the destination color using the specified method Read more

Convert the source color to the destination color using the bradford method by default Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.