# Compute the exterior dihedral angle between two hyperplanes

Let's say, in $$d$$-dimensional space, we have two hyperplanes: $$\mathbf{n_1}\cdot\mathbf{x}+b_1=0$$ and $$\mathbf{n_2}\cdot\mathbf{x}+b_2=0$$ respectively, and their normal directions satisfy $$\Vert\mathbf{n_1}\Vert=1$$ and $$\Vert\mathbf{n_2}\Vert=1$$. We define the exterior as the intersection of two positive hyperplane regions: $$\{\mathbf{x}\in\mathbb{R}^d\mid\mathbf{n_1}\cdot\mathbf{x}+b_1\ge 0 \;\text{and} \; \mathbf{n_2}\cdot\mathbf{x}+b_2\ge 0\}$$. We observe these two hyperplanes from the exterior, so the "exterior dihedral angle" could be <180°, =180°, or >180°. My question is how to determine the type of the angle?

The above figure illustrates the three types of "exterior dihedral angle" in 2D. We can of course observe their types in 2D by eyes only, but is there a computational method (e.g. an algorithm) to determinte their types in a general $$d$$-dimensional space?

I find an answer, it is surprisingly simple. Basic idea: we just sample two points respectively on each half-hyperplane, let's say, point $$P_1$$ and $$P_2$$, and we check if $$P_1$$ lies in the positive region of the second hyperplane, and if $$P_2$$ lies in the positive region of the first hyperplane, the other cases are invalid.