MeVisLab Toolbox Reference
MainAxisPCA.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13
15
16#pragma once
17
19#include <mlVector3.h>
20#include <mlMatrix3.h>
21
22ML_START_NAMESPACE
23
26{
27public:
28
31
33 virtual ~MainAxisPCA();
34
37 void computeMainAxis(const std::vector<Vector3>& points);
38
40 void getMainAxis(Vector3& longestAxis, Vector3& midAxis, Vector3& shortestAxis) const;
42 void getExtension(float& longestExtent, float& midExtent, float& shortestExtent) const;
43
47 float getLargestExtension() const;
48
53
54private:
55
57 Vector3 _xAxis, _yAxis, _zAxis;
58
59 Vector3 _centerOfMass, _midPoint;
60
62 float _xDiameter, _yDiameter, _zDiameter;
63
65 void sortByExtent();
66
68 Matrix3 getCovarianceMatrix(const std::vector < Vector3 >& pointSet, const Vector3& meanVector);
69
71 Vector3 calculateCenterOfMass(const std::vector < Vector3 >& pointSet);
72
74 void getBoundingBox(const std::vector < Vector3 >& pointSet,
75 float& minX, float& maxX,
76 float& minY, float& maxY,
77 float& minZ, float& maxZ);
78};
79
80ML_END_NAMESPACE
#define MLPOINTCLOUDUTILS_EXPORT
void computeMainAxis(const std::vector< Vector3 > &points)
MainAxisPCA()
Constructor.
void getMainAxis(Vector3 &longestAxis, Vector3 &midAxis, Vector3 &shortestAxis) const
Returns the main axes (normalized). The axes are sorted by extent, largest first.
void getExtension(float &longestExtent, float &midExtent, float &shortestExtent) const
Returns the three extents of the object aligned bounding box, largest first.
Vector3 getLargestMainAxis() const
Returns a copy of the largest main axis.
virtual ~MainAxisPCA()
Destructor.
float getLargestExtension() const
Returns the largest extend of the object aligned bounding box.
Vector3 getMidPoint() const
Returns the middle point of the object aligned bounding box.
Vector3 getCenterOfMass() const
Returns the center of mass of the object, which is the mean of all 3d points.
Tvec3< MLdouble > Vector3
A vector with three components of type double.
Definition mlVector3.h:286
Tmat3< MLdouble > Matrix3
The standard 3x3 matrix of type double.
Definition mlMatrix3.h:711