Vertex and Segment Indices

Vertices in the general polygon have indices that increase by one as you traverse each segment of the general polygon in the direction that it was originally created. Vertex 0 refers to the first vertex, vertex 1 refers to the second vertex, and so on. For existing polygons, vertices can be inserted between any two vertices, before the first vertex, or after the last vertex. Vertices may also be deleted. Insertion or deletion will cause vertex indices to change. Therefore, it is typical but not true in general, that vertex 0 is the first inserted vertex. See the following examples:

Segments also have indices. Segment N is defined as the segment between vertex N and vertex ((N+1) modulo M), where M is the number of vertices in the general polygon. The curvature of each segment is indicated by its segmentAngleSpan, which is the angle subtended by that segment between the two vertex points. A span of 0 specifies a straight line segment. A positive span for segment N specifies an arc that arcs in the direction of increasing angle when moving along the arc from vertex N to vertex N+1, while a negative span indicates an arc that arcs in the direction of decreasing angle when moving along the arc from vertex N to vertex N+1. The following are examples of segment angle spans.

A general polygon object may be open or closed. However, none of the segments or vertices in the general polygon may intersect. Operations that might cause such crossings to occur result in an appropriate throw, and leave the general polygon unaffected.