Game Creation with XNA/Mathematics Physics/Vectors and Matrices

From Wikibooks, open books for an open world
< Game Creation with XNA
Jump to: navigation, search

Vectors and Matrices[edit]

We need to recall some basic facts about vector and matrix algebra, especially when trying to develop 3D games. A nice introduction with XNA examples can be found in the book by Cawood and McGee. [1]

A right triangle showing the relation between opposite, adjacent and hypotenuse.

Right Triangle[edit]

Once upon a time there was little Hypotenuse. He had two cousins: the Opposite and his sister the Adjacent. Both were usually just known by their nick names 'Sine'[2] and 'Cosine'[3]. They lived together in a right triangle close to the woods. They were related through his mother's sister, aunty Alpha. His father, who was a mathematician, used to say that:

\sin \alpha = \frac {\textrm{opposite}} {\textrm{hypotenuse}} = \frac {a} {h}
\cos \alpha = \frac {\textrm{adjacent}} {\textrm{hypotenuse}} = \frac {b} {h}.

Sometimes he also referred to uncle Tangent (who was married to aunty Alpha) and said that

\tan \alpha = \frac {\textrm{opposite}} {\textrm{adjacent}} = \frac {a} {b},

so in a sense uncle Tangent of aunty Alpha was Sine divided by Cosine. To us that didn't make any sense, but Hypotenuse's father said that was how it always was.




  1. S. Cawood and P. McGee (2009). Microsoft XNA Game Studio Creator’s Guide. McGraw-Hill.
  2. Wikipedia:Sine
  3. Wikipedia:Cosine