TITLE: How to calculate the intersection of two planes?
QUESTION [38 upvotes]: How to calculate the intersection of two planes ?
These are the planes and the result is gonna be a line in $\Bbb R^3$:
$x + 2y + z - 1 = 0$
$2x + 3y - 2z + 2 = 0$

REPLY [2 votes]: I tried the systems of equations approach posted by multiple people, but dealing with division by zero made things really messy.  So I came up with a more intuitive approach.
Start with the cross product of the normal vectors of the 2 planes (Normal1 and Normal2) to get a direction of the intersection line (Normal3):
Normal3 = Normal1 × Normal2

Now if we look at the existing planes from the perspective of that direction, our 2 planes look like 2 lines, because we're viewing them both edge-on.  So we want to calculate what those 2 lines are.  We can get the direction of each line as the cross product of our new plane's normal with the original normal:
line1dir = Normal1 × Normal3
line2dir = Normal2 × Normal3

So now we need the origin of each of these lines.  That's just the normal times the offset:
line1start = Normal1 * Offset1
line2start = Normal2 * Offset2

That gives use two lines:
line1 = (line1start, line1start + line1dir)
line2 = (line2start, line2start + line2dir)

Now if we find the intersection of those two lines, it will give a point which occurs on both lines, which means it also occurs on both planes:
https://math.stackexchange.com/questions/270767/find-intersection-of-two-3d-lines/271366

Once you have the intersection point, combine it with the Normal3 we calculated at the beginning to get the intersection line.