[vtkusers] problems with setting camera distance
Bill Lorensen
bill.lorensen at gmail.com
Mon Jan 25 11:36:34 EST 2010
Dolly moves the position of the camera towards the focal point (> 1)
or away < 1.
For example a dolly of 1.1 moves the position about 10% towards the
focal point. .9 about 10% away
If you look at the Dolly code in vtkCamera.cxx you'll see that the new
distance = old distance / dolly.
So a Dolly of -30 really does not make sense. It would set the new
distance to be distance/(-30).
This really is not clear from the documentation.
On Mon, Jan 25, 2010 at 11:23 AM, Liam Kurmos
<quantum.leaf at googlemail.com> wrote:
> Hi,
>
> I'm still getting to grips with vtk. Building up a picture of how to
> use it from the books and examples.
>
> I have a vtkImageData which I initialise with gaussian data, and
> render a contour taken with marching cubes. I've been using
> vtkCamera.Azimuth() and vtkCamera.Elevevation() to control the viewing
> angle.
>
> Now i want to control the distance from the focal point. From the
> doxygen i thought this would be simple using setDistance/Dolly but i
> can't get it to work as expected.
>
> I've been experimenting with code like:
>
> ren1->AddActor(contourActor);
> vtkCamera* cam1=vtkCamera::New();
> cam1->SetFocalPoint(0,0,0);
> cam1->SetDistance(10);
> cam1->Dolly(-30);
> ren1->SetActiveCamera(cam1);
> //ren1->ResetCamera();
> cam1->SetDistance(10);
> //ren1->GetActiveCamera()->Dolly(200);
> cout<<"dist is "<<ren1->GetActiveCamera()->GetDistance()<<endl;
>
>
> I find that SetDistance changes the value report by GetDistance, but
> not what is rendered on the screen. Doing a negative Dolly has no
> effect, Doing a positive dolly affect the reported distance but not
> what is rendered on the screen. Doing a ResetCamera() affects the
> reported distance and changes what is rendered on the screen.
>
> I've started using SetPosition() and this seems to work as i would expect.
>
> Is VtkCamera::setDistance() broken, or am I using it incorrectly?
>
> regards,
>
> Liam
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list