The dot product is concerned with vectors. Its most common application in graphics is to determine the angle between two vectors.
So what is the dot product?
Suppose we have two vectors V1(x1,y1,z1) and V2(x2,y2,z2). The dot product of these two vectors is defined as:
The dot product is ALSO equal to:
Where A is the angle between the vectors. This gives it a very useful property because now, by re-arranging the formula we can find the cos(A) of the angle between two vectors and, using acos we can then find angle A.
And, recall from the discussion of vectors above that the length of a vector is calculated by the pythagorean theorem:
Since the cos(A) of an angle is positive between 0 and 90 degrees and is negative between 90 degrees and 180 degrees, by testing the sign of the resulting cos(A) we can tell if the angle A is greater or less than 90 degrees. This has an immediate application. Suppose you were rendering a 3-D cube and you wanted to know which surfaces on the cube were visible to the viewer. You know the angle that the viewer is from the screen (so you know one vector) and if you knew the angle of a line perpendicular to the surface (you would have the second vector) then using the dot product, you could calculate if the angle between these vectors was greater than or less than 90 degrees. If it is less than 90 degrees, the viewer can see the surface. If it is greater than 90 degrees then it is turned away from the viewer. See the diagram below.

The question then becomes, how do we calculate the normal to a surface. We introduce this in the next section on cross products.
