2D matrix help?

Miscellaneous Forums/General Discussion/2D matrix help?

Well, my first question is whether I need to use matrices or not: I have a load of 2D vectors I want to rotate and/or scale. Should I do this using plain trig or use matrices?

Can someone help me to understand how to use matrices to do 2D transformations, please? Or, point me to a decent tutorial for dummies than explains things without resorting to too much mathsy symbols, etc.?

Basically I need to know:

- How to set up matrices to do rotation and/or scaling i.e. what values I need to place in each element.

- How to combine a scaling matrix and a rotation matrix in order to perform both transformations in one go (this can be done, right?).

- How to perform the transformation on a given vector (i.e. what order I need to multiply/add the vector components with the matrix elements).

Thanks in advance.

Nevermind. It looks like matrices are going to be way slower than using plain trig, for this.

Sorry big10p, I thought I had responded on this a couple of days ago using info from Beginning Math and Physics for Game Programmers .
Unfortunately, I don't know it off my head but if you want me to get the info I'll try later.

No worries.

It looks like matrices are going to be overkill for my needs, but it would still be interesting to know more about this stuff, if you can post some info. If it's going to be hassle, don't worry about it, though. :)

It seemed quite straightforward.
For a 2D you still need a 3*3 matrix.
Your vector matrix would be
x
y
1
while your scale matrix would be
Xscale 0 0
0 YScale 0
0 0 1
Your transformation scale would be similar but with
horrid messes of cosAngle and sinangle in different 'cells'.
There is also a more straightforward translation matrix.
You can multiply all the matrices together to make a single transformation matrix.
You then multiply this to your 2D vector.

You might want to check this site out : http://dbfinteractive.com/index.php they have a lot of people coding software renders, and there are even a good handful of complete demos with source to dig into. They also have plenty of people who would be happy to explain everything.