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?