pub struct Triangle2 {
pub a: DVec2,
pub b: DVec2,
pub c: DVec2,
}Expand description
A two-dimensional triangle.
Corner order sets the winding, which signed_area reports: positive is
counter-clockwise. Degenerate triangles are representable.
Fields§
§a: DVec2First corner.
b: DVec2Second corner.
c: DVec2Third corner.
Implementations§
Source§impl Triangle2
impl Triangle2
Sourcepub const fn new(a: DVec2, b: DVec2, c: DVec2) -> Triangle2
pub const fn new(a: DVec2, b: DVec2, c: DVec2) -> Triangle2
Construct a triangle without validating it.
Sourcepub fn signed_area2(&self) -> f64
pub fn signed_area2(&self) -> f64
Twice the signed area: positive counter-clockwise, negative clockwise.
Returned doubled and unscaled because this is the same quantity as the
orientation determinant, so a caller testing which side of ab the
point c lies on can use it directly without a multiply that would
only add rounding.
Sourcepub fn signed_area(&self) -> f64
pub fn signed_area(&self) -> f64
Signed area: positive counter-clockwise, negative clockwise.
Trait Implementations§
impl Copy for Triangle2
impl StructuralPartialEq for Triangle2
Auto Trait Implementations§
impl Freeze for Triangle2
impl RefUnwindSafe for Triangle2
impl Send for Triangle2
impl Sync for Triangle2
impl Unpin for Triangle2
impl UnwindSafe for Triangle2
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more