pub struct Triangle {
pub p0: TriangleVertex,
pub p1: TriangleVertex,
pub p2: TriangleVertex,
/* private fields */
}Expand description
A triangle made up of three vertices.
Fields§
§p0: TriangleVertexThe first vertex.
p1: TriangleVertexThe second vertex.
p2: TriangleVertexThe third vertex.
Implementations§
Source§impl Triangle
impl Triangle
Sourcepub fn new(p0: TriangleVertex, p1: TriangleVertex, p2: TriangleVertex) -> Self
pub fn new(p0: TriangleVertex, p1: TriangleVertex, p2: TriangleVertex) -> Self
Create a new triangle.
Sourcepub fn interpolate(&self, pos: Point) -> ColorComponents
pub fn interpolate(&self, pos: Point) -> ColorComponents
Get the interpolated colors of the point from the triangle.
Returns None if the point is not inside of the triangle.
Sourcepub fn contains_point(&self, pos: Point) -> bool
pub fn contains_point(&self, pos: Point) -> bool
Return whether the point is contained within the triangle.
Sourcepub fn bounding_box(&self) -> Rect
pub fn bounding_box(&self) -> Rect
Return the bounding box of the triangle.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Triangle
impl RefUnwindSafe for Triangle
impl Send for Triangle
impl Sync for Triangle
impl Unpin for Triangle
impl UnwindSafe for Triangle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more