first question on SO although I've been here many times through Google. I have read quite a lot on the topic of using quaternions to represent rotation as well as finding people who have similar problems. I have yet to find a good solution, or one that I could understand.. so I'm giving a shot at asking a clear enough question to generate solid answers.
I am currently using a quaternion (specifically, a Qt 4.7 quaternion/C++) to represent the orientation of my camera. At each step of the program I check for mouse movement and do a fromAxisAndAngle(xaxis, x_mouse_movement) and fromAxisAndAngle(yaxis, y_mouse_movement). I take these two quaternions and multiply them (yaxis * xaxis). For the initialization I have a unit quaternion (w,x,y,z -> 1,0,0,0) to multiply with. I keep accumulating the rotation over these fromAxisAndAngle multiplications with the current orientation. This produces a roll, known as the Lie Group Problem (I think) that if you apply pitch and yaw continuously you can generate a pure roll, and this is what I have in my current implementation (which is correct for my procedure as far as I can tell).
I have implemented another method where pitch,yaw,roll are incremented and the quaternion is built fromAxisAndAngle from scratch each time from these values. This produces a correct FPS style camera, but it suffers from gimbal lock. My goal is to keep the pure quaternion representation, while eliminating (or compensating for) the rolling effect produced from only pitches and yaws so I can use this general 6DOF camera as an FPS camera or a space ship style camera. I'm looking for suggestions (specific routines) for correcting this roll, or an alternative representation that can fit my needs. Sorry for the wall of text, but I wanted to be very clear. Thanks for your time and happy hacking!