求平面内两条直线的交点

The  and  coordinates of the point of intersection of two non-vertical lines can easily be found using the following substitutions and rearrangements.

Suppose that two lines have the equations  and  where  and  are the slopes (gradients) of the lines and where  and  are the y-intercepts of the lines. At the point where the two lines intersect (if they do), both  coordinates will be the same, hence the following equality:

.

We can rearrange this expression in order to extract the value of ,

,

and so,

.

To find the y coordinate, all we need to do is substitute the value of x into either one of the two line equations, for example, into the first:

.

Hence, the point of intersection is

.

Note if a = b then the two lines are parallel. If c ≠ d as well, the lines are different and there is no intersection, otherwise the two lines are identical.

你可能感兴趣的:(求平面内两条直线的交点)