intersectChains method

void intersectChains()

Implementation

void intersectChains() {
  MonotoneChainOverlapAction overlapAction =
      new SegmentOverlapAction(segInt!);

  for (MonotoneChainI queryChain in monoChains) {
    List overlapChains = index.query(queryChain.getEnvelope());
    for (MonotoneChainI testChain in overlapChains) {
      /**
       * following test makes sure we only compare each pair of chains once
       * and that we don't compare a chain to itself
       */
      if (testChain.getId() > queryChain.getId()) {
        queryChain.computeOverlaps3(testChain, overlapAction);
        nOverlaps++;
      }
      // short-circuit if possible
      if (segInt!.isDone()) return;
    }
  }
}