isWithinDistanceGeometry method

bool isWithinDistanceGeometry(
  1. Geometry g,
  2. double maxDistance
)

Tests whether the base geometry lies within a specified distance of the given geometry.

@param g the geometry to test @param maxDistance the maximum distance to test @return true if the geometry lies with the specified distance

Implementation

bool isWithinDistanceGeometry(Geometry g, double maxDistance) {
  // short-ciruit check
  double envDist =
      baseGeometry.getEnvelopeInternal().distance(g.getEnvelopeInternal());
  if (envDist > maxDistance) return false;

  STRtree tree2 = FacetSequenceTreeBuilder.build(g);
  return cachedTree!
      .isWithinDistanceWithTree(tree2, FACET_SEQ_DIST, maxDistance);
}