Line-line intersection
In Euclidean geometry, the intersection of a line and a line can be the empty set, a point, or a line. Distinguishing these cases, and finding the intersection point have use, for example, in computer graphics, motion planning, and collision detection.
The number and locations of possible intersections between two lines and the number of possible lines with no intersections (parallel) with a given line are the distinguishing features of Non-Euclidean geometry.
Contents |
[edit] Mathematics
The intersection of two lines
and
in 2 dimensional space. With line
being defined by two points
and
, and line
being defined by two points
and
.[1]
The intersection
of line
and
can be defined using determinants.
The determinants can be written out as:

Note that the intersection point is for the infinitely long lines defined by the points, rather than the line segments between the points, and can produce an intersection point beyond the lengths of the line segments.
When the two lines are parallel or coincident the denominator term is zero:

[edit] n-line intersection
In two dimensions, more than two lines almost certainly do not intersect at a single point. Similarly, in three or more dimensions, even two lines almost certainly do not intersect. However, in two or more dimensions, we can usually find a point that is mutually closest to two or more lines in a least-squares sense.
In the two-dimensional case, first, represent line i as a point
on the line and a normal vector,
perpendicular to that line. That is, if
and
are points on line 1, then let
and let
which is the unit vector along the line, rotated by 90 degrees.
Note that the distance from a point, x to the line (p, n) is given by
.
And so the squared distance from a point, x, to a line is
.
the sum of squared distances to many lines is the cost function:
This can be rearranged:
To find the minimum, we differentiate with respect to x and set the result equal to the zero vector:
so
and so
.
This can be generalized to any number of dimensions by noting that
is simply the (symmetric) matrix with all eigenvalues unity except for a zero eigenvalue in the direction along the line providing a seminorm on the distance between
and another point giving the distance to the line. In any number of dimensions, if
is a unit vector along the ith line, then
becomes 
where I is the identity matrix, and so
.
[edit] See also
- Line segment intersection
- Line intersection in projective space
- Distance from a point to a line
- Parallel postulate
[edit] References
- ^ "Weisstein, Eric W. "Line-Line Intersection." From MathWorld". A Wolfram Web Resource. http://mathworld.wolfram.com/Line-LineIntersection.html. Retrieved 2008-01-10.
[edit] External links
- Distance between Lines and Segments with their Closest Point of Approach, applicable to two, three, or more dimensions.
- Line-line intersection in the plane at sputsoft.com



.
.



.
.