I need to control the transformation matrix with extern calculations.I have a problem to reconstitute the good transformations.
For the moment, I have a good representation while my view point is on the z axis.
But I certainly have a bad transformation, because if my point of vue takes some x or y coordinates, my object (a molecule) is badly placed.
I need to know exactly the whole steps of the transformation matrix.
Does anybody here could tell me how to reconstitute correctly the whole transformation ?
Could you explain what you’re trying to achieve, and why ordinary opengl transformations won’t fit ? And, if it’s only a problem with the point of view, have you tried gluLookAt ?
Now, if you really want to do your own matrix calculations, here’s the matrix for a translation by vector (x, y, z) :
1 0 0 x
0 1 0 y
0 0 1 z
0 0 0 1
for a rotation by angle a around vector e = xe, ye, ze), it’s a bit more tough. first find two vectors f, g orthogonal to e such that B=(e, f, g) is a basis of the space. In this basis, the matrix of your rotation is M=
1 0 0 0
0 (cos a) (-sin a) 0
0 (sin a) (cos a) 0
0 0 0 1
Now let P be the (3x3) base-change matrix :
xe xf xg
ye yf yg
ze zf zg
Compute the inverse P^-1 of P. Then the matrix of your rotation in the ordinary basis is simply:
P * M * P^-1
Hope this helps
Explain the problem fully, then hope u will get the result u want from here.
bye & good luck
The GLT OpenGL C++ Toolkit includes
a 4x4 matrix class:
A class like this would probably useful
for what you’re talking about.