AGX Dynamics  2.37.2.0
bestfitobb.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 /*
18 This source code has been taken and modified by Algoryx Simulation AB
19 from the source and under the license given below.
20 */
22 
23 #ifndef BEST_FIT_OBB_H
24 
25 #define BEST_FIT_OBB_H
26 
83 // compute the 'best fit' oriented bounding box of an input point cloud by doing an exhaustive search.
84 // it spins the point cloud around searching for the minimal volume. It keeps narrowing down until
85 // it fails to find a better fit. The only dependency is on 'double_math'
86 //
87 // The inputs are:
88 //
89 // vcount : number of input vertices in the point cloud.
90 // points : a pointer to the first vertex.
91 // pstride : The stride between each point measured in bytes.
92 //
93 // The outputs are:
94 //
95 // sides : The length of the sides of the OBB as X, Y, Z distance.
96 // matrix : A pointer to a 4x4 matrix. This will contain the 3x3 rotation and the translation component.
97 // pos : The center of the OBB
98 // quat : The orientation of the OBB expressed as quaternion in the form of X,Y,Z,W
99 //
100 //
101 // Please email bug fixes or improvements to John W. Ratcliff at mailto:jratcliff@infiniplex.net
102 //
103 // If you find this source code useful donate a couple of bucks to my kid's fund raising website at
104 // www.amillionpixels.us
105 //
106 // More snippets at: www.codesuppository.com
107 //
108 
109 namespace ConvexDecomposition
110 {
111 
112  void computeBestFitOBB(unsigned int vcount,const double *points,unsigned int pstride,double *sides,double *matrix);
113  void computeBestFitOBB(unsigned int vcount,const double *points,unsigned int pstride,double *sides,double *pos,double *quat);
114  void computeBestFitABB(unsigned int vcount,const double *points,unsigned int pstride,double *sides,double *pos);
115 
116 
117  void computeBestFitOBB(unsigned int vcount,const float *points,unsigned int pstride,float *sides,float *pos,float *quat); // the float version of the routine.
118  void computeBestFitABB(unsigned int vcount,const float *points,unsigned int pstride,float *sides,float *pos);
119 
120 }
121 
122 #endif
123