Class DistanceComputer
Functions to compute distance between basic geometric structures.
Inherited Members
Namespace: NetTopologySuite.Algorithm
Assembly: NetTopologySuite.dll
Syntax
public static class DistanceComputer
Methods
| Improve this Doc View SourcePointToLinePerpendicular(Coordinate, Coordinate, Coordinate)
Computes the perpendicular distance from a point p to the (infinite) line containing the points AB
Declaration
public static double PointToLinePerpendicular(Coordinate p, Coordinate A, Coordinate B)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | p | The point to compute the distance for |
Coordinate | A | The first point of the first line |
Coordinate | B | The second point of the first line (must be different to A) |
Returns
Type | Description |
---|---|
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!
Declaration
public static double PointToSegment(Coordinate p, Coordinate A, Coordinate B)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | p | The point to compute the distance for |
Coordinate | A | The first point of the first line |
Coordinate | B | The second point of the first line (must be different to A) |
Returns
Type | Description |
---|---|
Double | The distance from p to line segment AB |
PointToSegmentString(Coordinate, Coordinate[])
Computes the distance from a point to a sequence of line segments.
Declaration
public static double PointToSegmentString(Coordinate p, Coordinate[] line)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | p | A point |
Coordinate[] | line | A sequence of contiguous line segments defined by their vertices |
Returns
Type | Description |
---|---|
Double | The minimum distance between the point and the line segments |
PointToSegmentString(Coordinate, CoordinateSequence)
Computes the distance from a point to a sequence of line segments.
Declaration
public static double PointToSegmentString(Coordinate p, CoordinateSequence line)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | p | A point |
CoordinateSequence | line | A sequence of contiguous line segments defined by their vertices |
Returns
Type | Description |
---|---|
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!
Declaration
public static double SegmentToSegment(Coordinate A, Coordinate B, Coordinate C, Coordinate D)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | A | The first point of the first line |
Coordinate | B | The second point of the first line (must be different to A) |
Coordinate | C | The first point of the second line |
Coordinate | D | The second point of the second line (must be different to C) |
Returns
Type | Description |
---|---|
Double | The distance from a line segment AB to a line segment CD |