[vtkusers] Correctly apply camera matrix

andyjk andrewkeeling at hotmail.com
Mon Apr 8 06:07:03 EDT 2019


I would like to do something similar to the above - ie save the view of the
camera (based on user manipulation) then be able to re-apply the 4x4
extrinsic camera matrix elsewhere.

I know that I can save the View Up, ViewPlaneNormal, Position etc and that
these correctly represent the current camera position.

However, how can I then transform these into an R|T camera matrix, such that
R|T [wx wy wz] brings the world coordinates (wx,wy,wz) into the camera
coordinate frame ?

It certainly seems that vtkCamera->GetModelTransformMatrix() is bugged and
doesn't work, because the upper 3x3 is not orthogonal and so is not a
rotation matrix.

I could set up columns 2 and 3 of the R|T matrix using ViewUp and
ViewPlaneNormal, but if I just calculate the cross-product for filling in
column 1, I presumably risk 'x' facing the wrong way ?
Also, I am fairly sure that T of R|T is not simply vtkCamera->GetPosition()
(as it is the inverse transform?) so I'm not sure how to populate column 4
of R|T.

Am I misunderstanding vtkCamera->GetModelTransformMatrix() ? I was hoping
this is what it is for ?

Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html

More information about the vtkusers mailing list