MeVisLabToolboxReference
MeVisLab/Standard/Sources/Shared/MLPointCloudUtils/MLMainAxisPCA/MainAxisPCA.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00009 //----------------------------------------------------------------------------------
00010 
00011 
00012 #ifndef __MainAxisPCA_H
00013 #define __MainAxisPCA_H
00014 
00015 #include "../MLPointCloudUtilsSystem.h"
00016 #include <mlVector3.h>
00017 
00018 ML_START_NAMESPACE
00019 
00021 class MLPOINTCLOUDUTILS_EXPORT MainAxisPCA
00022 {
00023 
00024 public:
00025 
00027   MainAxisPCA();
00028 
00030   virtual ~MainAxisPCA();
00031 
00034   void computeMainAxis(const std::vector<ml::Vector3>& points);    
00035 
00037   void getMainAxis(ml::Vector3& xAxis, ml::Vector3& yAxis, ml::Vector3& zAxis);
00039   void getExtension(float& xExt, float& yExt, float& zExt);
00040 
00042   float* getLargestMainAxis();
00044   float getLargestExtension();
00045 
00047   ml::Vector3 getBaryCenter();
00049   ml::Vector3 getMidPoint();
00050 
00051 
00052 private:
00053 
00055   float *_xAxis, *_yAxis, *_zAxis;
00056 
00057   float *_baryCenter, *_midPoint;
00059   float _xDiameter, _yDiameter, _zDiameter;
00060 
00062   void getCovarianceMatrix(const float* vertices, const long size, float **covaMatrix, const float* meanVec);
00063 
00066   void getInverseMatrix(float** aMatrix, float** invMatrix);
00067 
00069   float* calcBaryCenter(const float* vertices, int size);
00070 
00072   float dotProduct(const float* vec1, const float* vec2);
00073 
00075   void getBoundingBox(const float* pointSet, const long size,     
00076     float& minX, float& maxX, 
00077     float& minY, float& maxY, 
00078     float& minZ, float& maxZ);
00079 
00081   float* stretchVector(const float* vector, const float length);
00082 
00083 };
00084 
00085 ML_END_NAMESPACE
00086 
00087 #endif // __MainAxisPCA_H