you have to do some analysis to find the minimum bouning box. Lots of different clever ways to do it (google around a bit), I have a brute force method somewhere. Ill try and dig it up.
You will probably have to do a bit of math to get the minimum bounding box. Search for “minimum bounding box” and “rotating calipers”. This is the type of algorithm that you will need to run.
download the zip fiel and install the addon from zip. Right now it’s a single file, but if I get more clever in the future, I may write some fancier stuff.
Useage:
Select object you want to fit a bounding box to.
Use Spacebar Menu to call “Min Bounding Box”
Select the proper variables
Wait a few seconds, it’s brute force and the two variables are multiplied in terms of iterations. SO 100 and 100 will be 10000 iterations over all the verts in the convex hull of the object. So, start with small numbers or decimate your object.