public class IndexedFacetDistance extends Object
Geometrys using a Branch-and-Bound algorithm. The Branch-and-Bound algorithm operates over a traversal of R-trees built on the target and possibly also the query geometries.
This approach provides the following benefits:
getDistance(Geometry) when one or both input geometries are large, or when evaluating many distance computations against a single geometry.
This class is not thread-safe.
| Constructor and Description |
|---|
IndexedFacetDistance(Geometry
Creates a new distance-finding instance for a given target
Geometry.
|
| Modifier and Type | Method and Description |
|---|---|
static double |
distance(Geometry
Computes the distance between two geometries using the indexed approach.
|
double |
getDistance(Geometry
Computes the distance from the base geometry to the given geometry.
|
public IndexedFacetDistance(Geometryg1)
Geometry.
Distances will be computed to all facets of the input geometry. The facets of the geometry are the discrete segments and points contained in its components. In the case of Lineal and Puntal inputs, this is equivalent to computing the conventional distance. In the case of Polygonal inputs, this is equivalent to computing the distance to the polygons boundaries.
g1 - a Geometry, which may be of any type.
public static double distance(Geometryg1, Geometry g2)
For geometries with many segments or points, this can be faster than using a simple distance algorithm.
g1 - a geometry
g2 - a geometry
public double getDistance(Geometryg)
g - the geometry to compute the distance to