Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I always struggle with intuitively figuring out the order of subtraction in multiple situations for example

The difference between the current mouse coordinates and the last frame's coordinates

The direction an object is to the camera position


I know that A - B = A + (-B) problem is figuring out which one is A and which one is B ..and those were just simple examples

Is there any hard and fast rules for this? Or is it supposed to be intuitive and obvious (which is what I'm afraid of)?

I have similar problems with figuring out which order to take the cross-product of two vectors too, depending on the scenario

share|improve this question
up vote 1 down vote accepted

Draw it all out on paper. Do it in 1D (ie. a number line), then do it in 2D (ie. a square grid).

Draw point B for the current mouse position, then point A for the previous position. B-A gets you the total change in 1D or 2D or 3D and why is very easy to see on the 1D number line.

Stop calling the points A and B until later, try calling them Now and Then. If you take Now minus Then you get what happened between Now and Then.

As for cross products keep in mind that positive rotation is counter-clockwise. So if you have 2D vectors drawn out on paper with points ABC if you look at it and BA is counter-clockwise to BC then the cross result will be up out of the paper towards your face.

If you hold your right hand out, index straight out, next finger turned left and thumbs up that shows the "right hand rule" for what side is what in 3D and it describes visually what you just drew in 2D.

share|improve this answer
The last paragraph is why some math and physics exams can be hilarious to watch. Particularly if magnetic fields are involved :) – Anton Jul 14 '12 at 21:31

The cross product is fairly simple. You just use the right hand rule, where your 4 fingers make the notion of going from the first vector to the second and the thumb points in the direction the product vector will be pointing.

As for vector subtracting, let's say you have two points. Then if you subtract point A from point B (it doesn't actually make sense from the stand point of mathematics, but you represent vectors like you do points, where the tail is at the origin and the head is at the given point) then you'll get a vector going from point A to point B. These things are easiest to visualize if you only account for the first quarter of the coordinate system (the x and y axii are positive). Same for vectors, if you have two vectors a and b, then subtracting a from b will result in a vector going from the tip of a to the tip of b.

share|improve this answer

For vector subtraction, I use the mental image of drawing a bow. If I'm subtracting A - B, I visualize holding up a bow with the arrow point at A, then drawing it back till the tail of the arrow is at B. The arrow is the result of subtraction, a vector pointing from B to A.

For cross products, dreta's and Patrick's answers already described the two most common methods.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.