I want to implement an interface that permits the rotation of an object with constrained angles.
For example I want to turn a 3D object around its x-axis, but I want to constrain the possible movements from 0 - 90 degrees.
Think of the object as a building, the user should not be able to ‘dive’ beneath the surface and see the the building from beneath.
I would implement like this:
- transform my node’s rotation quaternion (or -matrix) to Euler-angles
- check angles agains my constraints, adapt them if necessary
- transform the Euler angles to a matrix which I hand over to OpenGL
The task seems pretty common, so I guess there must be tools to perform that kind of calculation in PVRTools.
I was surprised, that I could not find any function of help in PVRTModelPOD, PVRTQuaternion or PVRTMatrix.
I could of course add my own QuaternionToEuler function, but somehow that just doesn’t seem to fit with the design of the SDK – which generally encapsulates this kind of functionality.
Also, the tools do not seem to provide an interface to the underlying quaternion.
I can only access rotations through functions like ‘void CPVRTModelPOD::GetRotationMatrix’, it seems.
Am I missing something in the tools?
Or am I just all wrong with my implementation pattern, overseeing some other, probably much simpler, solution?