An edge, consisting of two vertices "v0" and "v1". Zero-length edges are allowed, and can be used to represent points.
A range of edge ids corresponding to a chain of zero or more connected edges, specified as a (start, length) pair. The chain is defined to consist of edge ids {start, start + 1, ..., start + length - 1}.
The position of an edge within a given edge chain, specified as a (chain_id, offset) pair. Chains are numbered sequentially starting from zero, and offsets are measured from the start of each chain.
A ReferencePoint consists of a point P and a boolean indicating whether P is contained by a particular shape.
Returns the number of edges in this shape. Edges have ids ranging from 0 to num_edges() - 1.
Returns the endpoints of the given edge id.
Returns the dimension of the geometry represented by this shape.
Convenience function that returns true if this shape has an interior.
Returns an arbitrary point P along with a boolean indicating whether P is contained by the shape. (The boolean value must be false for shapes that do not have an interior.)
Returns the number of contiguous edge chains in the shape. For example, a shape whose edges are [AB, BC, CD, AE, EF] would consist of two chains (AB,BC,CD and AE,EF). Every chain is assigned a "chain id" numbered sequentially starting from zero.
Returns the range of edge ids corresponding to the given edge chain. The edge chains must form contiguous, non-overlapping ranges that cover the entire range of edge ids. This is spelled out more formally below:
Returns the edge at offset "offset" within edge chain "chain_id". Equivalent to "shape.edge(shape.chain(chain_id).start + offset)" but may be more efficient.
Finds the chain containing the given edge, and returns the position of that edge as a (chain_id, offset) pair.
A unique id assigned to this shape by S2ShapeIndex. Shape ids are assigned sequentially starting from 0 in the order shapes are added.
Virtual methods that return pointers of your choice.
Assigned by MutableS2ShapeIndex when the shape is added.
S2EdgeVectorShape is an S2Shape representing an arbitrary set of edges. It is mainly used for testing, but it can also be useful if you have, say, a collection of polylines and don't care about memory efficiency (since this class would store most of the vertices twice).
Note that if you already have data stored in an S2Loop, S2Polyline, or S2Polygon, then you would be better off using the "Shape" class defined within those classes (e.g., S2Loop::Shape). Similarly, if the vertex data is stored in your own data structures, you can easily write your own subclass of S2Shape that points to the existing vertex data rather than copying it.