GEOS  3.9.1dev
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
geos::operation::distance::IndexedFacetDistance Class Reference

Computes the distance between the facets (segments and vertices) of two Geometrys using a Branch-and-Bound algorithm. More...

#include <IndexedFacetDistance.h>

Public Member Functions

 IndexedFacetDistance (const geom::Geometry *g)
 Creates a new distance-finding instance for a given target geom::Geometry. More...
 
double distance (const geom::Geometry *g) const
 Computes the distance from the base geometry to the given geometry. More...
 
std::vector< GeometryLocationnearestLocations (const geom::Geometry *g) const
 Computes the nearest locations on the base geometry and the given geometry. More...
 
std::vector< geom::CoordinatenearestPoints (const geom::Geometry *g) const
 Compute the nearest locations on the target geometry and the given geometry. More...
 

Static Public Member Functions

static double distance (const geom::Geometry *g1, const geom::Geometry *g2)
 Computes the distance between facets of two geometries. More...
 
static std::vector< geom::CoordinatenearestPoints (const geom::Geometry *g1, const geom::Geometry *g2)
 Computes the nearest points of the facets of two geometries. More...
 

Private Attributes

std::unique_ptr< geos::index::strtree::STRtreecachedTree
 

Detailed Description

Computes the distance between the facets (segments and vertices) of two Geometrys 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:

Using this technique is usually much more performant than using the brute-force geom::Geometry::distance(const Geometry* g) const when one or both input geometries are large, or when evaluating many distance computations against a single geometry.

Author
Martin Davis

Definition at line 47 of file IndexedFacetDistance.h.

Constructor & Destructor Documentation

geos::operation::distance::IndexedFacetDistance::IndexedFacetDistance ( const geom::Geometry g)
inline

Creates a new distance-finding instance for a given target geom::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 polygon boundaries.

Parameters
ga Geometry, which may be of any type.

Definition at line 61 of file IndexedFacetDistance.h.

Member Function Documentation

static double geos::operation::distance::IndexedFacetDistance::distance ( const geom::Geometry g1,
const geom::Geometry g2 
)
static

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.

Parameters
g1a geometry
g2a geometry
Returns
the distance between facets of the geometries
double geos::operation::distance::IndexedFacetDistance::distance ( const geom::Geometry g) const

Computes the distance from the base geometry to the given geometry.

Parameters
gthe geometry to compute the distance to
Returns
the computed distance
std::vector<GeometryLocation> geos::operation::distance::IndexedFacetDistance::nearestLocations ( const geom::Geometry g) const

Computes the nearest locations on the base geometry and the given geometry.

Parameters
gthe geometry to compute the nearest location to
Returns
the nearest locations
static std::vector<geom::Coordinate> geos::operation::distance::IndexedFacetDistance::nearestPoints ( const geom::Geometry g1,
const geom::Geometry g2 
)
static

Computes the nearest points of the facets of two geometries.

Parameters
g1a geometry
g2a geometry
Returns
the nearest points on the facets of the geometries
std::vector<geom::Coordinate> geos::operation::distance::IndexedFacetDistance::nearestPoints ( const geom::Geometry g) const

Compute the nearest locations on the target geometry and the given geometry.

Parameters
gthe geometry to compute the nearest point to
Returns
the nearest points

Member Data Documentation

std::unique_ptr<geos::index::strtree::STRtree> geos::operation::distance::IndexedFacetDistance::cachedTree
private

Definition at line 102 of file IndexedFacetDistance.h.


The documentation for this class was generated from the following file: