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
23
26{
27public:
28
31
33 virtual ~MainAxisPCA();
34
37 void computeMainAxis(const std::vector<Vector3>& points);
38
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
#define MLPOINTCLOUDUTILS_EXPORT
This class computes the main axis for a point cloud by a principal component analysis.
Definition MainAxisPCA.h:26
void computeMainAxis(const std::vector< Vector3 > &points)
Computes the main axes on behalf of the given point cloud.
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.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.