Class IntersectionComputer
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.
Inherited Members
Namespace: NetTopologySuite.Algorithm
Assembly: NetTopologySuite.dll
Syntax
public class IntersectionComputer
Methods
| Improve this Doc View SourceIntersection(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.
Declaration
public static Coordinate Intersection(Coordinate p1, Coordinate p2, Coordinate q1, Coordinate q2)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | p1 | An endpoint of line 1 |
Coordinate | p2 | An endpoint of line 1 |
Coordinate | q1 | An endpoint of line 2 |
Coordinate | q2 | An endpoint of line 2 |
Returns
Type | Description |
---|---|
Coordinate |
See Also
| Improve this Doc View SourceLineSegment(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.
Declaration
public static Coordinate LineSegment(Coordinate line1, Coordinate line2, Coordinate seg1, Coordinate seg2)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | line1 | |
Coordinate | line2 | |
Coordinate | seg1 | |
Coordinate | seg2 |
Returns
Type | Description |
---|---|
Coordinate | The intersection point, or |