[vtkusers] Perhaps a stupid question about vtkCamera class
jsl
jsantam.gm at gmail.com
Sun Aug 5 07:38:47 EDT 2007
Hi all,
I need to put the following camera's parameters (perspective projection
model):
Viewplane at Z = 0
Eyepoint or center of projection at Z = -0,839 (being the focal length of
the camera, noted d)
Height (and width) of the RenderWindow = 2 (measured in millimeters)
ViewUp (0,1,0)
Then, this is the code I used to develop the previous camera model with the
vtkCamera class:
vtkCamera *camera = vtkCamera::New();
camera->SetViewUp(0, 1, 0); // ViewUp
camera->SetPosition(0, 0, -d); // Eyepoint
camera->SetFocalPoint(0, 0, 0); // Viewplane
camera->ComputeViewPlaneNormal();
double h = 2; // h is the height of
the RenderWindow
double d = 0,839; // d is the distance
from your eyes to the screen
double angleofview = 2. * atan((h/2.)/d); // angleofview =
2*atan((h/2)/d)
camera->SetViewAngle(angleofview);
I tested it and It seems that it works, but I don't know if I'm properly
using the vtkCamera
class to implement what I really need.
Any help will be grateful.
Thanks all.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070805/6276ff05/attachment.htm>
More information about the vtkusers
mailing list