PDA

View Full Version : Determining camera aim vector

gib
02-03-2003, 12:24 PM
This is related to my previous post about fovy.

The situation is that I have a scene composed of some objects, a fixed virtual camera position, and a fixed camera "up" vector, and I want to determine camera aim vector and fovy such that all the objects fit on the screen and they appear as large as possible. Expressed another way, I want to minimise fovy while capturing the whole scene.

Mathematically speaking, I have N points (x_i,y_i,z_i), i=1,N, a camera position (x_c,y_c,z_c), and a camera "up" vector (u_x,u_y,u_z).

Given an aim vector, I know how to compute the view angles of the points, and I do have an iterative procedure for solving the problem. I start from an initial guess of the aim vector, determine all the angles, then adjust the aim vector to make it more central. The calculation is then repeated, until the change in the aim vector in one iteration is sufficiently small. This procedure works, but I'd like a direct method, i.e. a method that doesn't require iteration. Has anyone seen such a method?

Gib