[vtkusers] Distance from eye to viewplane

David Gobbi david.gobbi at gmail.com
Fri Dec 17 18:30:09 EST 2010


2010/12/17 Vinicius Rogério Araujo Silva <vinicius.ras at gmail.com>

> 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?
>

As far as I know, any plane that is parallel to the near or
far clipping planes can be considered a "view plane".  But since you need to
know the distance, you have to choose one specific plane: usually the near
plane, the far plane, or the focal plane.

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.
>

You lost me here.  First you say that the user chooses R and H, and then you
say that R will be calculated.


> 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.
>

The viewplane that you choose should be the plane at the base of your cone.
 I'm guessing that your cone has its tip at the camera position, and has its
base either at the far clipping plane or at some position in between the
near and far clipping plane.  Wherever its base is, I'm guessing that you
should use that position as your view plane.  So the distance to the view
plane is H, i.e. whatever you choose as the height of the cone.  I might be
misunderstanding, though.

  David



>
> 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/a3f51c57/attachment.htm>


More information about the vtkusers mailing list