Quick Explanation of Vectors
What are vectors?
Vectors are quantities which have magnitude and direction. Euclidean Vectors, the common computed type, are essentially right angled triangles which each have a hypotenuse, opposite and adjacent. They are represented with x and y components (and z in 3D space). Let's take an example V(3, 4). Looks like any old geometric point right? That's true however, hidden inside that is direction.

From the above diagram we can see a triangle forming. We can also see that the adjacent i.e. x component is 3 and the opposite i.e. the y component is 4. This is how vectors should be viewed and not as points (which is how I originally interpreted them). From that triangle we can deduce the magnitude and direction of V.
The magnitude or hypotenuse is gotten by Pythagoras which everyone should know to be:
(adjacent)^2 + (opposite)^2 = (hypotenuse)^2
And by heaping the square to the other side, we get the hypotenuse:
sqrt((adjacent)^2 + (opposite)^2)) = hypotenuse Sqrt(3^2 + 4^2) = hypotenuse Sqrt(25) = hypotenuse 5 = hypotenuse = magnitude

The direction of the vector is the slope of the hypotenuse which can be gotten using tan:
tan(angle) = opposite/adjacent tan(angle) = 4/3 Angle = tan^-1(4/3) .. Tan inverse Angle = 53 degrees
Why is any of this important?
Vectors can represent acceleration, velocity and displacement and any sort of force, which is essential to any physics orientated game. It allows for you to calculate paths, trajectories and basically all aspects of physics within code (maybe a slight exaggeration). Hopefully this short explanation may help your understanding of vectors. Forgive the poor diagrams, Omnigraffle on the iPad is good but not perfect.






Cartoon Clouds
Mountains
Sunrise
Clouds
Green Clouds
None























Help