Game Development Dictionary
Dot Product (Scalar Product)
The dot product shouldn't cause you any trouble. It is simply a way to multiply vectors. Keep in mind that we would normally describe these vectors in unit vector notation.
Here is a typical representation of a dot product for vectors A and B:
A · B
Or we can describe the same equation in terms of vector components:
A · B = A.x * B.x + A.y * B.y + A.z * B.z
Using a Dot Product, we can obtain the angle between two vectors A and B as follows:
Cos q = (A · B) / (|A| · |B|)
q= arcCos ((A · B) / (|A| · |B|))
Okay, lets break down what just occurred above. What we are saying is that the cosine of theta is equal to the dot product of A and B divided by the product of A and B's magnitudes. The magnitude of a vector V is denoted by : |V|
One can calculate the magnitude of a vector simply by taking the square root of each term
in the vector squared. Ie.
|A| = sqrt (A.x * A.x + A.y * A.y + A.z * A.z)