Class DiscreteFrechetDistance

java.lang.Object
org.locationtech.jts.algorithm.distance.DiscreteFrechetDistance

public class DiscreteFrechetDistance extends Object
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:
  • Constructor Details

    • DiscreteFrechetDistance

      public DiscreteFrechetDistance(Geometry g0, Geometry g1)
      Creates an instance of this class using the provided geometries.
      Parameters:
      g0 - a geometry
      g1 - a geometry
  • Method Details

    • distance

      public static double distance(Geometry g0, Geometry g1)
      Computes the Discrete Fréchet Distance between two Geometrys using a Cartesian distance computation function.
      Parameters:
      g0 - the 1st geometry
      g1 - the 2nd geometry
      Returns:
      the cartesian distance between {#g0} and {#g1}
    • getCoordinates

      public Coordinate[] getCoordinates()
      Gets the pair of Coordinates at which the distance is obtained.
      Returns:
      the pair of Coordinates at which the distance is obtained