Collapsing a Seq of Translations/Quatern Rotations

I’m working on an application which utilizes quaternion rotations based on the “virtual trackball” interface, as well as translations/pans which are always parallel to the view plane/screen. When the application starts, the camera is placed at (0, 0, 10), and looks at (0, 0, 0). The center of rotation is always 10 units in front of the camera. The scene rotates according to the virtual trackball UI model.

Because of these requirements, the sequence of translations and rotations is not commutative. The sequence T1,R1,T2,R2,T3 is not the same as T3,R2,T2,R1,T1.

As the user keeps translating and rotating, I could conceivably build a list of translation/rotation operations that I execute in sequence each time the display is updated, but that becomes unwieldly very fast.

What I’d like to do is “collapse” a sequence of translations and rotations to a single translation followed by a single rotation.

Any recommendations/suggestions? I’m probably overthinking things, but it wouldn’t be the first time.

Thanks in advance!

From what I’ve been reading, it looks like I should make use of a 4x4 affine transformation matrix. Am I on the right track?

you can of cause collapes a sequence of transforms into two matrices describing the position and orientation of an object respectively. for example :

v’ = T * R * v;
or
v’ = t + R * v;

where
T - translation matrix
R - rotation matrix
v - local vector
v’- world vector
t - translation vector

//------------------------------
if you want to add T2(or t2)operation to this object, the result is :

v’ = T2 * T * R * v = ( T2 * T ) * R * v;
or
v’ = t2 + t + R * v = ( t2 + t ) + R * v;

then the new T and R are :

T’ = T2 * T; or t’ = t2 + t;
R’ = R;

//-------------------------------
if you want to add R2 operation to this object, the result is :

v’ = R2 * T * R * v;
or
v’ = R2 * ( t + R * v )
= ( R2 * t ) + ( R2 * R ) * v;

then the new T and R are :

t’ = R2 * t; ( not T’ = R2 * T )
R’ = R2 * R;

4x4 affine matrix will also work well.