[vtkusers] Distance from eye to viewplane

David Gobbi david.gobbi at gmail.com
Fri Dec 17 00:02:08 EST 2010


2010/12/16 Vinicius Rogério Araujo Silva <vinicius.ras at gmail.com>:
> Hi all,
> I'm new to VTK and after spending some time searching, I've decided to join
> the mailing list to see if you guys can help solving my questions.
> It seems pretty simple, yet I just couldn't find a way to solve it.
> Question is:
> Is there any way to retrieve the distance between the eye of projection
> ("camera") and the view plane?
> Or is there any way I can retrieve the plane equation for the view plane?
> Any help is really apreciated. Thank you.

Camera->GetClippingRange() is probably what you want, it will return the
distance from the camera to the near and the far clipping planes.  You can
use Camera->GetViewPlaneNormal() to get the normal.

The renderer also has methods for doing coordinate conversion between
display coordinates (i.e. pixels at the view plane) and world coordinates
(i.e. 3D coordinates in the scene):

Renderer->SetDisplayPoint(x, y, z);  // use z = 0 for view plane
Renderer->DisplayToWorld();
double p[3];
Renderer->GetWorldPoint(p);

So you can, for instance, give the display coords for the four corners of
your window, and this will provide the 3D coords corresponding to the
corners of the view plane.  Display coords start from (0,0) in the lower
left corner of the window.

   David



More information about the vtkusers mailing list