pub struct Triangle3 {
pub a: DVec3,
pub b: DVec3,
pub c: DVec3,
}Expand description
A three-dimensional triangle.
Corner order defines the winding, and therefore the sign of normal. A
degenerate triangle – collinear or coincident corners – is representable
on purpose: whether that is an error depends on the caller’s tolerance, so
the decision belongs to the algorithm consuming it.
Fields§
§a: DVec3First corner.
b: DVec3Second corner.
c: DVec3Third corner.
Implementations§
Source§impl Triangle3
impl Triangle3
Sourcepub const fn new(a: DVec3, b: DVec3, c: DVec3) -> Triangle3
pub const fn new(a: DVec3, b: DVec3, c: DVec3) -> Triangle3
Construct a triangle without validating it.
Sourcepub fn normal(&self) -> DVec3
pub fn normal(&self) -> DVec3
Unnormalized right-handed normal.
Left unnormalized because its magnitude is twice the triangle area, so callers that need area get it without a second cross product, and callers that need a direction normalize explicitly against their own tolerance. A degenerate triangle yields a zero vector rather than a NaN-bearing unit vector.
Trait Implementations§
impl Copy for Triangle3
impl StructuralPartialEq for Triangle3
Auto Trait Implementations§
impl Freeze for Triangle3
impl RefUnwindSafe for Triangle3
impl Send for Triangle3
impl Sync for Triangle3
impl Unpin for Triangle3
impl UnwindSafe for Triangle3
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