Enum S2Builder.EdgeType

Indicates whether the input edges are undirected. Typically this is specified for each output layer (e.g., s2builderutil::S2PolygonLayer).

enum EdgeType : int { ... }

Directed edges are preferred, since otherwise the output is ambiguous. For example, output polygons may be the *inverse* of the intended result (e.g., a polygon intended to represent the world's oceans may instead represent the world's land masses). Directed edges are also somewhat more efficient.

However even with undirected edges, most S2Builder layer types try to preserve the input edge direction whenever possible. Generally, edges are reversed only when it would yield a simpler output. For example, S2PolygonLayer assumes that polygons created from undirected edges should cover at most half of the sphere. Similarly, S2PolylineVectorLayer assembles edges into as few polylines as possible, even if this means reversing some of the "undirected" input edges.

For shapes with interiors, directed edges should be oriented so that the interior is to the left of all edges. This means that for a polygon with holes, the outer loops ("shells") should be directed counter-clockwise while the inner loops ("holes") should be directed clockwise. Note that

Enum members

NameDescription

S2Builder

:AddPolygon() follows this convention automatically.