PDA

View Full Version : Matrice Transformations

Cairn
05-10-2010, 07:29 PM
Hey I've been using OpenGL for a little while now and even though i know how to use matrices i don't fully understand them I understand how translations and scaling works but how does sheering shift individual vertices does it shift above an axis or what Ive spent hours looking for a solution and i just cant seem to find one and another question is when multiplying a matrix with MultMatrix(Matrix) does it multiply against a 4x4 matrices or one like this
[ x ]
[ y ]
[ z ]
[ w ]

and if i don't know the slightest about what I'm talking about please put me on the right track.

Rosario Leonardi
05-11-2010, 01:23 AM
Let's make it simple and let's try with a 2x2 example.
If you have a shearing matrix like that

| 1 a | |x|
| 0 1 | * |y|
the final point became
x' = x + a*y
y' = y
The shearing matrix move a vertex on a axis in a proportional way to another axis.

| 1 0 0 0 | |x|
| 0 1 a 0 | * |y|
| 0 0 1 0 | * |z|
| 0 0 0 1 | * |w|
In this 4x4 matrix the y change proportional to the z (if a is not zero), all the other variable are unchanged.
x' = x
y' = y+a*z
z' = z
w' = w

Cairn
05-11-2010, 12:00 PM
But does that apply to all vertices and if it does doesnt it just shift all the vertices up(or down) or does that shift an individual vertice.

ZbuffeR
05-11-2010, 02:03 PM
y' = y+a*z

Well it will shift "a times z" the y component of each vertex.
So vertices with higher z will shift more. That is all.

Cairn
05-11-2010, 02:19 PM
ooooohhhhhhhhhhhhh!!!

yes thank you.
thank you
it just popped oh yes you dont know how happy youve made me.
you just made my day thanks again.