S2LaxLoopShape

S2LaxLoopShape represents a closed loop of edges surrounding an interior region. It is similar to S2Loop::Shape except that this class allows duplicate vertices and edges. Loops may have any number of vertices, including 0, 1, or 2. (A one-vertex loop defines a degenerate edge consisting of a single point.)

Note that S2LaxLoopShape is faster to initialize and more compact than S2Loop::Shape, but does not support the same operations as S2Loop.

Constructors

this
this()

Constructs an empty loop.

this
this(S2Point[] vertices)

Constructs an S2LaxLoopShape with the given vertices.

this
this(S2Loop loop)

Constructs an S2LaxLoopShape from the given S2Loop, by copying its data.

Members

Functions

chain
Chain chain(int i)
Undocumented in source. Be warned that the author may not have intended to support it.
chainEdge
Edge chainEdge(int i, int j)
Undocumented in source.
chainPosition
ChainPosition chainPosition(int e)
Undocumented in source. Be warned that the author may not have intended to support it.
dimension
int dimension()

Not final; overridden by S2LaxClosedPolylineShape.

edge
Edge edge(int e0)
Undocumented in source.
getReferencePoint
ReferencePoint getReferencePoint()

Not final; overridden by S2LaxClosedPolylineShape.

initialize
void initialize(S2Point[] vertices)

Initializes an S2LaxLoopShape with the given vertices.

initialize
void initialize(S2Loop loop)

Initializes an S2LaxLoopShape from the given S2Loop, by copying its data.

numChains
int numChains()
Undocumented in source. Be warned that the author may not have intended to support it.
numEdges
int numEdges()

S2Shape interface:

numVertices
int numVertices()
Undocumented in source. Be warned that the author may not have intended to support it.
vertex
const(S2Point) vertex(int i)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From S2Shape

Edge
struct Edge

An edge, consisting of two vertices "v0" and "v1". Zero-length edges are allowed, and can be used to represent points.

Chain
struct Chain

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

ChainPosition
struct ChainPosition

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.

ReferencePoint
struct ReferencePoint

A ReferencePoint consists of a point P and a boolean indicating whether P is contained by a particular shape.

numEdges
int numEdges()

Returns the number of edges in this shape. Edges have ids ranging from 0 to num_edges() - 1.

edge
Edge edge(int edge_id)

Returns the endpoints of the given edge id.

dimension
int dimension()

Returns the dimension of the geometry represented by this shape.

hasInterior
bool hasInterior()

Convenience function that returns true if this shape has an interior.

getReferencePoint
ReferencePoint getReferencePoint()

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

numChains
int numChains()

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.

chain
Chain chain(int chain_id)

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:

chainEdge
Edge chainEdge(int chain_id, int offset)

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.

chainPosition
ChainPosition chainPosition(int edge_id)

Finds the chain containing the given edge, and returns the position of that edge as a (chain_id, offset) pair.

id
int id()

A unique id assigned to this shape by S2ShapeIndex. Shape ids are assigned sequentially starting from 0 in the order shapes are added.

userData
const(void*) userData()

Virtual methods that return pointers of your choice.

mutableUserData
void* mutableUserData()
Undocumented in source. Be warned that the author may not have intended to support it.
_id
int _id;

Assigned by MutableS2ShapeIndex when the shape is added.

Meta