overlaps method

bool overlaps(
  1. int start0,
  2. int end0,
  3. MonotoneChainI mc,
  4. int start1,
  5. int end1,
)

Tests whether the envelope of a section of the chain overlaps (intersects) the envelope of a section of another target chain. This test is efficient due to the monotonicity property of the sections (i.e. the envelopes can be are determined from the section endpoints rather than a full scan).

@param start0 the start index of this chain section @param end0 the end index of this chain section @param mc the target monotone chain @param start1 the start index of the target chain section @param end1 the end index of the target chain section @return true if the section envelopes overlap

Implementation

bool overlaps(int start0, int end0, MonotoneChainI mc, int start1, int end1) {
  return Envelope.intersectsEnvelopeCoords(
      pts[start0], pts[end0], mc.pts[start1], mc.pts[end1]);
}