GEOS  3.9.1dev
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
geos::algorithm::distance::DiscreteHausdorffDistance Class Reference

An algorithm for computing a distance metric which is an approximation to the Hausdorff Distance based on a discretization of the input geom::Geometry. More...

#include <DiscreteHausdorffDistance.h>

Collaboration diagram for geos::algorithm::distance::DiscreteHausdorffDistance:
[legend]

Classes

class  MaxDensifiedByFractionDistanceFilter
 
class  MaxPointDistanceFilter
 

Public Member Functions

 DiscreteHausdorffDistance (const geom::Geometry &p_g0, const geom::Geometry &p_g1)
 
void setDensifyFraction (double dFrac)
 
double distance ()
 
double orientedDistance ()
 
const std::array< geom::Coordinate, 2 > getCoordinates () const
 

Static Public Member Functions

static double distance (const geom::Geometry &g0, const geom::Geometry &g1)
 
static double distance (const geom::Geometry &g0, const geom::Geometry &g1, double densifyFrac)
 

Private Member Functions

void compute (const geom::Geometry &p_g0, const geom::Geometry &p_g1)
 
void computeOrientedDistance (const geom::Geometry &discreteGeom, const geom::Geometry &geom, PointPairDistance &ptDist)
 
 DiscreteHausdorffDistance (const DiscreteHausdorffDistance &other)=delete
 
DiscreteHausdorffDistanceoperator= (const DiscreteHausdorffDistance &rhs)=delete
 

Private Attributes

const geom::Geometryg0
 
const geom::Geometryg1
 
PointPairDistance ptDist
 
double densifyFrac
 Value of 0.0 indicates that no densification should take place. More...
 

Detailed Description

An algorithm for computing a distance metric which is an approximation to the Hausdorff Distance based on a discretization of the input geom::Geometry.

The algorithm computes the Hausdorff distance restricted to discrete points for one of the geometries. The points can be either the vertices of the geometries (the default), or the geometries with line segments densified by a given fraction. Also determines two points of the Geometries which are separated by the computed distance.

This algorithm is an approximation to the standard Hausdorff distance. Specifically,

   for all geometries a, b:    DHD(a, b) <= HD(a, b)

The approximation can be made as close as needed by densifying the input geometries. In the limit, this value will approach the true Hausdorff distance:

   DHD(A, B, densifyFactor) -> HD(A, B) as densifyFactor -> 0.0

The default approximation is exact or close enough for a large subset of useful cases. Examples of these are:

An example where the default approximation is not close is:

  A = LINESTRING (0 0, 100 0, 10 100, 10 100)
  B = LINESTRING (0 100, 0 10, 80 10)
  DHD(A, B) = 22.360679774997898
  HD(A, B) ~= 47.8

Definition at line 100 of file DiscreteHausdorffDistance.h.

Constructor & Destructor Documentation

geos::algorithm::distance::DiscreteHausdorffDistance::DiscreteHausdorffDistance ( const geom::Geometry p_g0,
const geom::Geometry p_g1 
)
inline

Definition at line 109 of file DiscreteHausdorffDistance.h.

geos::algorithm::distance::DiscreteHausdorffDistance::DiscreteHausdorffDistance ( const DiscreteHausdorffDistance other)
privatedelete

Member Function Documentation

void geos::algorithm::distance::DiscreteHausdorffDistance::compute ( const geom::Geometry p_g0,
const geom::Geometry p_g1 
)
inlineprivate

Definition at line 237 of file DiscreteHausdorffDistance.h.

void geos::algorithm::distance::DiscreteHausdorffDistance::computeOrientedDistance ( const geom::Geometry discreteGeom,
const geom::Geometry geom,
PointPairDistance ptDist 
)
private
static double geos::algorithm::distance::DiscreteHausdorffDistance::distance ( const geom::Geometry g0,
const geom::Geometry g1 
)
static
static double geos::algorithm::distance::DiscreteHausdorffDistance::distance ( const geom::Geometry g0,
const geom::Geometry g1,
double  densifyFrac 
)
static
double geos::algorithm::distance::DiscreteHausdorffDistance::distance ( )
inline

Definition at line 138 of file DiscreteHausdorffDistance.h.

const std::array<geom::Coordinate, 2> geos::algorithm::distance::DiscreteHausdorffDistance::getCoordinates ( ) const
inline

Definition at line 152 of file DiscreteHausdorffDistance.h.

DiscreteHausdorffDistance& geos::algorithm::distance::DiscreteHausdorffDistance::operator= ( const DiscreteHausdorffDistance rhs)
privatedelete
double geos::algorithm::distance::DiscreteHausdorffDistance::orientedDistance ( )
inline

Definition at line 145 of file DiscreteHausdorffDistance.h.

void geos::algorithm::distance::DiscreteHausdorffDistance::setDensifyFraction ( double  dFrac)
inline

Sets the fraction by which to densify each segment. Each segment will be (virtually) split into a number of equal-length subsegments, whose fraction of the total length is closest to the given fraction.

Parameters
dFrac

Definition at line 127 of file DiscreteHausdorffDistance.h.

Member Data Documentation

double geos::algorithm::distance::DiscreteHausdorffDistance::densifyFrac
private

Value of 0.0 indicates that no densification should take place.

Definition at line 255 of file DiscreteHausdorffDistance.h.

const geom::Geometry& geos::algorithm::distance::DiscreteHausdorffDistance::g0
private

Definition at line 248 of file DiscreteHausdorffDistance.h.

const geom::Geometry& geos::algorithm::distance::DiscreteHausdorffDistance::g1
private

Definition at line 250 of file DiscreteHausdorffDistance.h.

PointPairDistance geos::algorithm::distance::DiscreteHausdorffDistance::ptDist
private

Definition at line 252 of file DiscreteHausdorffDistance.h.


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