A vector is a line that has direction. One way to decribe a vector would be to give the coordinates of its rear point and the coordinates of its front point. By subtracting the coordinates of the back from the front what we get is the difference between the coordinates or how much each coordinate xyz changes as the vector moves forward. This is the regular way to decribe vectors since it only needs 3 numbers rather than 6 to identify them. So,just as a point in space can be identified by three coordinates x,y,z so can a vector be identified by three coordinates which might be thought of as dx,dy,dz called its components.

Suppose you have a vector (3,4,5) and you double its components to get (6,8,10). The vector length is doubled.. which means it is moving twice as fast(or has twice as much of whatever is changing), but the DIRECTION remains the same. You can see that as long as you multiply all three of its components (x,y,z) by the same number, or divide by the same number, you will still be going in the same direction. The exception to this is a negative number will reverse the direction. So the MAGNITUDE (or change) depends on the values of the components. This clarifies the difference between the size of a vector and its direction. As long as the sizes of its components stay proportional to each other, the vector does not change direction. If, however, you change the size of one component, say you increase x but not y and z, then the direction of the vector is changed. This makes sense because it is equivalent to moving one of the points (back or front) in the vector's original end points in the x direction.


The important point here is that a vector in 3-D space is represented by three numbers that indicate the direction of the vector. These were derived from subtracting the coordinates for the back point from the coordinates of the front point of the line that represents that vector. The mathematical view of the coordinates of a point, which I have avoided discussing so far, is that these coordinates are a vector which has its back end at the origin (0,0,0) and its point at the (x,y,z) coordinates. That you can think of a point's coordinates as a vector will not make any significant difference in this context. Most of the time in graphics, it is the direction of the vector that is important rather than its size. In lighting calculations in openGL you have to know what the direction of the normal (perpendicular vector) of the surface being lighted is. But openGL wants you to send it a 'normalized' version of your vector which by convention is of unit length 1.

How do you normalize a vector to unit length 1? You have to divide each component of the vector by the length of that vector. How do you get the length of the vector? You get the length by pythagoras in 3-D. Here is the formula for the length of the vector:

length = sqrt( x*x + y*y + z*z)

and once you have the vector length, here is how you calculate the normalized vector:

normal_x = x / length

normal_y = y / length

normal_z = z / length

And thus the vector (x,y,z) has been 'normalized' to become (normal_x,normal_y,normal_z).

One word of caution here. The word 'normalized' is an unfortunate choice of language. This does not have anything directly to do with finding the normals to surfaces. It just 'adjusts' those normal vectors to a conventional form called the 'normalized' vector form of unit length one. A discussion of how to calculate the normal for a surface is in the section on cross products.

For a more detailed explanation of a normalized vector click here
normal counter clockwise (CCW) convention
return to table of contents