If you want to do 6DOF movement using quaternions, do *not* use roll, pitch and yaw. You want to take the user's input and apply small incremental rotations along the three axes to the existing quaternion.
Does that make sense?
Hm... So say the user wants the ship to pitch down a little (relative to the ship's previous orientation, not global orientation). What confuses me is "apply rotations." I take that to mean:
1. Create a quaternion qPitch from an axis-angle value where the Axis = {1.0, 0.0, 0.0} and the Angle is, for example, 0.1
2. Multiply qPitch by m_Orientation, the current orientation of the ship, so m_Orientation = qPitch * m_Orientation
Does that sound right? That has been my intuition up until now, so I assume it's wrong, but I'm not quite sure in what way.
Also, because quaternion multiplications are noncommutative, I've been worried about extending this approach to all three possible axes at once, since the order in which I multiply them will determine the kind of result I get - although I want all rotations to be relative to local axes. It seems that any order I put them in will shortchange one of the axes or another.