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.
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.