Table of Contents

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

p Coordinate

The point to compute the distance for

A Coordinate

The first point of the first line

B Coordinate

The 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

p Coordinate

The point to compute the distance for

A Coordinate

The first point of the first line

B Coordinate

The 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

p Coordinate

A point

line CoordinateSequence

A 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

p Coordinate

A point

line Coordinate[]

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

A Coordinate

The first point of the first line

B Coordinate

The second point of the first line (must be different to A)

C Coordinate

The first point of the second line

D Coordinate

The 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