Jump to content
  • Advertisement
Sign in to follow this  

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

This topic is 1372 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!