Help needed in creating an AABB function

Blitz3D Forums/Blitz3D Programming/Help needed in creating an AABB function

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I can think of another kludgy way wich I think would work quite well.

Rotate the mesh in all possible ways in steps of say 5 degrees.
For each rotation, and for each vertex, calculate (Tform) the worldspace x,y,z finding the smallest and largest x,y,z.
For each rotation calulate the volume (maxx-minx)*(maxy-miny)*(maxz-minz)

The smallest volume, is the best bounding box.
Rotate the mesh to best fit position, create the bounding box,
fitmesh(bestfitminx,bestfitminy,bestfitminz,bestfitmaxx,bestfitmaxy,bestfitmaxz)
and parent it to the mesh.