主題
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)。


另請參見

共點, 共點的, 交點, 直線, 直線與直線的夾角, 直線與直線的距離, 直線與平面的交點, 普羅克洛斯公理, 異面直線

使用 探索

參考文獻

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.

在 中被引用

直線與直線的交點

請引用本文為

Weisstein, Eric W. "直線與直線的交點。" 來自 Web 資源。 https://mathworld.tw/Line-LineIntersection.html

學科分類