00001 #ifndef BEST_FIT_OBB_H 00002 00003 #define BEST_FIT_OBB_H 00004 00061 // compute the 'best fit' oriented bounding box of an input point cloud by doing an exhaustive search. 00062 // it spins the point cloud around searching for the minimal volume. It keeps narrowing down until 00063 // it fails to find a better fit. The only dependency is on 'double_math' 00064 // 00065 // The inputs are: 00066 // 00067 // vcount : number of input vertices in the point cloud. 00068 // points : a pointer to the first vertex. 00069 // pstride : The stride between each point measured in bytes. 00070 // 00071 // The outputs are: 00072 // 00073 // sides : The length of the sides of the OBB as X, Y, Z distance. 00074 // matrix : A pointer to a 4x4 matrix. This will contain the 3x3 rotation and the translation component. 00075 // pos : The center of the OBB 00076 // quat : The orientation of the OBB expressed as quaternion in the form of X,Y,Z,W 00077 // 00078 // 00079 // Please email bug fixes or improvements to John W. Ratcliff at mailto:jratcliff@infiniplex.net 00080 // 00081 // If you find this source code useful donate a couple of bucks to my kid's fund raising website at 00082 // www.amillionpixels.us 00083 // 00084 // More snippets at: www.codesuppository.com 00085 // 00086 00087 namespace ConvexDecomposition 00088 { 00089 00090 void computeBestFitOBB(unsigned int vcount,const double *points,unsigned int pstride,double *sides,double *matrix); 00091 void computeBestFitOBB(unsigned int vcount,const double *points,unsigned int pstride,double *sides,double *pos,double *quat); 00092 void computeBestFitABB(unsigned int vcount,const double *points,unsigned int pstride,double *sides,double *pos); 00093 00094 00095 void computeBestFitOBB(unsigned int vcount,const float *points,unsigned int pstride,float *sides,float *pos,float *quat); // the float version of the routine. 00096 void computeBestFitABB(unsigned int vcount,const float *points,unsigned int pstride,float *sides,float *pos); 00097 00098 }; 00099 00100 #endif