VectorDot
Returns the dot product of two vectors. This product is the cosine of the angle between the vectors
multiplied by the lengths of both vectors. The dot product is useful for finding the cosine of the angle
between two normalized vectors. This gives you -x to x scale of how similar the vectors are. Syntax:
dot_product=VectorDot(vector1, vector2);
The Math
dot_product=cosθ * |v1| * |v2|
Where θ is the angle between the vectors.
And |v1| is the length of vector1.
And |v2| is the length of vector2.
Geometrical Application
The picture is on the 2d plane that the two vectors form. The dot product is -0.5. This is the result
of -0.5 * 1 * 1. The cosine is negative because the angle ends in the second quadrant.
Note that vector1 is placed on the positive x line, and the direction of vector2 is used to end the angle.