Struct pix_engine::shape::Tri
source · [−]#[repr(transparent)]pub struct Tri<T, const N: usize>(_);Expand description
A Triangle with three Points.
Please see the module-level documentation for examples.
Implementations
Sets the first point of the triangle.
Sets the second point of the triangle.
Sets the third point of the triangle.
Returns Triangle points as [Point<T, N>; 3].
Example
let tri = Tri::new([10, 20], [30, 10], [20, 25]);
assert_eq!(tri.as_array(), [
point!(10, 20),
point!(30, 10),
point!(20, 25),
]);Returns Triangle points as a byte slice &[Point<T, N>; 3].
Example
let tri = Tri::new([10, 20], [30, 10], [20, 25]);
assert_eq!(tri.as_bytes(), &[
point!(10, 20),
point!(30, 10),
point!(20, 25),
]);Returns Triangle points as a mutable byte slice &mut [Point<T, N>; 3].
Example
let mut tri = Tri::new([10, 20], [30, 10], [20, 25]);
for p in tri.as_bytes_mut() {
*p += 5;
}
assert_eq!(tri.as_bytes(), &[
point!(15, 25),
point!(35, 15),
point!(25, 30),
]);Returns Self with the numbers cast using as operator.
Converts Tri < T, N > to Tri < U, N >.
Returns Tri < T, N > with the nearest integers to the numbers. Round half-way cases away from 0.0.
Returns Tri < T, N >with the largest integers less than or equal to the numbers.
Trait Implementations
impl<'de, T, const N: usize> Deserialize<'de> for Tri<T, N> where
T: Serialize + DeserializeOwned,
impl<'de, T, const N: usize> Deserialize<'de> for Tri<T, N> where
T: Serialize + DeserializeOwned,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Creates a value from an iterator. Read more
Auto Trait Implementations
impl<T, const N: usize> RefUnwindSafe for Tri<T, N> where
T: RefUnwindSafe,
impl<T, const N: usize> UnwindSafe for Tri<T, N> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more