The intersection of two planes

今天写程序要求两个平面的交线方程,叉乘一下两个normal就得到了直线的方向,但在求那个点的时候卡住了。自己写一个求点的程序,发现要check好多情况,程序好繁。实在忍受不了了,就google search一下居然有这么cool的求交线上任意点的方法,看来自己是在是太fool了。

The intersection of two planes

Written by Paul Bourke
February 2000

The intersection of two planes (if they are not parallel) is a line.

Define the two planes with normals N as

N1 . p = d1

N2 . p = d2

The equation of the line can be written as

p = c1 N1 + c2 N2 + u N1 * N2

Where "*" is the cross product, "." is the dot product, and u is the parameter of the line.

Taking the dot product of the above with each normal gives two equations with unknowns c1 and c2.

N1 . p = d1 = c1 N1 . N1 + c2 N1 . N2

N2 . p = d2 = c1 N1 . N2 + c2 N2 . N2

Solving for c1 and c2

c1 = ( d1 N2 . N2 – d2 N1 . N2 ) / determinant

c2 = ( d2 N1 . N1 – d1 N1 . N2) / determinant

determinant = ( N1 . N1 ) ( N2 . N2 ) – ( N1 . N2 )2

Note that a test should first be performed to check that the planes aren’t parallel or coincident (also parallel), this is most easily achieved by checking that the cross product of the two normals isn’t zero. The planes are parallel if

N1 * N2 = 0


One thought on “The intersection of two planes

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s