Proof of well-known 'Intersection Of Three Planes' formula.

Introduction & Motivation

Recently, I found out well-known formula 'Intersection between Three Planes' (Equation (22.31) of [1]) has no proof on literaly anywhere. Even (almost) the book where it is propsed[2].

So, I decided to figure out how this formula is derived.. (of course, experimentally it is wokrs very well.)

Notation

Let there be three planes on euclidean space $P_1, P_2, P_3$ which intersect in a point. If we let there normals as $n_1=(a_1, b_1, c_1), n_2=(a_2, b_2, c_2), n_3=(a_3, b_3, c_3)$, they must be linearly independent.

Also, let the planes $P_1, P_2, P_3$ as the system of equation like below : 

$$\begin{cases} a_1x+b_1y+c_1z+d_1=0 \\ a_2x+b_2y+c_2z+d_2=0 \\ a_3x+b_3y+c_3z +d_3=0 \end{cases}$$

Proof

A. Solve problem with Linear Algebra.

To find a intersection point by linear algebra, write system of equations as matrix form :
$$\begin{bmatrix}a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \\ \end{bmatrix}\begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} -d_1 \\ -d_2 \\ -d_3 \end{bmatrix}$$

$$-\begin{bmatrix}a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \\ \end{bmatrix}\begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} d_1 \\ d_2 \\ d_3 \end{bmatrix}$$

For conciseness, I'll write determinant of coefficient matrix as below : 

$$DET=\begin{vmatrix} a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \\ \end{vmatrix}$$  

Since that, three planes are met in a point (linearly independent)

$$DET \neq 0$$

By Cramer's Rule,

$$(-x)=\frac{\begin{vmatrix} \color{red}{d_1} & b_1 & c_1 \\ \color{red}{d_2} & b_2 & c_2 \\ \color{red}{d_3} & b_3 & c_3 \\ \end{vmatrix}}{DET}, (-y)=\frac{\begin{vmatrix} a_1 & \color{red}{d_1} & c_1 \\ a_2 & \color{red}{d_2} & c_2 \\ a_3 & \color{red}{d_3} & c_3 \\ \end{vmatrix}}{DET}, (-z)=\frac{\begin{vmatrix} a_1 & b_1 & \color{red}{d_1} \\ a_2 & b_2 & \color{red}{d_2} \\ a_3 & b_3 & \color{red}{d_3} \\ \end{vmatrix}}{DET}$$

By cofactor expansion, 

$$(-x)=\frac{1}{DET} \left\lbrace d_1\begin{vmatrix} b2 & c2 \\ b3 & c3 \end{vmatrix} -b_1\begin{vmatrix} d2 & c2 \\ d3 & c3 \end{vmatrix} + c_1\begin{vmatrix} d2 & b2 \\ d3 & b3 \end{vmatrix} \right\rbrace \\ = \frac{1}{DET} \left\lbrace \color{purple}{A} -b_1\begin{vmatrix} d2 & c2 \\ d3 & c3 \end{vmatrix} + c_1\begin{vmatrix} d2 & b2 \\ d3 & b3 \end{vmatrix} \right\rbrace $$

$$(-y)=\frac{1}{DET} \left\lbrace a_1\begin{vmatrix} d2 & c2 \\ d3 & c3 \end{vmatrix} -d_1\begin{vmatrix} a2 & c2 \\ a3 & c3 \end{vmatrix} + c_1\begin{vmatrix} a2 & d2 \\ a3 & d3 \end{vmatrix} \right\rbrace \\ = \frac{1}{DET} \left\lbrace a_1\begin{vmatrix} d2 & c2 \\ d3 & c3 \end{vmatrix} + \color{purple}{B} + c_1\begin{vmatrix} a2 & d2 \\ a3 & d3 \end{vmatrix} \right\rbrace $$

$$(-z)=\frac{1}{DET} \left\lbrace a_1\begin{vmatrix} b2 & d2 \\ b3 & d3 \end{vmatrix} -b_1\begin{vmatrix} a2 & d2 \\ a3 & d3 \end{vmatrix} + d_1\begin{vmatrix} a2 & b2 \\ a3 & b3 \end{vmatrix} \right\rbrace \\ = \frac{1}{DET} \left\lbrace a_1\begin{vmatrix} b2 & d2 \\ b3 & d3 \end{vmatrix} -b_1\begin{vmatrix} a2 & d2 \\ a3 & d3 \end{vmatrix} + \color{purple}{C} \right\rbrace $$

By unwind 2x2 deterimants :

$$(-x) = \frac{1}{DET} \left\lbrace \color{purple}{A} - b_1(d_2c_3 - c_2d_3) + c_1(d_2b_3 - b_2d_3) \right\rbrace \\ = \frac{1}{DET} \left\lbrace \color{purple}{A} + \color{blue}{D} + \color{blue}{E} + \color{blue}{F} + \color{blue}{G} \right\rbrace $$

$$(-y) = \frac{1}{DET} \left\lbrace a_1(d_2c_3 - c_2d_3) + \color{purple}{B} - c_1(a_2d_3 - d_2a_3) \right\rbrace \\ = \frac{1}{DET} \left\lbrace \color{blue}{U} + \color{blue}{R} + \color{purple}{B} + \color{blue}{Q} + \color{blue}{H} \right\rbrace $$

$$(-z) = \frac{1}{DET} \left\lbrace a_1(b_2d_3 - d_2b_3) - b_1(a_2d_3 - d_2a_3) + \color{purple}{C} \right\rbrace \\ = \frac{1}{DET} \left\lbrace \color{blue}{L} + \color{blue}{I} + \color{blue}{M} + \color{blue}{K} + \color{purple}{C} \right\rbrace $$

B. Unwind the magic intersection formula.

Below is the formula for calculating a intersection point between three planes (from Equation (22.31) of [1])

$$p_{intersection}=\frac{(p_1 \cdot n_1)(n_2 \times n_3) + (p_2 \cdot n_2)(n_3 \times n_1) + (p_3 \cdot n_3)(n_1 \times n_2)}{\begin{vmatrix} n_1 \\  n_2 \\  n_3 \end{vmatrix} }$$

Since that $p_1, p_2, p_3$ are the point on the plane $P_1, P_2, P_3$ repectively, above can be expressed as : 
$$p_{intersection}=\frac{1}{DET} \left\lbrace (-d_1)(n_2 \times n_3) + (-d_2)(n_3 \times n_1) + (-d_3)(n_1 \times n_2) \right\rbrace $$ 

By expressing cross product with deteriminant with canonical vectors $i, j, k$, 

$$p_{intersection}=\frac{-1}{DET} \left\lbrace d_1 \begin{vmatrix} i & j & k \\ a_2 & b_2 & c_2 \\ a_3 & b_3 & c_3 \\ \end{vmatrix} + d_2 \begin{vmatrix} i & j & k \\ a_3 & b_3 & c_3 \\ a_1 & b_1 & c_1 \\ \end{vmatrix} + d_3 \begin{vmatrix} i & j & k \\ a_1 & b_1 & c_1 \\ a_2 & b_2 & c_2 \\ \end{vmatrix} \right\rbrace \\ = \frac{-1}{DET} \left\lbrace d1 * \left\lbrace i\begin{vmatrix} b2 & c2 \\ b3 & c3 \end{vmatrix} -j\begin{vmatrix} a2 & c2 \\ a3 & c3 \end{vmatrix} + k\begin{vmatrix} a2 & b2 \\ a3 & b3 \end{vmatrix} \right\rbrace + \\ d2 * \left\lbrace i\begin{vmatrix} b3 & c3 \\ b1 & c1 \end{vmatrix} -j\begin{vmatrix} a3 & c3 \\ a1 & c1 \end{vmatrix} + k\begin{vmatrix} a3 & b3 \\ a1 & b1 \end{vmatrix} \right\rbrace + \\ d3 * \left\lbrace i\begin{vmatrix} b1 & c1 \\ b2 & c2 \end{vmatrix} -j\begin{vmatrix} a1 & c1 \\ a2 & c2 \end{vmatrix} + k\begin{vmatrix} a1 & b1 \\ a2 & b2 \end{vmatrix} \right\rbrace \right\rbrace $$ 
By considering $i, j, k$ as $x, y, z$ axis unit vectors, we can see that some matrices are same as Section A : 
$$= \frac{-1}{DET} \left\lbrace (\color{purple}{A} + \color{purple}{B} + \color{purple}{C}) + \\ d2 * \left\lbrace i\begin{vmatrix} b3 & c3 \\ b1 & c1 \end{vmatrix} -j\begin{vmatrix} a3 & c3 \\ a1 & c1 \end{vmatrix} + k\begin{vmatrix} a3 & b3 \\ a1 & b1 \end{vmatrix} \right\rbrace + \\ d3 * \left\lbrace i\begin{vmatrix} b1 & c1 \\ b2 & c2 \end{vmatrix} -j\begin{vmatrix} a1 & c1 \\ a2 & c2 \end{vmatrix} + k\begin{vmatrix} a1 & b1 \\ a2 & b2 \end{vmatrix} \right\rbrace \right\rbrace$$
Sadly, rest of 2x2 determinants are not directly equal to Section A, but if we unwind them...... 😂
$$= \frac{-1}{DET} \left\lbrace (\color{purple}{A} + \color{purple}{B} + \color{purple}{C}) + \\ d2 * \left\lbrace i(b_3c_1 - c_3b_1) -j(a_3c_1 - c_3a_1)+ k(a_3b_1 - b_3a_1) \right\rbrace + \\ d3 * \left\lbrace i(b_1c_2 - c_1b_2) -j(a_1c_2 - c_1a_2)+ k(a_1b_2 - b_1a_2) \right\rbrace \right\rbrace$$
$$= \frac{-1}{DET} \left\lbrace (\color{purple}{A} + \color{purple}{B} + \color{purple}{C}) + \\ ( \color{blue}{F} + \color{blue}{D} + \color{blue}{H} + \color{blue}{U} + \color{blue}{K} + \color{blue}{J}) + \\ ( \color{blue}{E} + \color{blue}{G} + \color{blue}{R} + \color{blue}{Q} + \color{blue}{L} + \color{blue}{M}) \right\rbrace $$

Conclusion?

1. The formula is completely correct as proved by linear algebra.
2. And original writers are very unkind.

References

[1] Akenine-Mo, Tomas, Eric Haines, and Naty Hoffman. "Real-time rendering." (2018), page 990.
[2] Goldman, Ronald. "Intersection of three planes." Graphics gems. 1990. 305.

댓글

이 블로그의 인기 게시물

Linux에서 특정한 디렉토리가 차지하는 용량을 효율적이고, 빠르게 계산하는 법(Fast, efficient way to calculate directory size recursively on linux)

영화 'Call me by your name'의 OST 중 'Visions of Gideons' 번역 및 해석