In Euclidean geometry, the intersection of two lines can be an empty set , point, or line. The distinction between these cases and the search for the intersection point is used, for example, in computer graphics , in and for collision detection .
In three - dimensional Euclidean geometry, if two lines are not in the same plane , they are called intersecting and do not have intersection points. If the lines are in the same plane, there are three possibilities. If they coincide, they have infinitely many common points (namely, all points on these lines). If the lines are different but have the same slope, they are parallel and do not have common points. Otherwise, they have one intersection point.
In non-Euclidean geometry, two lines can intersect at several points, and the number of other lines (parallel) that do not intersect with this line can be more than one.
Content
The intersection of two lines
A necessary condition for the intersection of two lines is that they belong to the same plane, that is, these lines should not be crossed. The fulfillment of this condition is equivalent to the degeneracy of the tetrahedron , in which two vertices lie on one straight line and the other two on the other (i.e., the volume of this tetrahedron is zero). The algebraic form of this condition can be found in the article “ Checking the Cross ”.
If two points on each line are given
Consider the intersection of two lines and on the plane where the line defined by two different points and , and direct - various points and [1] .
Intersection direct and can be found using qualifiers .
Qualifiers can be rewritten as:
Note that the intersection point refers to infinite lines, not segments between points, and it can lie outside the segments. If (instead of solving in one step) to look for a solution in terms of first-order Bezier curves, then we can check the parameters of these curves 0.0 ≤ t ≤ 1.0 and 0.0 ≤ u ≤ 1.0 ( t and u are parameters).
If two lines are parallel or coincide, the denominator vanishes:
If the lines are very close to parallelism (almost parallel), when calculating on a computer, numerical problems may arise and recognition of such a condition may require a suitable “uncertainty” test for the application. A more stable and general solution can be obtained by rotating the segments in such a way that one of them becomes horizontal, and then the parametric solution of the second line is easy to obtain. When solving, careful consideration of special cases is necessary (parallelism / coincidence of lines, overlapping of segments).
If equations of lines are given
Coordinates and the intersection points of two non-vertical lines can be easily found using the following permutations and transformations.
Suppose two lines have equations and where and Are the angular coefficients of the lines, and and - intersections of lines with the y axis. At the point of intersection of the lines (if they intersect), both coordinates will coincide, whence we get the equality:
- .
We can transform this equality in order to highlight ,
- ,
and then
- .
To find the y coordinate, all we need is to substitute the value of x into one of the line formulas, for example, in the first:
- .
Hence we get the intersection point of the lines
- .
Note that for a = b the two lines are parallel. If, in addition, c ≠ d , the lines are different and have no intersections, otherwise the lines coincide [2] .
Using uniform coordinates
When using homogeneous coordinates , the intersection point of two clearly defined lines can be found quite simply. In 2-dimensional space, any point can be defined as the projection of a 3-dimensional point defined by a triple . The mapping of 3D coordinates to 2D takes place according to the formula . We can transform points in 2-dimensional space into homogeneous coordinates, equating the third coordinate to unity - .
Suppose we want to find the intersection of two infinite lines in 2-dimensional space that are given by the formulas and . We can represent these two lines in as and ,
Intersection of two lines then is simply given by the formulas [3]
If a , lines do not intersect.
Intersection of n lines
Existence and expression of intersection
In two-dimensional space
In two-dimensional space, lines with a number greater than two do not almost reliably intersect at one point. To determine if they intersect at one point, and if they intersect, to find the intersection point, we write the ith equation ( i = 1, ..., n ) as and compose these equations in matrix form
where the ith row n × 2 of matrix A is , w is the 2 × 1 vector ( x, y ) T , and the i- th element of the column vector b is equal to b i . If the columns of the matrix A are independent, the rank of the matrix is 2. Then and only if the rank of the [ A | b ] is also equal to 2, there is a solution to the matrix equation, and then there is the intersection point of n lines. The intersection point, if one exists, is given by the formula
Where - pseudoinverse matrix matrix . Alternatively, a solution can be found by solving any two independent equations. But if the rank of the matrix A is 1 and the rank of the extended matrix is 2, there are no solutions. In the case when the rank of the extended matrix is 1, all lines coincide.
In three-dimensional space
The approach presented above easily extends to three-dimensional space. In three-dimensional and higher spaces, even two straight lines almost certainly do not intersect. Pairs of non-parallel disjoint lines are called crossed . But when the intersection exists, it can be found as follows.
In three-dimensional space, the line is represented by the intersection of two planes, each of which is given by the formula Then the set of n lines can be represented as 2 n equations of the 3-dimensional coordinate vector w = ( x , y , z ) T :
- ,
where A is a 2 n × 3 matrix and b is 2 n × 1. As before, a unique intersection point exists if and only if A has a full rank in the columns and the extended matrix [ A | b ] it is not. The only intersection point, if exists, is given by the formula
Closest point to disjoint straight lines
In dimensions two and above, you can find a point that is closest to these two (or more) lines in the sense of the least sum of squares .
In two-dimensional space
In the case of two-dimensional space, we represent the line i as a point on direct and unit normal perpendicular to the line. That is, if and Are points on line 1, then let and
- ,
which is a unit vector along a line rotated 90º.
Note that the distance from the point x to the line is given by the formula
Therefore, the square of the distance from x to the line is
The sum of the squares of the distances to the set of lines is the objective function :
An expression can be converted:
To find the minimum, we differentiate with respect to x and equate the result to zero:
In this way,
where from
In three-dimensional space
Although in dimensions above two normal not defined, it can be generalized to any dimension, if you notice that is a simple (symmetric) matrix with all eigenvalues equal to unity, except for the zero eigenvalue in the direction of the line, which defines the seminorm between the point and another point. In space of any dimension if is the unit vector along the i- th line, then
- turns into ,
where E is the identity matrix, and then
See also
- The distance from a point to a line on a plane
- Axiom of Euclidean parallelism
Notes
- ↑ Weisstein, Eric W. "Line-Line Intersection." From MathWorld . A Wolfram Web Resource . Date of treatment January 10, 2008.
- ↑ Similar calculations can be found in the book of Delaunay and Raikov (p. 202-203)
- ↑ Homogeneous coordinates unspecified . robotics.stanford.edu . Date accessed August 18, 2015.
Literature
- B.N. Delone, D.A. Raikov. Analytic geometry. - M., L .: OGIZ, State Publishing House of technical and theoretical literature, 1948. - T. 1.
Links
- Distance between Lines and Segments with their Closest Point of Approach , applicable to two, three, or more dimensions.