com.vividsolutions.jts.algorithm.distance
Class DiscreteHausdorffDistance

java.lang.Object
  extended bycom.vividsolutions.jts.algorithm.distance.DiscreteHausdorffDistance

public class DiscreteHausdorffDistance
extends java.lang.Object

Implements algorithm for computing a distance metric which can be thought of as the "Discrete Hausdorff Distance". This is the Hausdorff distance restricted to discrete points for one of the geometries. Also determines two points of the Geometries which are separated by the computed distance.

NOTE:The current implementation supports only vertices as the discrete locations. This could be extended to allow an arbitrary density of points to be used.

NOTE: This algorithm is NOT equivalent to the standard Hausdorff distance. However, it computes an approximation that is correct for a large subset of useful cases. One important part of this subset is Linestrings that are roughly parallel to each other, and roughly equal in length. This is a useful metric for line matching.


Nested Class Summary
static class DiscreteHausdorffDistance.MaxDensifiedByFractionDistanceFilter
           
static class DiscreteHausdorffDistance.MaxPointDistanceFilter
           
 
Constructor Summary
DiscreteHausdorffDistance(Geometry g0, Geometry g1)
           
 
Method Summary
 double distance()
           
static double distance(Geometry g0, Geometry g1)
           
 Coordinate[] getCoordinates()
           
 double orientedDistance()
           
 void setDensifyFraction(double densifyFrac)
          Sets the fraction by which to densify each segment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscreteHausdorffDistance

public DiscreteHausdorffDistance(Geometry g0,
                                 Geometry g1)
Method Detail

distance

public static double distance(Geometry g0,
                              Geometry g1)

setDensifyFraction

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


distance

public double distance()

orientedDistance

public double orientedDistance()

getCoordinates

public Coordinate[] getCoordinates()