Class DistanceComputer
- Namespace
- NetTopologySuite.Algorithm
- Assembly
- NetTopologySuite.dll
Functions to compute distance between basic geometric structures.
public static class DistanceComputer
- Inheritance
-
DistanceComputer
- Inherited Members
Methods
PointToLinePerpendicular(Coordinate, Coordinate, Coordinate)
Computes the perpendicular distance from a point p to the (infinite) line containing the points AB
public static double PointToLinePerpendicular(Coordinate p, Coordinate A, Coordinate B)
Parameters
pCoordinateThe point to compute the distance for
ACoordinateThe first point of the first line
BCoordinateThe second point of the first line (must be different to A)
Returns
- double
The perpendicular distance from p to line segment AB
PointToSegment(Coordinate, Coordinate, Coordinate)
Computes the distance from a point p to a line segment AB
Note: NON-ROBUST!public static double PointToSegment(Coordinate p, Coordinate A, Coordinate B)
Parameters
pCoordinateThe point to compute the distance for
ACoordinateThe first point of the first line
BCoordinateThe second point of the first line (must be different to A)
Returns
- double
The distance from p to line segment AB
PointToSegmentString(Coordinate, CoordinateSequence)
Computes the distance from a point to a sequence of line segments.
public static double PointToSegmentString(Coordinate p, CoordinateSequence line)
Parameters
pCoordinateA point
lineCoordinateSequenceA sequence of contiguous line segments defined by their vertices
Returns
- double
The minimum distance between the point and the line segments
PointToSegmentString(Coordinate, Coordinate[])
Computes the distance from a point to a sequence of line segments.
public static double PointToSegmentString(Coordinate p, Coordinate[] line)
Parameters
pCoordinateA point
lineCoordinate[]A sequence of contiguous line segments defined by their vertices
Returns
- double
The minimum distance between the point and the line segments
SegmentToSegment(Coordinate, Coordinate, Coordinate, Coordinate)
Computes the distance from a line segment AB to a line segment CD
Note: NON-ROBUST!public static double SegmentToSegment(Coordinate A, Coordinate B, Coordinate C, Coordinate D)
Parameters
ACoordinateThe first point of the first line
BCoordinateThe second point of the first line (must be different to A)
CCoordinateThe first point of the second line
DCoordinateThe second point of the second line (must be different to C)
Returns
- double
The distance from a line segment AB to a line segment CD