findPtNotNode static method

Coordinate? findPtNotNode(
  1. List<Coordinate> testCoords,
  2. LinearRing searchRing,
  3. GeometryGraph graph
)

Find a point from the list of testCoords that is NOT a node in the edge for the list of searchCoords

@return the point found, or null if none found

Implementation

static Coordinate? findPtNotNode(
    List<Coordinate> testCoords, LinearRing searchRing, GeometryGraph graph) {
  // find edge corresponding to searchRing.
  Edge searchEdge = graph.findEdgeFromLine(searchRing)!;
  // find a point in the testCoords which is not a node of the searchRing
  EdgeIntersectionList eiList = searchEdge.getEdgeIntersectionList();
  // somewhat inefficient - is there a better way? (Use a node map, for instance?)
  for (int i = 0; i < testCoords.length; i++) {
    Coordinate pt = testCoords[i];
    if (!eiList.isIntersection(pt)) return pt;
  }
  return null;
}