PDA

View Full Version : zoom in/out



AeroSujan
10-27-2009, 11:47 PM
Can somebody help me with how can I zoom in and zoom out my objects on the screen ! I am trying with gluPerspective() bby changing angle bbut unsuccessfuk ! Any help would be highly appreciated !!

Thanks
sujan

Aleksandar
10-28-2009, 04:08 AM
Changing the field of view (FOV) can be a method to zoom-in/zoom-out. The equivalent of the human eye is about 41 deg. Let's that be x1 zoom. If you want to zoom-in, reduce FOV.
The formula for calculating FOV from zoom-factor requires size of the sensor (d) and lens's focal length (f):

FOV = 2 * arctan((d/2)/(1/f))

A solid-state 1/4" sensor (the most common case in cameras today) is 3.6mm wide and 2.7mm high.

Zooming, in fact, is performed by varying focal length.
I'm using the following formula to calculate FOV from zoom factor:

FOV = 2.0 * atan(d/(2*minFocalLength*zoom)) * toDeg;