add method

EdgeIntersection add(
  1. Coordinate intPt,
  2. int segmentIndex,
  3. double dist
)

Adds an intersection into the list, if it isn't already there. The input segmentIndex and dist are expected to be normalized. @return the EdgeIntersection found or added

Implementation

EdgeIntersection add(Coordinate intPt, int segmentIndex, double dist) {
  EdgeIntersection eiNew = new EdgeIntersection(intPt, segmentIndex, dist);
  EdgeIntersection? ei = nodeMap[eiNew];
  if (ei != null) {
    return ei;
  }
  nodeMap[eiNew] = eiNew;
  return eiNew;
}