I just have one question wich give me some probs!
I will be happy (very) if someone can give me some help ;-).
When i use a glMultMatrix which contein rotation information and translation
information am i right if i think openGL apply first the translation then
the rotation?
I have a matrix that is the local reference of an objet (with rotation an
translation) in the global reference.
Now, i want to appli the inverted matrix to represent the global land in the
local reference of the objets. But that doesn't work nice.
To make the inverted matrix i juste do as:
Original matrix for the object
m1 m5 m9 m13
m2 m6 m10 m14
m3 m7 m11 m15
m4 m8 m12 m16
Inverted matrix
m1 m2 m3 -m13
m5 m6 m7 -m14
m9 m10 m11 -m15
m4 m8 m12 m16
Is this correct??
are my probleme in the translate/rotation combinaison of my inverted matrix
(the first question up )? Must i invert this (spleet my inverted matrix in
two matrix to correct)??
Thanks all, even if you dont understand a word of my post (I promise i will
learn much more my english) ;-).
For ur first question about glMultMatrix(). glMultMatrix() doesn't no how ur
matrix was created, so it doesn't matter or care whether the translation is
performed b4 the rotation, it just multiplies Matrix with the current
matrix.
eg.
m = rotation(theta) * translation(x, y, z);
glMultMatrix(m); // this will do rotation before translation
or
m = translation(x, y, z) * rotation(theta);
glMultMatrix(m); // this will do translation b4 rotation
If u want 2 invert a matrix then read up on Gausian Elimination or LU
decomposition algorithms. The basic idea of matrix inversion is that if u
mulitply a matrix with its inverse u should get an identity matrix (one
filled with zeros and 1's along diagonal from top-left to bottom-right).
"olivier fourcade" <fourcade...@wanadoo.fr> wrote in message
news:b9ua9b$mne$1...@news-reader11.wanadoo.fr...
Yau Goh Chow wrote:
> Nope ur matrix inversion is incorrect. The is more to just negating and
> swapping numbers when inverting a matrix.
>
> If u want 2 invert a matrix then read up on Gausian Elimination or LU
> decomposition algorithms. The basic idea of matrix inversion is that if u
> mulitply a matrix with its inverse u should get an identity matrix (one
> filled with zeros and 1's along diagonal from top-left to bottom-right).
If your matrix consists only of rotations and translations, that is your
matrix is of the form
|M|T|
|-|-|
|0|1|
where M is a 3x3 matrix and T is the translation vector, the inverse is
given as
|N|-NT|
|-|---|
|0| 1 |
where N is M transposed.
If you add scaling to your matrix aswell, N is the inverse of M instead.
Anders
Thank you for your answers. I will try that (better than mine)
Olivier