pub struct Triangle3 {
pub a: Point3,
pub b: Point3,
pub c: Point3,
}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: Point3First corner.
b: Point3Second corner.
c: Point3Third corner.
Implementations§
Source§impl Triangle3
impl Triangle3
Sourcepub const fn new(a: Point3, b: Point3, c: Point3) -> Self
pub const fn new(a: Point3, b: Point3, c: Point3) -> Self
Construct a triangle without validating it.
Sourcepub fn normal(&self) -> Vec3
pub fn normal(&self) -> Vec3
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