Updating comments in BasePolygonBuilder to explain "pairwise" intersection

This commit is contained in:
Nicholas Knize 2014-11-24 07:36:20 -06:00
parent 82f5252c14
commit 08bbfac7eb
1 changed files with 9 additions and 1 deletions

View File

@ -395,7 +395,15 @@ public abstract class BasePolygonBuilder<E extends BasePolygonBuilder<E>> extend
holes[e2.component-1] = holes[numHoles]; holes[e2.component-1] = holes[numHoles];
holes[numHoles] = null; holes[numHoles] = null;
} }
// only connect edges if intersections are pairwise (per comment above) // only connect edges if intersections are pairwise
// per the comment above, the edge array is sorted by y-value of the intersection
// with the dateline. Two edges have the same y intercept when they cross the
// dateline thus they appear sequentially (pairwise) in the edge array. Two edges
// do not have the same y intercept when we're forming a multi-poly from a poly
// that wraps the dateline (but there are 2 ordered intercepts).
// The connect method creates a new edge for these paired edges in the linked list.
// For boundary conditions (e.g., intersect but not crossing) there is no sibling edge
// to connect. Thus the following enforces the pairwise rule
if (e1.intersect != Edge.MAX_COORDINATE && e2.intersect != Edge.MAX_COORDINATE) { if (e1.intersect != Edge.MAX_COORDINATE && e2.intersect != Edge.MAX_COORDINATE) {
connect(e1, e2); connect(e1, e2);
} }