Class DiscreteFrechetDistance
- java.lang.Object
-
- org.locationtech.jts.algorithm.distance.DiscreteFrechetDistance
-
public class DiscreteFrechetDistance extends java.lang.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 DistanceA 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
-
-
Constructor Summary
Constructors Constructor Description DiscreteFrechetDistance(Geometry g0, Geometry g1)
Creates an instance of this class using the provided geometries.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double
distance(Geometry g0, Geometry g1)
Computes the Discrete Fréchet Distance between twoGeometry
s using aCartesian
distance computation function.Coordinate[]
getCoordinates()
Gets the pair ofCoordinate
s at which the distance is obtained.
-
-
-
Method Detail
-
distance
public static double distance(Geometry g0, Geometry g1)
Computes the Discrete Fréchet Distance between twoGeometry
s using aCartesian
distance computation function.- Parameters:
g0
- the 1st geometryg1
- the 2nd geometry- Returns:
- the cartesian distance between {#g0} and {#g1}
-
getCoordinates
public Coordinate[] getCoordinates()
Gets the pair ofCoordinate
s at which the distance is obtained.- Returns:
- the pair of Coordinates at which the distance is obtained
-
-