GEOS  3.9.0dev
Static Public Member Functions | List of all members
geos::algorithm::Intersection Class Reference

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

#include <Intersection.h>

Static Public Member Functions

static geom::Coordinate intersection (const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q1, const geom::Coordinate &q2)
 

Detailed Description

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

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

Parameters
p1an endpoint of line 1
p2an endpoint of line 1
q1an endpoint of line 2
q2an endpoint of line 2
Returns
the intersection point between the lines, if there is one, or null if the lines are parallel or collinear
See also
CGAlgorithmsDD::intersection(Coordinate, Coordinate, Coordinate, Coordinate)

The documentation for this class was generated from the following file: