-1
$\begingroup$

My code dynamically creates scenes and saves a picture of each scene it creates. The main subject matter changes in size from scene to scene in such a way that - absent dynamic zooming with each scene - sometimes the subject is too small and sometimes it is too big in relation to the what the camera sees.

Is there an efficient algorithm or procedure for dynamically zooming? Or should I come up with a algebraic/trigonometric solution?

If it's algebra/trig, my calculations for the correct zoom would depend on the 3D geometry of the camera itself (aspect and depth of the focal point inside the camera). Is that info available?

$\endgroup$
1
$\begingroup$

One can move the camera or change the focal length of the lens. Each method has the effect of making objects in the view larger or smaller. If your goal is to capture the entire object within the view, you must know its size first. If it is a problem to know the object size each time you want to capture it, perhaps using the Home key, which sizes the view, not the camera position, would allow you to then grab some view parameters (which I am not familiar with) to use in positioning the camera or changing the lens focal length.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.