VTKCamera Elevation and Azimuth angle query

Hello,

I have a python VTK script that does some rendering using VTK. I want to query the elevation and azimuth angles of the current view. I am trying to find APIs to do that and could not find any. I see the Elevation() and Azimuth() functions for the camera class that allows us to set those values. I am trying to query those. Any help/suggestion will be very useful.

Thanks,
Soumya

The angles are used to directly calculate the transform matrix used by the camera class so they are not stored. It is not a simple thing to do, you can always get the transform matrix and possiblly try something like mentioned here How to extract euler angles from transformation matrix?. However gimbal lock is an issue here so you may want to look at Quaternions and spatial rotation as a starting point.

Hi Andrew,
Thank you for your information! I also want to calculate the the Elevation angle, so which transform matrix are you referring to? I see there are ModelViewTransformMatrix, ViewTransformMatrix, ExplicitProjectionTransformMatrix, ProjectionTransformMatrix, etc, in vtkCamera class. Thank you for your help!

I don’t really know. However Elevation and Azimuth need the the focal point, view up etc., aside from the rotations there are translations involved so they are not intrinsic to the camera like Roll so I doubt that you will be able to ever recover them from the transform matrices.