IndexedFacetDistance

Computes the distance between the facets (segments and vertices) of two {link Geometry}s using a Branch-and-Bound algorithm. The Branch-and-Bound algorithm operates over a traversal of R-trees built on the target and the query geometries.

This approach provides the following benefits:

  • Performance is dramatically improved due to the use of the R-tree index and the pruning due to the Branch-and-Bound approach

  • The spatial index on the target geometry is cached which allow reuse in an repeated query situation.

Using this technique is usually much more performant than using the brute-force {link Geometry#distance(Geometry)} when one or both input geometries are large, or when evaluating many distance computations against a single geometry.

This class is thread-safe.

Companion
class
class Object
trait Matchable
class Any

Value members

Concrete methods

def distance(g1: Geometry, g2: Geometry): Double

Computes the distance between facets of two geometries.

Computes the distance between facets of two geometries.

For geometries with many segments or points, this can be faster than using a simple distance algorithm.

Value Params
g1

a geometry

g2

a geometry return the distance between facets of the geometries

def isWithinDistance(g1: Geometry, g2: Geometry, distance: Double): Boolean

Tests whether the facets of two geometries lie within a given distance.

Tests whether the facets of two geometries lie within a given distance.

Value Params
distance

the distance limit return true if two facets lie with the given distance

g1

a geometry

g2

a geometry

def nearestPoints(g1: Geometry, g2: Geometry): Array[Coordinate]

Computes the nearest points of the facets of two geometries.

Computes the nearest points of the facets of two geometries.

Value Params
g1

a geometry

g2

a geometry return the nearest points on the facets of the geometries