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.
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.
Given two edges AB and CD such that CrossingSign(A, B, C, D) > 0, returns their intersection point. Useful properties of GetIntersection (GI):
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.
INTERSECTION_ERROR is an upper bound on the distance from the intersection point returned by GetIntersection() to the true intersection point.
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.