IndexedFacetDistance class

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.

@author Martin Davis

Constructors

IndexedFacetDistance(Geometry baseGeometry)
Creates a new distance-finding instance for a given target {@link Geometry}.

Properties

baseGeometry Geometry
getter/setter pair
cachedTree STRtree?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

facetDistance(Geometry g) double
Computes the distance from the base geometry to the given geometry.
isWithinDistanceGeometry(Geometry g, double maxDistance) bool
Tests whether the base geometry lies within a specified distance of the given geometry.
nearestLocations(Geometry g) List<GeometryLocation?>?
Computes the nearest locations on the base geometry and the given geometry.
nearestPointsToGeometry(Geometry g) List<Coordinate?>?
Compute the nearest locations on the target geometry and the given geometry.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

FACET_SEQ_DIST FacetSequenceDistance
final

Static Methods

distance(Geometry g1, Geometry g2) double
Computes the distance between facets of two geometries.
isWithinDistance(Geometry g1, Geometry g2, double distance) bool
Tests whether the facets of two geometries lie within a given distance.
nearestPoints(Geometry g1, Geometry g2) List<Coordinate?>?
Computes the nearest points of the facets of two geometries.
toPoints(List<GeometryLocation?>? locations) List<Coordinate>?