HTML and CSS Reference
In-Depth Information
Magnitude : 100
Direction : 180 degrees
You might say this is
Magnitude : -100
Direction : 180 degrees
But really it is
Magnitude : 100
Direction : 0 degrees
Figure 5-2. Negative velocity is really velocity in the opposite direction.
Note that vectors don't have any set position. Even in the case of velocity, the vector doesn't state where
something starts or where it ends; it just indicates how fast and in which direction the object is moving.
Thus, two vectors can be equal if they have the same direction and magnitude, even if they describe two
different objects in two different locations, as shown in Figure 5-3.
Figure 5-3. If vectors have the same magnitude and direction, they are the same. Position doesn't matter.
Velocity on one axis
First let's simplify things, by limiting velocity to a single axis: the x axis, or horizontal motion. That is, the
direction is zero degrees, due east, or from the left side of the screen to the right side of the screen—
however you want to look at it. The speed is just how many pixels it moves in that direction each frame.
Thus, if the velocity on the x axis is 1, the object will move 1 pixel each frame from left to right. This also
means that if the velocity is -1 on the x axis, it will move from right to left, 1 pixel each frame.
Already we are talking about a negative magnitude after you were just told there's no such thing.
Technically speaking, the velocity is actually 1 and the direction is 180 degrees. Similarly, a positive y
velocity is that speed at 90 degrees (straight down), and a negative y velocity is 270, or -90 degrees
(straight up). In practice, though, when you calculate component x, y velocities, they always come through
as positive and negative numbers, and you often see writing in this topic like, “The x velocity is -1.” So, if it
helps you, think of the minus sign as indicating “to the left” for x velocity or “up” for y velocity, rather than
meaning negative.
Throughout the topic, we use vx to stand for velocity on the x axis, and vy to mean velocity on the y axis.
Positive vx means to the right, and negative vx means to the left. Positive vy means down, and negative
vy means up.
 
Search WWH ::




Custom Search