Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

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 Geometry. More...

#include <DiscreteHausdorffDistance.h>

List of all members.

Public Member Functions

 DiscreteHausdorffDistance (const geom::Geometry &g0, const geom::Geometry &g1)
void setDensifyFraction (double dFrac)
double distance ()
double orientedDistance ()
const std::vector< geom::CoordinategetCoordinates () 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)


Detailed Description

An algorithm for computing a distance metric which is an approximation to the Hausdorff Distance based on a discretization of the input 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
 


Member Function Documentation

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 


The documentation for this class was generated from the following file:
Generated on Thu Jun 11 06:17:02 2009 for GEOS by  doxygen 1.4.4