Polygon
Closed loop of straight edges through a cycle of vertices.
The closed sibling of Polyline: N vertices make N edges, the last edge closing back to the first vertex implicitly. Starting vertex and traversal direction are data — the rounded identity of equals distinguishes both. Counter-clockwise winding is the documented convention but is not enforced; to read the actual winding, test signedArea's sign. Convexity is not required: self-intersecting (a pentagram) and self-touching (revisiting a vertex mid-loop — a figure-eight, a slit) loops are legal; only consecutive coincident vertices are rejected at construction.
Throws
When fewer than 3 vertices are given, a vertex lies at infinity, or two consecutive vertices coincide at the SCALE quantum — including the last and first, whose implicit closing edge would collapse.
Constructors
Properties
Whether this polygon is inside-out — wound clockwise, its solid region the closed complement of the loop's bounded one.
The signed area of the loop — raw; positive when the winding is counter-clockwise, negative when clockwise.
The open Polyline over the same walk.
Functions
Polygon contains FlatPoint => Boolean
Returns whether the point lies within the polygon's solid region, boundary included.
Polygon contains RoundPoint => Boolean
Returns whether the point lies within the polygon's solid region, boundary included.
Polygon intersects Polygon => Boolean
Returns whether the two solid regions share any point — touching boundaries count.
Polygon intersects Segment => Boolean
Returns whether the segment touches the polygon's boundary or lies within its solid region.
Polygon intersects Line => Boolean
Returns whether the line reaches the polygon's solid region.
Returns the vertices rounded at the SCALE quantum — the debug-output convention of every shape.