View Full Version : Restricting Camera movements within View Volume?

01-19-2010, 07:18 AM
Hi All,

To implement "Pan & Zoom Effect" there are two ways.
1. Change the Image size for every zoomFactor
2. Change the Camera's (gluLookAt) position for every zoomFactor

I have implemented this by varying the camera's position.
Scaled the image initially (for example 8X) and altered the camera's 'z' position to fit the image as it was in 1X (without zoom)

Initially with no user inputs, the image fits the full window and camera is at (say for example) at z = 10.

I move closer (z = 8), which produces zoomed In effect.
At this point my view volume is restricted to a portion of the full image. [Actual full image is stretched beyond the view volume]

Now here when i pan the image (moving camera in X/Y), the boundary check has to be implemented..

i.e., When image is panned left side (camera moves right) i could see the portion of the image excluded to the right side of view volume (coz of the above zoom In effect). As i proceed moving and when the right end of the image encounters the right end of the window (view volume), further pan motion should be restricted.

Available data:
'z' distance from image

Ur suggestions are appreciated.


01-19-2010, 08:29 PM
Provided the
camera's position, distance from the object, fov

Is there a way to find the view volume with the 'X' and 'Y' boundaries ..??