Class DistanceOp
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.
Empty geometry collection components are ignored.
The algorithms used are straightforward O(n^2) comparisons. This worst-case performance could be improved on by using Voronoi techniques.
Inherited Members
Namespace: NetTopologySuite.Operation.Distance
Assembly: NetTopologySuite.dll
Syntax
public class DistanceOp
Constructors
| Improve this Doc View SourceDistanceOp(Geometry, Geometry)
Constructs a DistanceOp that computes the distance and closest points between the two specified geometries.
Declaration
public DistanceOp(Geometry g0, Geometry g1)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g0 | A geometry |
Geometry | g1 | A geometry |
DistanceOp(Geometry, Geometry, Double)
Constructs a DistanceOp that computes the distance and closest points between the two specified geometries.
Declaration
public DistanceOp(Geometry g0, Geometry g1, double terminateDistance)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g0 | A geometry |
Geometry | g1 | A geometry |
Double | terminateDistance | The distance on which to terminate the search. |
Methods
| Improve this Doc View SourceDistance()
Report the distance between the closest points on the input geometries.
Declaration
public double Distance()
Returns
Type | Description |
---|---|
Double | The distance between the geometries |
Exceptions
Type | Condition |
---|---|
ApplicationException | if either input geometry is null |
Distance(Geometry, Geometry)
Compute the distance between the closest points of two geometries.
Declaration
public static double Distance(Geometry g0, Geometry g1)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g0 | A |
Geometry | g1 | Another |
Returns
Type | Description |
---|---|
Double | The distance between the geometries. |
IsWithinDistance(Geometry, Geometry, Double)
Test whether two geometries lie within a given distance of each other.
Declaration
public static bool IsWithinDistance(Geometry g0, Geometry g1, double distance)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g0 | |
Geometry | g1 | |
Double | distance |
Returns
Type | Description |
---|---|
Boolean |
NearestLocations()
Report the locations of the nearest points in the input geometries. The locations are presented in the same order as the input Geometries.
Declaration
public GeometryLocation[] NearestLocations()
Returns
Type | Description |
---|---|
GeometryLocation[] | A pair of GeometryLocations for the nearest points. |
NearestPoints()
Report the coordinates of the nearest points in the input geometries. The points are presented in the same order as the input Geometries.
Declaration
public Coordinate[] NearestPoints()
Returns
Type | Description |
---|---|
Coordinate[] | A pair of |
NearestPoints(Geometry, Geometry)
Compute the the closest points of two geometries. The points are presented in the same order as the input Geometries.
Declaration
public static Coordinate[] NearestPoints(Geometry g0, Geometry g1)
Parameters
Type | Name | Description |
---|---|---|
Geometry | g0 | A |
Geometry | g1 | Another |
Returns
Type | Description |
---|---|
Coordinate[] | The closest points in the geometries. |