This chapter is from the book

Pythagorean Theorem

Many of the previous sections dealing with dot product and normalization rely on orthogonality. Orthogonality deals with the relation of two lines at right angles to one another. If you have a set of lines that are orthogonal—or perpendicular to one another—there is a powerful equation that allows you to calculate a lot of useful measures in graphics programming: the Pythagorean theorem.

The Pythagorean theorem enables you to find the shortest distance between orthogonal directions, as shown in Figure 4.5. It’s not really about right triangles; it’s about comparing “things” moving at right angles. When we looked at the dot product, we were looking at how combining two vectors would impact their growth in the x and y directions.

Even though our vectors and not triangles, per se, we can think of them as such for the purposes of being able to use the Pythagorean theorem. Additionally, the shape that we use for our meshes are triangles, which do fit within the Pythagorean theorem. This theorem is the basis for most of the vector operations that you will use to determine how vectors are affected by one another. It’s important to grasp that this seemingly simple formula is the key to unlocking much of the power of 3D graphics.