I am struggling with a problem that I am sure is well known, but I could not find any answer using google or searching on MathOverflow.
I have a set of 3D points (x,y,z) and a camera reference frame (viewAxis, upAxis, leftAxis) with a pyramidal frustum expressed in tangent values (tanUp, tanDown, tanLeft, tanRight). Note, the frustum is not necessarily symmetric (i.e. tanUp can be different of -tanDown, resp. tanLeft and tanRight).
I would like to find the position for camera pinPoint (tip of the pyramid) of the camera at which all points for the set would fit in the frustum (exactly, i.e two points would 'sit' on the lateral or up/down planes).
I have managed to do it using perspective projections of the point set on a plane normal to camView (four projections one using tanUp for perspective, resp. tanDown, tanLeft and tanRight) to find the topmost, lowest, leftmost and rightmost points, and then computing the minimal distance from the plane at which the projections would all fit in the frustum.
This leads to the distance being either determined by 'lateral' or 'vertical' range. What I am trying to do now (without success) is to determine the 'shifting' of the camera position in the other direction which would 'center' the dataset in that direction.
I hope I am being clear enough, I would be glad to edit this post to provide all needed information.
Thanks.