Dot Product & Normalize

September 25, 2018

These are two of the most used functions in Computer Graphics, and quite a lot of the time, the underlying process of how it works, is ignored.

Normalizing a vector is essential for a variety of reasons, and below is the long way around to do it, as opposed to the normalize VOP.


We need to find the length of the Vector, as this will be used as the divisor for the x,y,z components of the Vector to be normalized. This is done by taking the x,y,z components and taking each to ^2 power. Then we add those values together and find the square root. Now we have the length of the Vector, and  can use it as the divisor. Voila!

Now it’s time to do the Dot Product! Mysterious I know. But very handy in shading/lighting and other areas of Computer Graphics. The Dot Product is the Cosine of two normalized vectors. Cosine being the trig function equal to the ratio of the side adjacent to an acute angle (in a right-angled triangle) to the hypotenuse. That’s pretty neat!

Below is a quick animation of the Cosine around a unit circle. The unit circle being a radius of 1 of course. The Dot product of two normalized vectors, which we will see is just multiplying their components and adding them together, creates a trigonometric function.

Here is the long way of doing it, instead of using the dot product VOP.


First we normalize both Vectors. Then we split the x,y,z components of each vector and multiply them. Adding the results of this all together. Bingo! Very Simple really isn’t it. Additionally, using a trig VOP to use arc cosine along with a radians to degrees, will give you the actual angle between those two vectors.