pub struct Polygon3 {
pub vertices: Vec<Point3>,
}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<Point3>Boundary vertices in order. The closing edge is implicit.
Implementations§
Source§impl Polygon3
impl Polygon3
Sourcepub fn vector_area2(&self) -> Vec3
pub fn vector_area2(&self) -> Vec3
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.