1-4 Vector Basics
It is easier to place an object into a three-dimensional space if you first move the vertex coordinate to its starting position. Then in your game, you can apply changes to the objects such as translating, rotating, or scaling them -- all of which are easily accomplished by using vectors and matrices.
1-4-1 Vector
A scalar is a quantity that has only one magnitude on a specific scale such as length, time, or volume. A vector is a quantity that has both magnitude and a direction such as force or rate.
Figure 1-4-1 Scalar and Vector
The following shows a vector moving from point A to point B:

Figure 1-4-2 Vector
The direction of the arrow is the direction of its vector. A is called the initial point and B is called the terminal. This vector is expressed as
or
.
1-4-2 Vector Addition
Given two vectors,
and
, you can add them together to define a diagonal vector, which in turn specifies a parallelogram as shown here:

Figure 1-4-3 Vector Addition
The following shows how vector addition is done:


1-4-3 Vector Subtraction
To subtract vector
from vector
, invert vector
's direction first, and then add vector
to the inverted vector
to form the resulting vector
:

Figure 1-4-4 Vector Subtraction
The following shows how vector subtraction is done:


# Scalar Multiplication of a Vector
To find the product of a vector
and a scalar (k), multiply the length of vector
by k, but be careful to take the sign of the scalar into account:

Figure 1-4-5 The product of vector
and scalar (k) is multiplied vector
by (k)
The following shows how scalar multiplication of a vector is done:


1-4-4 Normal Vector
A vector that expresses the vertical direction of a surface is called a normal vector:

Figure 1-4-6 Normal Vector
To calculate the normal vector of a surface, you need to find what is called the cross-product of the two vectors that specify that surface. You can use the following step-by-step technique to calculate the cross-product of two vectors
and
:
, 
1. Arrange and write down the coordinates of each vector
and
as two lines like this:


2. Repeat each X coordinate of
and
on the far right end of each line like this:


3. Draw connecting lines like this:

4. Calculate Alpha, Beta, Gamma using these formulas:



Alpha is the coordinate of the result, Beta is the Y coordinate, and Gamma is the Z coordinate.
5. To obtain the cross-product of vectors
and
, use this formula:

Here is a second example that shows how to find the normal vector
of the plane defined by the three points
shown in this illustration:

Figure 1-4-7 Example of a normal vector
When working with the two vectors
and
, you must be very careful to factor in each vector's direction.

To get the cross-product of the vectors, apply these formulas:



Because
and
are vectors, specify each coordinate component like this:


Therefore, the final detailed formula for the normal vector N
is:



You need the cross-product for many geometric calculations, not just to calculate the normal vector.