s2.s2edge_crossings

Undocumented in source.

Members

Enums

IntersectionMethod
enum IntersectionMethod
Undocumented in source.

Functions

crossingSign
int crossingSign(S2Point a, S2Point b, S2Point c, S2Point d)

This function determines whether the edge AB intersects the edge CD. Returns +1 if AB crosses CD at a point that is interior to both edges. Returns 0 if any two vertices from different edges are the same. Returns -1 otherwise.

edgeOrVertexCrossing
bool edgeOrVertexCrossing(S2Point a, S2Point b, S2Point c, S2Point d)

A convenience function that calls CrossingSign() to handle cases where all four vertices are distinct, and VertexCrossing() to handle cases where two or more vertices are the same. This defines a crossing function such that point-in-polygon containment tests can be implemented by simply counting edge crossings.

getIntersection
S2Point getIntersection(S2Point a0, S2Point a1, S2Point b0, S2Point b1)

Given two edges AB and CD such that CrossingSign(A, B, C, D) > 0, returns their intersection point. Useful properties of GetIntersection (GI):

getIntersectionExact
S2Point getIntersectionExact(S2Point a0, S2Point a1, S2Point b0, S2Point b1)
Undocumented in source.
vertexCrossing
bool vertexCrossing(S2Point a, S2Point b, S2Point c, S2Point d)

Given two edges AB and CD where at least two vertices are identical (i.e. CrossingSign(a,b,c,d) == 0), this function defines whether the two edges "cross" in a such a way that point-in-polygon containment tests can be implemented by counting the number of edge crossings. The basic rule is that a "crossing" occurs if AB is encountered after CD during a CCW sweep around the shared vertex starting from a fixed reference point.

Static functions

getIntersectionStableR
bool getIntersectionStableR(S2Point a0, S2Point a1, S2Point b0, S2Point b1, S2Point result)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

INTERSECTION_ERROR
S1Angle INTERSECTION_ERROR;

INTERSECTION_ERROR is an upper bound on the distance from the intersection point returned by GetIntersection() to the true intersection point.

INTERSECTION_MERGE_RADIUS
S1Angle INTERSECTION_MERGE_RADIUS;

This value can be used as the S2Builder snap_radius() to ensure that edges that have been displaced by up to INTERSECTION_ERROR are merged back together again. For example this can happen when geometry is intersected with a set of tiles and then unioned. It is equal to twice the intersection error because input edges might have been displaced in opposite directions.

intersectionMethodTally
int[IntersectionMethod]* intersectionMethodTally;
Undocumented in source.

Meta