[Algorithms] Best Fit Oriented Bounding Box
Brought to you by:
vexxed72
From: John R. <jra...@in...> - 2006-04-08 00:57:45
|
Ok, I realize this may be a dumb question but I suppose that is the point. I want to do something that I believe should be really simple to do. In fact I have an enormous amount of reference material that implies the solution is simple. However, I have yet to find a solution that is presented in a form that, to me, makes common sense. I am curious, can anyone on this list direct me to a routine that does the following: void computeOBB(unsigned int vcount,const float *points,float *sides,float *matrix); This hypothetical, and eminently useful, routine would accept an array of 3d data points and return and oriented bounding box represented as 'width,depth,height' (stored in 'sides') and a 4x4 rotation and translation matrix where the translation is the center of the box. I have found all manner of samples that compute some magical mathematical entity called an 'eigen vector' but when I try to use the matrix it produces it is not valid. Maybe I'm just dumb. In fact, I know I'm dumb. It just surprises me that something so basic, so common, isn't just laying around in a Gem somewhere. In fact, it probably is and I haven't found it yet. Or, maybe the problem is more difficult than I think and there are any number of possible 'best fit' oriented bounding boxes possible for an arbitrary point cloud. Maybe this is, in fact, a really difficult optimization problem. I would appreciate a code snippet and, if you can't provide one, I will just write my own the slow, painful, dumb way. I just hate writing code that I figured I should find somewhere on the net as easily as a quaternion or matrix implementation. Thanks, John |