Just jotting some notes here.
What I want to do is make 2 functions:
1. Determine X, Y, Z of camera back from origin X, Y, Z that a sphere (or a bounding box) is entirely visible in a frustum (at the nearest possible distance, of course).
2. Determine if a sphere of bounding box is in a frustum (the bounding box calc is already in Quake/FitzQuake/other Q engines and a sphere can roughly be converted to a bounding box easily enough taking the radius and making the 8 points. I imagine this could be used for a "is a point in the frustum" as well.
I guess to crack #1, I'd have to take all eight points of the frustum, determine X Z "Quake slopes" (Z is supposed to be depth in OpenGL, but is vertical in Quake) ...
So I guess what I'd really want is the "near plane" "width" (greater of depth or width for simplicity) and height of bounding box (not the far plane) with some sort of padding optional (in case not wanting edges touching edge of screen).
Then based on FOV figure out the "depth and height" slopes for the frustum (X and Z), take the "width" and height and divide by the slopes to get X dist and Z dist and then take the larger one. So ideal camera location is X, Y, Z of object minus Y dist. But that's too simple, need to v_forward walk it (using Quake pitch, yaw, roll).
Am I talking to myself ... well, I guess I am. Sigh 3D maths. But at least I can wrap my head around them and work through the necessary calculations, and I'm really not 100% on when exactly this stuff sunk in.