Sign in to follow this  
mike242

Camera distance for 3D axis aligned bounding box in ECEF coordinates on a geodesic wgs84 ellipsoid earth model

Recommended Posts

mike242    101

I have an object with its vertices in cartesian coordinates. These cartesian coordinates are the ECEF(Earth centred earth fixed) coordinates. This object is actually present on an ellipsoidal model of the earth using wgs84 corrdinates.The cartesian coordinates were actually obtained by converting the set of latitudes and longitudes along which the object lies but i no longer have access to them. What i have is an axis aligned bounding box with xmax, ymax, zmax and xmin,ymin,zmin obtained by parsing the cartesian coordinates (There is no obviously no cartesian point of the object at xmax,ymax,zmax or xmin,ymin,zmin. The bounding box is just a cuboid enclosing the object).

What i want to do is to calculate the camera distance for an overview on this object such that this object's bounding box perfectly fits the camera frustum. I have a perspective camera but just for an overview (directly on top of the object) i think it doesnt matter.

 

I know that an approximate distance can be calculated using a simple (boundingBox.ymax - boundingBox.ymin)/(tan(fovy/2) X 2) . But this would work only if the box is parallel to the x-y plane. For a random bounding box anywhere on the ellipsoid this wont work.

 

I am not very clear with the approach to take here. A method like using a local to world matrix comes to mind but its not very clear. Any input would be helpful.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this