Possibly not the easiest CG question ever? Rotmat

mcan
Posts: 15
Joined: Tue Feb 03, 2009 10:04 am

Possibly not the easiest CG question ever? Rotmat

Post by mcan »

Hello, I took a CG-course at my university some years ago, so I did known the answer on this question but now I have forgotten it... Can someone please tell me how the rotation matrix worked.

Let's say we have a 2D system the we make a 3-dim rotation matrix, and we add a 1 in all our vectors to be able to calculate with them:

T = [r1 r2 tx, r3 r4 ty, s1 s2 sc] v = [x, y, 1]
r1 - r4 is the rotation cos -sin and so on, dx dy is translation in x and y.
But to my recollection s1, s2 were scew and sc where scale. However when I do the calculations:
T*v = [r1*x+r2*y+tx*1, r3*x+r4*y+ty*1, s1*x+s2*y+sc*1] = v2

So the translation works fine here, and also the rotation. But since this only is a 2d system didn't one just throw away the last element in the v2 vector? which is the one including the scew and the scale variable...

What am I missing?


(I write ',' for new line i.e:
T = [
r1 r2 tx
r3 r4 ty
s1 s2 sc
]


//Markus

PS. Placed it in this forum because it's a strictley mathematical problem
Hamstray
Posts: 15
Joined: Thu Jan 11, 2007 7:45 pm

Re: Possibly not the easiest CG question ever? Rotmat

Post by Hamstray »

norm the result by dividing by the last component (unless it's zero). it is generally easier to work with normed matrices which have sc = 1. the skew part sort of makes things difficult otherwise all your elements stay normed.

i for one like to distinguish between elements with the last component 0 (which are not affected by translation), which i think of as 'vectors' (since the space we are thinking in is 1 dimension less) and elements with the last component 1, which i think of as 'vertices' (so that 'vertex' - 'vertex' -> 'vector'). but i obviously haven't thought this through when you have a skew part.