Quaternions and camera rotation
#2
You can convert any rotation to euler angles with using the Ab3d.Utilities.CameraUtils.CalculateCameraAngles:

Code:
public static void CalculateCameraAngles(Vector3D lookDirection, Vector3D upDirection, out double heading, out double attitude, out double bank)

The methods takes lookDirection and upDirection as parameters. You can define them with setting lookDirection  to (0,0,-1) and upDirection  to (0,1,0) and then rotate those two vectors by your quaternion. Then pass the vectors to the method and get the euler angles back.


What might also work is to set the camera's Heading, Attitude and Bank to 0. Then add your quaternion rotation to the Viewport3D's Camera:


Code:
viewport3D.Camera.Transform = new RotateTransform3D(quaternionRotation3D);

This way you will add additional transformation to the camera.
Note that this option is not tested and may have some unexpected results. I would recommend using the first method.
Andrej Benedik
  


Messages In This Thread
Quaternions and camera rotation - by tim.rutter - 09-28-2017, 08:40 AM
RE: Quaternions and camera rotation - by abenedik - 09-28-2017, 09:35 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)