How do I get the camera rotation angles from the "eye"?


#1

I have a 3D scatterplot and would like to have an accompanying 2D plot of the same data, which can be brushed over. The 2D plot should be the projection of the data from the current viewpoint - the two plots should look almost identical. So basically, I need the 3D rotation matrix that takes the data to the current camera position. The camera eye, which I got by computing

plot_div._fullLayout.scene._scene.getCamera()

gives some 3D vector, but it’s not at all clear how to get the rotation angles.


How to get/change current scene/camera in 3D plot - inside Jupyter notebook (Python)
#2

Unfortunately, our internal scene object does not have a to-rotation-matrix method exposed.

It wouldn’t be too hard to write one up from the scene camera up, center and eye vectors.


#3

Thanks for the reply. I’d be willing to do that myself, but I don’t know what those vectors mean, geometrically. The rotation should be somewhere in eye but I can’t figure it out.


#4

This tutorial https://plot.ly/python/3d-camera-controls/ would be a good place to start.

Let me know if you have any questions.


#5

Etienne, is there a reliable way how to code a series of up, center, eye values that would result in a 360 rotation around the vertical central axis of a plot?