GEOS 3.14.1
geos::algorithm::distance::DiscreteFrechetDistance Class Reference

The Fréchet distance is a measure of similarity between curves. Thus, it can be used like the Hausdorff distance. More...

#include <DiscreteFrechetDistance.h>

Classes

class  MatrixStorage
class  RectMatrix
class  CsrMatrix
class  HashMapMatrix

Public Member Functions

 DiscreteFrechetDistance (const geom::Geometry &geom0, const geom::Geometry &geom1)
std::array< geom::CoordinateXY, 2 > getCoordinates ()
void setDensifyFraction (double dFrac)

Static Public Member Functions

static double distance (const geom::Geometry &geom0, const geom::Geometry &geom1)
static double distance (const geom::Geometry &geom0, const geom::Geometry &geom1, double densityFrac)

Detailed Description

The Fréchet distance is a measure of similarity between curves. Thus, it can be used like the Hausdorff distance.

An analogy for the Fréchet distance taken from Computing Discrete Fréchet Distance

A man is walking a dog on a leash: the man can move on one curve, the dog on the other; both may vary their speed, but backtracking is not allowed.

Its metric is better than the Hausdorff distance because it takes the directions of the curves into account. It is possible that two curves have a small Hausdorff but a large Fréchet distance.

This implementation is base on the following optimized Fréchet distance algorithm: Thomas Devogele, Maxence Esnault, Laurent Etienne. Distance discrète de Fréchet optimisée. Spatial Analysis and Geomatics (SAGEO), Nov 2016, Nice, France. hal-02110055

Several matrix storage implementations are provided

See also
DiscreteHausdorffDistance

Constructor & Destructor Documentation

◆ DiscreteFrechetDistance()

geos::algorithm::distance::DiscreteFrechetDistance::DiscreteFrechetDistance ( const geom::Geometry & geom0,
const geom::Geometry & geom1 )
inline

Creates an instance of this class using the provided geometries.

Parameters
geom0a geometry
geom1a geometry

Member Function Documentation

◆ distance() [1/2]

double geos::algorithm::distance::DiscreteFrechetDistance::distance ( const geom::Geometry & geom0,
const geom::Geometry & geom1 )
static

Computes the Discrete Fréchet Distance between two Geometrys using a Cartesian distance computation function.

Parameters
geom0the 1st geometry
geom1the 2nd geometry
Returns
the cartesian distance between geom0 and geom1

Referenced by getCoordinates().

◆ distance() [2/2]

double geos::algorithm::distance::DiscreteFrechetDistance::distance ( const geom::Geometry & geom0,
const geom::Geometry & geom1,
double densityFrac )
static

Computes the Discrete Fréchet Distance between two Geometrys using a Cartesian distance computation function.

Parameters
geom0the 1st geometry
geom1the 2nd geometry
densityFracthe fraction of edge length to target when densifying edges
Returns
the cartesian distance between geom0 and geom1

◆ getCoordinates()

std::array< geom::CoordinateXY, 2 > geos::algorithm::distance::DiscreteFrechetDistance::getCoordinates ( )

Gets the pair of geom::Coordinates at which the distance is obtained.

Returns
the pair of Coordinates at which the distance is obtained

References distance().


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