Plane–plane intersection

In analytic geometry, the intersection of two planes in three-dimensional space is a line.

Formulation
The line of intersection between two planes $$\Pi_1 : \boldsymbol {n}_1 \cdot \boldsymbol r = h_1$$ and $$\Pi_2 : \boldsymbol {n}_2 \cdot \boldsymbol r = h_2$$ where $$\boldsymbol {n}_i$$ are normalized is given by
 * $$ \boldsymbol {r} = (c_1 \boldsymbol {n}_1 + c_2 \boldsymbol {n}_2) + \lambda (\boldsymbol {n}_1 \times \boldsymbol {n}_2) $$

where
 * $$ c_1 = \frac{ h_1 - h_2(\boldsymbol {n}_1 \cdot \boldsymbol {n}_2) }{ 1 - (\boldsymbol {n}_1 \cdot \boldsymbol {n}_2)^2 } $$
 * $$ c_2 = \frac{ h_2 - h_1(\boldsymbol {n}_1 \cdot \boldsymbol {n}_2) }{ 1 - (\boldsymbol {n}_1 \cdot \boldsymbol {n}_2)^2 }.$$

Derivation
This is found by noticing that the line must be perpendicular to both plane normals, and so parallel to their cross product $$\boldsymbol {n}_1 \times \boldsymbol {n}_2$$ (this cross product is zero if and only if the planes are parallel, and are therefore non-intersecting or entirely coincident).

The remainder of the expression is arrived at by finding an arbitrary point on the line. To do so, consider that any point in space may be written as $$\boldsymbol r = c_1\boldsymbol {n}_1 + c_2\boldsymbol {n}_2 + \lambda(\boldsymbol {n}_1 \times \boldsymbol {n}_2)$$, since $$\{ \boldsymbol {n}_1, \boldsymbol {n}_2, (\boldsymbol {n}_1 \times \boldsymbol {n}_2) \}$$ is a basis. We wish to find a point which is on both planes (i.e. on their intersection), so insert this equation into each of the equations of the planes to get two simultaneous equations which can be solved for $$c_1$$ and $$c_2$$.

If we further assume that $$\boldsymbol {n}_1$$ and $$\boldsymbol {n}_2$$ are orthonormal then the closest point on the line of intersection to the origin is $$\boldsymbol r_0 = h_1\boldsymbol {n}_1 + h_2\boldsymbol {n}_2$$. If that is not the case, then a more complex procedure must be used.

Dihedral angle
Given two intersecting planes described by $$\Pi_1 : a_1 x + b_1 y + c_1 z + d_1 = 0$$ and $$\Pi_2 : a_2 x + b_2 y + c_2 z + d_2 = 0$$, the dihedral angle between them is defined to be the angle $$\alpha$$ between their normal directions:
 * $$\cos\alpha = \frac{\hat n_1\cdot \hat n_2}{|\hat n_1||\hat n_2|} = \frac{a_1 a_2 + b_1 b_2 + c_1 c_2}{\sqrt{a_1^2+b_1^2+c_1^2}\sqrt{a_2^2+b_2^2+c_2^2}}. $$