0
101 Feb 07, 2004 at 05:44

Hi,
I have a system where we load objects into the scene. The following operations are allowed. All inputs are given using mouse.
1. rotate individual objs
2. translate individual objs
3. rotate the entire system about the origin
4. translate the entire system

To do this, I keep the following data

1. A quaternion (Q) for rotations on the entire system (opr.3)
2. A quaternion (qi) for each object (opr. 1)
3. Translation parameters (Tx,Ty,Tz) (opr.2 + opr. 4)
4. Center of each obj Cix,Ciy,Ciz

And I do the following in the display function

foreach object i
1. apply rotation using quaternion Q
2. translate using parameters Tx,Ty,Tz
3. rotate using quaternion qi
4. translate to center using Cix,Ciy,Ciz

this seems to work fine for some transformations, but after certain amount of rotation, I find that the objects move in opposite direction. Can some one tell me what is wrong with my method? I would be glad to an alternative method.

Thanks!

3 Replies

0
101 Feb 07, 2004 at 07:47

depending on you’re applying your transformations [i.e. keeping the rotated matrix] you could be applying what you may think is a controlled angle but REALISTICALLY you’re applying a rotation on an already rotated “world”.

if you could be a bit more descriptive on how you’re applying the rotations, that might help.

best regards
-berto :yes:

0
101 Feb 10, 2004 at 05:53

I found my mistake. I was unprojecting screen (window) co-ordinates to object co-ordinates to find the axis of rotation for individial objects. But this axis has to be mapped to the global co-ordinate system by appling the inverse rotation matrix. This new axis should be used to compute the quaternion for individual objects. Same theory applies to any translations done to the objects.

0
101 Feb 10, 2004 at 06:18

good job! and thanks for reporting your findings - it’ll serve as a reminder to pay attention to the stuff we may overlook by mistake.

good luck

:yes: