i,
thank you for your help. The last message made it more clear
to me.
y’’ = Mx’* y
=> | 1 0 0 | | 1 0 0 |
Mx = | 0 cos(a) -sin(a)| => Mx’(inverse…) = | 1 cos(a) sin(a) |
| 0 sin(a) cos(a)| | 1 -sin(a) cos(a) |
| 1 0 0 | |0| | 0 |
y’’ = | 1 cos(a) sin(a) | * |1| = | cos(a)|
| 1 -sin(a) cos(a) | |0| |-sin(a)|
Now we have the y_axis_turned (=y’’)
=>
glRotatef(angle_x, 1.0,0.0,0.0);
glRotatef(angl_y, 0, cos(M_PIangle_x/180), -sin(M_PIangle_x/180);
glCallList…
The interesting thing is that now I’ve calculated the rotated y axis
but then my x-axis rotates
=>
same result as
glRotatef(angl_y, 0.0, 1.0, 0.0);
glRotatef(angle_x, 1.0,0.0,0.0))
Ok now perhaps I’ve to calcluate the vector for my new x axis.
| cos(a) 0 -sin(a) |
My = | 0 1 0 | => My’(invers, transpon
| sin(a) 0 cos(a) |
| cos(a) 0 sin(a) |
My’ = | 0 1 0 |
|-sin(a) 0 cos(a) |
| cos(a) 0 sin(a) | |1| |cos(a) |
x’’ = | 0 1 0 |*|0|=| 0 |
|-sin(a) 0 cos(a) | |0| |-sin(a)|
But the next things doesn’t work
glRotatef(angle_y, 0.0, 1.0, 0.0);
glRotatef(angle_x, cos(M_PIangle_y/180),0.0,-sin(M_PIangle_y/180))
or
glRotatef(angl_y, 0, cos(M_PIangle_x/180), -sin(M_PIangle_x/180);
glRotatef(angle_x, cos(M_PIangle_y/180),0.0,-sin(M_PIangle_y/180));
doesn’t work.
What’s the problem?
Could you please help me with a code example. I’ve send you
some testprogramm files.
Bye
Roland
Originally posted by DFrey:
[b]In my example, Mx, Mx’, and My’’ are rotation matrices. Of those, you only need to calculate Mx’. And Mx’ != -Mx, rather Mx’ = transpose of Mx. (transpose since for rotation matrices it is equal to the inverse). And then at that, since you are only multiplying the Y unit vector by that inverse matrix, you really only need to calculate one column of the matrix.
in pseudoish code:
y_axis_turned=Vector(0,1,0).Rotate(-angle_x, Vector(1,0,0))
glrotate(angle_x, Vector(1,0,0))
glrotate(angle_y, y_axis_turned)
[This message has been edited by DFrey (edited 02-26-2002).][/b]