#### 22.10.1 AABB

Assume we have an AABB, B, defined by a center point, $\mathbf{c}$ , and a positive half diagonal vector, $\mathbf{h}$ . Note that $\mathbf{c}$ and $\mathbf{h}$ can easily be derived from the minimum and maximum corners, ${\mathbf{b}}^{min}$ and ${\mathbf{b}}^{max}$ of B, that is, $\mathbf{c}=({\mathbf{b}}^{max}+{\mathbf{b}}^{min})/2$ , and $\mathbf{h}=({\mathbf{b}}^{max}-{\mathbf{b}}^{min})/2$ .

Now, we want to test B against a plane $\mathbf{n}\xb7\mathbf{x}+d=0$ . There is a surprisingly fast way of performing this test. The idea is to compute the “extent,” here denoted e, of the box when projected onto the plane normal, $\mathbf{n}$ . In theory, this can be done by projecting all the eight different half diagonals of the box onto the normal, and picking the longest one. In practice, however, this can be implemented rapidly as

(22.18) ...

Get *Real-Time Rendering, Fourth Edition, 4th Edition* now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.