# 2.5. 平面与平面

## 2.5. 平面与平面

#### 2.5.1. 平面与平面的夹角

$\angle {P_1}Q{P_2} = \arccos \frac{{{{\vec n}_0} \cdot {{\vec n}_1}}}{{\left\| {{{\vec n}_0}} \right\| \cdot \left\| {{{\vec n}_1}} \right\|}} \tag{2.20}$

$\theta = \pi – \angle {P_1}Q{P_2} = \pi – \arccos \frac{{{{\vec n}_0} \cdot {{\vec n}_1}}}{{\left\| {{{\vec n}_0}} \right\| \cdot \left\| {{{\vec n}_1}} \right\|}} \tag{2.21}$

#### 2.5.2. 平面与平面的交

$\vec d = {\vec n_1} \times {\vec n_2} \tag{2.22}$

$Y = a{\vec n_1} + b{\vec n_2} \tag{2.23}$

$\left\{ \begin{array}{l}a{{\vec n}_1} \cdot {{\vec n}_1} + b{{\vec n}_2} \cdot {{\vec n}_1} + {d_1} = 0\\a{{\vec n}_1} \cdot {{\vec n}_2} + b{{\vec n}_2} \cdot {{\vec n}_2} + {d_2} = 0\end{array} \right.$

$\left\{ \begin{array}{l}a = \frac{{{d_1}{{\left\| {{{\vec n}_2}} \right\|}^2} – {d_2}{{\vec n}_1} \cdot {{\vec n}_2}}}{{{{\left( {{{\vec n}_1} \cdot {{\vec n}_2}} \right)}^2} – {{\left\| {{{\vec n}_1}} \right\|}^2}{{\left\| {{{\vec n}_2}} \right\|}^2}}}\\b = \frac{{{d_2}{{\left\| {{{\vec n}_1}} \right\|}^2} – {d_1}{{\vec n}_1} \cdot {{\vec n}_2}}}{{{{\left( {{{\vec n}_1} \cdot {{\vec n}_2}} \right)}^2} – {{\left\| {{{\vec n}_1}} \right\|}^2}{{\left\| {{{\vec n}_2}} \right\|}^2}}}\end{array} \right. \tag{2.24}$

$\frac{{{d_1}}}{{\left\| {{{\vec n}_1}} \right\|}} = \frac{{{d_2}}}{{\left\| {{{\vec n}_2}} \right\|}}$

${d_1}^2 \cdot {\left\| {{{\vec n}_2}} \right\|^2} = {d_2}^2 \cdot {\left\| {{{\vec n}_1}} \right\|^2} \tag{2.25}$

return ({PARALLEL, OVERLAPPING, INTERSECTING })
1.    $$x = {\left\| {{{\vec n}_1}} \right\|^2},y = {\left\| {{{\vec n}_2}} \right\|^2},z = {\vec n_1} \cdot {\vec n_2}$$;
2.    $$den = {z^2} – x * y$$;
3.    if $$den = = 0$$, then
4.           $$delta = {d_1}^2 * y – {d_2}^2 * x$$;
5.           if $$delta = = 0$$, then
6.                  return OVERLAPPING;
7.           else
8.                  return PARALLEL;
9.           end if;
10.   else
11.          $$c = {\vec n_1} \cdot {\vec n_2}$$;
12.          $$a = \left( {{d_1} * y – {d_2} * z} \right)/den$$;
13.          $$b = \left( {{d_2} * x – {d_1} * z} \right)/den$$;
14.          $$Y = a{\vec n_1} + b{\vec n_2}$$;
15.          $$\vec d = {\vec n_1} \times {\vec n_2}$$;
16.          两个平面的相交直线表示为$$L(t) = Y + t\vec d$$;
17.          return INTERSECTING;
18.   end if;