Motion with Vectors

A vector can be used to represent the movement of an object.

In this case, the vector indicates the object's velocity - the direction of the vector is the direction that the object is moving, and the magnitude of the vector is the speed of the object.

This means that the vector corresponds to the amount that the object will move in one unit of time.
e.g., a velocity vector of (2, 0, 0) indicates that the object is moving 2 meters/second along the X axis (assuming our units are meters and seconds). If it starts at (3, 1, 0), then after 1 second its position will be (5, 1, 0). After 2 seconds, its position will be (7, 1, 0).
[Note that the choice of units is arbitrary, and is up to you when writing your programs; all that matters is that you be consistent within a program, and not, for instance, try to combine meters per second with miles per hour.]

In general, if an object starts at position P0, with velocity V, then after t time units, its position P(t) will be:

            P(t) = P0 + t * V

Example: motion.cpp



next