I have some code that rotates an object around an axis. It does this by creating a quaternion for a rotation and then multiplying by the old orientation:
nextRot = QuaternionRotationAxis( axis, rotSpeed * elapsed )
newOrient = QuaternionMul( oldOrient, nextRot )
This need to create the rotation quaternion each time seems like it may be redundant. Is it possible to somehow create a quaternion and somehow apply elapsed
to it? That is I would prefer code like this:
nextRot = SomeOp( fullRotationQuat, elapsed )
In this way I can store fullRotationQuat
in my object and simply apply it partially on each time step.
I know that if I apply nextRot
twice, it would be like doulbing the ellapsed time. So I'm guessing I might want some kind of quaternion exponentation. Is this a define op? More importantly, is its performance still acceptable (or faster) than creating from an axis/angle each time?