com.vividsolutions.jts.operation.distance
Class DistanceOp
java.lang.Object
com.vividsolutions.jts.operation.distance.DistanceOp
public class DistanceOp
extends java.lang.Object
Computes the distance and
closest points between two
Geometry
s.
The distance computation finds a pair of points in the input geometries
which have minimum distance between them. These points may
not be vertices of the geometries, but may lie in the interior of
a line segment. In this case the coordinate computed is a close
approximation to the exact point.
The algorithms used are straightforward O(n^2)
comparisons. This worst-case performance could be improved on
by using Voronoi techniques.
DistanceOp(Geometry g0, Geometry g1) - Constructs a DistanceOp that computes the distance and closest points between
the two specified geometries.
|
DistanceOp
public DistanceOp(Geometry g0,
Geometry g1)
Constructs a DistanceOp that computes the distance and closest points between
the two specified geometries.
closestLocations
public GeometryLocation[] closestLocations()
Report the locations of the closest points in the input geometries.
The locations are presented in the same order as the input Geometries.
closestPoints
public Coordinate[] closestPoints()
Report the coordinates of the closest points in the input geometries.
The points are presented in the same order as the input Geometries.
closestPoints
public static Coordinate[] closestPoints(Geometry g0,
Geometry g1)
Compute the the closest points of two geometries.
The points are presented in the same order as the input Geometries.
- the closest points in the geometries
distance
public double distance()
Report the distance between the closest points on the input geometries.
- the distance between the geometries
distance
public static double distance(Geometry g0,
Geometry g1)
Compute the distance between the closest points of two geometries.
- the distance between the geometries