主题
Search

直线与直线的交点


LineLineIntersection

两条直线 L_1L_2 在二维空间中的交点,其中 L_1 穿过点 (x_1,y_1)(x_2,y_2),并且 L_2 穿过点 (x_3,y_3)(x_4,y_4),由下式给出

x=(||x_1 y_1; x_2 y_2| |x_1 1; x_2 1|; |x_3 y_3; x_4 y_4| |x_3 1; x_4 1||)/(||x_1 1; x_2 1| |y_1 1; y_2 1|; |x_3 1; x_4 1| |y_3 1; y_4 1||)=(||x_1 y_1; x_2 y_2| x_1-x_2; |x_3 y_3; x_4 y_4| x_3-x_4|)/(|x_1-x_2 y_1-y_2; x_3-x_4 y_3-y_4|)
(1)
y=(||x_1 y_1; x_2 y_2| |y_1 1; y_2 1|; |x_3 y_3; x_4 y_4| |y_3 1; y_4 1||)/(||x_1 1; x_2 1| |y_1 1; y_2 1|; |x_3 1; x_4 1| |y_3 1; y_4 1||)=(||x_1 y_1; x_2 y_2| y_1-y_2; |x_3 y_3; x_4 y_4| y_3-y_4|)/(|x_1-x_2 y_1-y_2; x_3-x_4 y_3-y_4|),
(2)

其中 |a b; c d| 表示一个行列式。这对应于同时求解

|x y 1; x_1 y_1 1; x_2 y_2 1|=0
(3)
|x y 1; x_3 y_3 1; x_4 y_4 1|=0
(4)

以求 xy。Antonio (1992) 和 Hill (1994) 给出了其他处理方法。

三线坐标中给出的两条直线的交点为

l_1alpha+m_1beta+n_1gamma=0
(5)
l_2alpha+m_2beta+n_2gamma=0
(6)

 |m_1 m_2; n_1 n_2|:|n_1 n_2; l_1 l_2|:|l_1 l_2; m_1 m_2|.
(7)

de Berg等人 (2000) 给出了线段相交的伪代码。

三线坐标中的三条直线

l_1alpha+m_1beta+n_1gamma=0
(8)
l_2alpha+m_2beta+n_2gamma=0
(9)
l_3alpha+m_3beta+n_3gamma=0
(10)

如果它们的三线坐标满足,则共点

 |l_1 m_1 n_1; l_2 m_2 n_2; l_3 m_3 n_3|=0,
(11)

在这种情况下,该点为

 m_2n_3-n_2m_3:n_2l_3-l_2n_3:l_2m_3-m_2l_3.
(12)

如果直线的系数满足,则笛卡尔坐标系中的三条直线共点

A_1x+B_1y+C_1=0
(13)
A_2x+B_2y+C_2=0
(14)
A_3x+B_3y+C_3=0
(15)

满足

 |A_1 B_1 C_1; A_2 B_2 C_2; A_3 B_3 C_3|=0.
(16)

在三维空间中,代数变得更加复杂。两条直线的交点,分别包含点 x_1=(x_1,y_1,z_1)x_2=(x_2,y_2,z_2),以及 x_3=(x_3,y_3,z_3)x_4=(x_4,y_4,z_4),也可以通过同时求解直接找到

x=x_1+(x_2-x_1)s
(17)
x=x_3+(x_4-x_3)t
(18)

以及四个点共面的条件(即,直线不是异面直线),

 |x_1 y_1 z_1 1; x_2 y_2 z_2 1; x_3 y_3 z_3 1; x_4 y_4 z_4 1|=(x_3-x_1)·[(x_2-x_1)x(x_4-x_3)]=0
(19)

以求 x=(x,y,z),消去 st。这组方程可以求解 s 以得到

 s=((cxb)·(axb))/(|axb|^2),
(20)

其中

a=x_2-x_1
(21)
b=x_4-x_3
(22)
c=x_3-x_1
(23)

(Hill 1994)。

然后可以通过代入 s 来立即找到交点,得到

 x=x_1+a((cxb)·(axb))/(|axb|^2).
(24)

通过额外定义,可以获得稍微更对称和简洁的形式

v=a^^xb^^
(25)
s_1=(det(c  b^^  v^^))/(|v|^2)
(26)
s_2=(det(c  a^^  v^^))/(|v|^2),
(27)

其中 x^^ 表示一个单位向量,然后

 x=1/2(x_1+a^^s_1+x_3+b^^s_2)
(28)

(Goldman 1990)。


另请参见

共点, 共点的, 交点, 直线, 直线与直线的夹角, 直线与直线的距离, 直线与平面的交点, 普罗克洛斯公理, 异面直线

使用 Wolfram|Alpha 探索

参考文献

Antonio, F. "Faster Line Segment Intersection. Ch. IV.6 in Graphics Gems III (Ed. D. Kirk). San Diego: Academic Press, pp. 199-202 and 500-501, 1992.Bentley, J. and Ottmann, T. "Algorithms for Reporting and Counting Geometric Intersections." IEEE Trans. Comput. C-28, 643-647, 1979.de Berg, M.; van Kreveld, M.; Overmars, M.; and Schwarzkopf, O. Computational Geometry. New York: Springer, pp. 19-29, 2000.Goldman, R. "Intersection of Two Lines in Three-Space." In Graphics Gems I (Ed. A. S. Glassner). San Diego: Academic Press, p. 304, 1990.Hill, F. S. Jr. "The Pleasures of 'Perp Dot' Products." Ch. II.5 in Graphics Gems IV (Ed. P. S. Heckbert). San Diego: Academic Press, pp. 138-148, 1994.Mehlhorn, K. and Näher, S. "Implementing a Sweep Line Algorithm for the Straight Line Segment Intersection Problem." n.d. http://www.mpi-sb.mpg.de/LEDA/articles/sweep.ps.gz.Prasad, M. "Exact Computation of 2-D Intersections." Ch. IV.4 in Graphics Gems II (Ed. J. Avro). Boston, MA: Academic Press, pp. 7-9, 1991.Prasad, M. "Faster Line Segment Intersection." Ch. IV.6 in Graphics Gems II (Ed. J. Avro). Boston, MA: Academic Press, pp. 7-9, 1991.

在 Wolfram|Alpha 中被引用

直线与直线的交点

请引用本文为

Weisstein, Eric W. "直线与直线的交点。" 来自 MathWorld--Wolfram Web 资源。 https://mathworld.net.cn/Line-LineIntersection.html

学科分类