[vtkusers] How can I reset the carmera

Christian Lackas lackas at invicro.com
Mon Dec 12 09:05:28 EST 2011


* David Doria <daviddoria at gmail.com> [111212 13:31]:

Hi David, et at.,

> 2011/12/12 455535440 <455535440 at qq.com>:
> > hello everyone:
> >   I got an actor rendered on the vtkRenderer, Then I use the Interactor move
> > and rotate the actor, but after that I want to make the actor undo all the
> > action so that the actor should look like it first display.
> You could use vtkCamera * vtkRenderer::GetActiveCamera () before the
> interaction to get the camera and then SetActiveCamera(vtkCamera*) to
> set it back when you want to reset. You could also get the matrix of
> the camera (GetModelTransformMatrix) and then set the matrix of the
> camera when you want to reset (SetModelTransformMatrix (vtkMatrix4x4
> *matrix)).

I looked into this a couple of days ago also, in an effort to be able to
write the camera settings to a file. Unfortunately, I found that in
order to serialize the camera I had to store quite a few parameters
(e.g. position, focal point, view up, clipping range, window center,
view angle, parallel projection, parallel scale, ...).

Fortunately, Google found this document for me:

    http://www.vtkedge.org/doc/nightly/html/classvtkKWERenderingSerializationHelper.html

which described the procedure (in the implementation part, so had to
check-out VTKEdge).

> (Actually I'm not sure the difference between the
> vtkCamera::Get*Matrix functions - the documentation should be improved
> here).

Fully agree here. None of the matrix based options seem to actually
contain the state of the camera, and that there were so many options
just made it much harder to use a trial-and-error approach.

Christian

-- 
Dr. Christian Lackas, Managing Partner
inviCRO, LLC -- In Imaging Yours
http://www.invicro.com/ http://www.spect-ct.com/ http://www.vivoquant.com/



More information about the vtkusers mailing list