Table of Contents

Class IntersectionComputer

Namespace
NetTopologySuite.Algorithm
Assembly
NetTopologySuite.dll

Functions to compute intersection points between lines and line segments.

In general it is not possible to compute the intersection point of two lines exactly, due to numerical roundoff. This is particularly true when the lines are nearly parallel. These routines uses numerical conditioning on the input values to ensure that the computed value is very close to the correct value.

The Z-ordinate is ignored, and not populated.
public class IntersectionComputer
Inheritance
IntersectionComputer
Inherited Members

Constructors

IntersectionComputer()

public IntersectionComputer()

Methods

Intersection(Coordinate, Coordinate, Coordinate, Coordinate)

Computes the intersection point of two lines. If the lines are parallel or collinear this case is detected and null is returned.

public static Coordinate Intersection(Coordinate p1, Coordinate p2, Coordinate q1, Coordinate q2)

Parameters

p1 Coordinate

An endpoint of line 1

p2 Coordinate

An endpoint of line 1

q1 Coordinate

An endpoint of line 2

q2 Coordinate

An endpoint of line 2

Returns

Coordinate
NOTE: In JTS this function is called Intersection. The intersection point between the lines, if there is one, or null if the lines are parallel or collinear
See Also

LineSegment(Coordinate, Coordinate, Coordinate, Coordinate)

Computes the intersection point of a line and a line segment (if any). There will be no intersection point if:

If the segment is collinear with the line the first segment endpoint is returned.

public static Coordinate LineSegment(Coordinate line1, Coordinate line2, Coordinate seg1, Coordinate seg2)

Parameters

line1 Coordinate
line2 Coordinate
seg1 Coordinate
seg2 Coordinate

Returns

Coordinate

The intersection point, or null if it is not possible to find an intersection