Problems using the VTK camera function elevation

I have to implement some kind of flythrough via VTK (through a skull for example) and keyboard navigation.

My idea is to manipulate my camera so that i can move arround the object. In VTK you can manipulate the camera with functions like Azimuth, Elevation, Roll and so on.

Every function works fine and does what it is supposed to do except the Elevation function. This one is supposed to move my camera up or down arround the focal point. That’s what it actually does until it reaches approximately 90 degrees in the up or down direction. As soon as it reaches the 90 degrees it kind of turns my object arround in a unlogical way. It’s hard to explain but it does not continue to elevate arround my focal point.

I’ve already looked how the function is implemented but i can’t realy find a reason why it behaves like that.

Does anyone have an idea what possibly causes this problem?

The ViewUp vector is probably not being modified when you change the elevation. To remedy that, invoke vtkCamera::OrthogonalizeViewUp() after invoking the Elevation function.

I’m sorry - is this a question, or are you demonstrating that it worked?

You could keep a running sum of the ryf arguments passed in to calls to Elevation() and not invoke Elevation() if you are outside [-90, 90].

@cory.quammen I’m also facing same issue. What if I want to programmatically rotate camera beyond -90 & +90 along x-axis which elevate() function does.

Try calling the above after the Elevation() function.

1 Like

Thanks @cory.quammen . I tried that from your previous comments and it’s working as expected. Wanted to know if it’s some kind of fix or the elevation function works that way only. In other words, this function call is not required for azimuth or roll but needed for elevation. Any specific reason for that ?

Azimuth rotates about the up vector, so it doesn’t need to be updated.

Roll explicitly updates the up vector since it is key to how the roll is defined.

Elevation probably should update the up vector - it can get away without doing it in a lot of cases, which is probably why no one ever added updating the up vector to it.

Thanks for your quick and descriptive response :slightly_smiling_face: