Computes the center and inertia axes of a set of 2D or 3D points.
More...
#include <easy3d/core/principal_axes.h>
|
void | begin () |
| Begins adding points.
|
|
template<typename FT2 > |
void | add (const Vec< DIM, FT2 > &p, FT2 weight=FT2(1)) |
| Adds a point p with a weight . This function supports different types of vectors, e.g. vec3, dvec3, ivec3.
|
|
void | end () |
| Ends adding points.
|
|
template<typename InputIterator > |
void | add (InputIterator first, InputIterator last) |
| Adds a set of points (internally it iteratively calls add()).
|
|
template<typename FT2 > |
Vec< DIM, FT2 > | center () const |
| The weighted average of the points. This function supports different types of vectors, e.g. vec3, dvec3, ivec3. To call this function, use. More...
|
|
template<typename FT2 > |
Vec< DIM, FT2 > | axis (int i) const |
| The i_th axis This function supports different types of vectors, e.g. vec3, dvec3, ivec3. To call this function, use. More...
|
|
FT | eigen_value (int i) const |
| The i_th eigenvalue. More...
|
|
template<int DIM, typename FT = double>
class easy3d::PrincipalAxes< DIM, FT >
Computes the center and inertia axes of a set of 2D or 3D points.
- Template Parameters
-
DIM | dimension (must be 2 or 3). |
FT | The type of the floating-point number (float or double). The default type is 'double'. |
- Note
- Using 'float' may result in large errors (accumulated when dealing a large of number coordinates of different scales.
- Todo:
- Test 2D cases.
◆ axis()
Vec< DIM, FT2 > axis |
( |
int |
i | ) |
const |
|
inline |
The i_th
axis This function supports different types of vectors, e.g. vec3, dvec3, ivec3. To call this function, use.
normal = pca.axis<float>(2);
- Note
- The eigenvectors are sorted in accordance with eigenvalues stored in the descending order.
◆ center()
The weighted average of the points. This function supports different types of vectors, e.g. vec3, dvec3, ivec3. To call this function, use.
Vec< DIM, FT2 > center() const
The weighted average of the points. This function supports different types of vectors,...
Definition: principal_axes.h:107
◆ eigen_value()
FT eigen_value |
( |
int |
i | ) |
const |
|
inline |
The i_th
eigenvalue.
- Note
- The eigenvalues are sorted in descending order.
The documentation for this class was generated from the following file: