[vtkusers] Perhaps a stupid question about vtkCamera class

jj perico ciriushall at hotmail.com
Sun Aug 5 07:47:26 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.

_________________________________________________________________
¿Estás pensando en cambiar de coche? Todas los modelos de serie y extras en 
MSN Motor. http://motor.msn.es/researchcentre/




More information about the vtkusers mailing list