pub struct Polygon3 {
pub vertices: Vec<DVec3>,
}Expand description
A simple polygon in three-dimensional space, without holes.
The vertices are assumed coplanar and non-self-intersecting, and neither is checked here: both are tolerance-dependent judgements. The closing edge is implicit, so the last vertex joins the first and repeating it creates a zero-length edge rather than a closed ring.
Fields§
§vertices: Vec<DVec3>Boundary vertices in order. The closing edge is implicit.
Implementations§
Source§impl Polygon3
impl Polygon3
Sourcepub fn vector_area2(&self) -> DVec3
pub fn vector_area2(&self) -> DVec3
Twice the vector area, summed by the shoelace formula in three dimensions.
The direction is the polygon’s normal and the magnitude is twice its area, so this is the 3D analogue of the signed 2D shoelace sum. It is exact for a planar polygon and degrades gracefully for a slightly non-planar one, which is what imported data usually is.
Fewer than three vertices enclose nothing and yield a zero vector.
Trait Implementations§
impl StructuralPartialEq for Polygon3
Auto Trait Implementations§
impl Freeze for Polygon3
impl RefUnwindSafe for Polygon3
impl Send for Polygon3
impl Sync for Polygon3
impl Unpin for Polygon3
impl UnwindSafe for Polygon3
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
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>
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>
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