[vtkusers] Distance from eye to viewplane

Vinicius Rogério Araujo Silva vinicius.ras at gmail.com
Fri Dec 17 17:59:26 EST 2010


Well, these conversion functions will help me a lot.
But I got a little confused about the viewplane now..

Can I consider the near clipping plane as the viewplane?
Are they the same thing?

I'll try to explain my problem a bit further.
I'm trying to implement a selection algorithm which involves a cone. The
user should be able to select points that lie inside of that "virtual cone".
Because of my application's requirements, the user should be able to provide
two things to the application: a radius R and an height H.
Then the application should then be able to calculate the cone in the
following way: the height of the cone will be given by H, and the radius
will be calculated as a value proportional to H, in such a way that if H
equals the distance from the camera to the viewplane, the radius of the
cone's base will be R.

That is why it is so important to me to find the distance from the camera to
the viewplane.
Also, I've tried using the near clipping plane as the "viewplane" of my
problem, but unfortunately it did not produce the results I've expected.

Em 17 de dezembro de 2010 02:02, David Gobbi <david.gobbi at gmail.com>escreveu:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101217/dc9a96d7/attachment.htm>


More information about the vtkusers mailing list