A review of the vector and its operations
A vector is the most important element of any 3D renderer. Vectors are used to store the position, color, and texture coordinates for all vertices of all triangles we draw. In addition, we use vectors to define static camera parameters.
A vector can be seen as a mathematical object with two independent properties:
- A direction, from the start point to the end point
- A length, or magnitude
Let us recap some basics about vectors.
Representations of vectors
The usual representation is a simple arrow, starting somewhere in the coordinate system. All the vectors in Figure 6.1 represent the same vector, as they all have the same directions and lengths, even if they do not share the same start and end points:
Figure 6.1: Graphical representations of a 2D vector
For a better visualization, think of every vector starting at the origin of the coordinate system. The origin is the point in the coordinate...