1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
// Copyright (c) 2018 GeometryFactory Sarl (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1/Classification/include/CGAL/Classification/Feature/Eigenvalue.h $
// $Id: include/CGAL/Classification/Feature/Eigenvalue.h b26b07a1242 $
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Simon Giraudot
#ifndef CGAL_CLASSIFICATION_FEATURES_EIGENVALUE_H
#define CGAL_CLASSIFICATION_FEATURES_EIGENVALUE_H
#include <CGAL/license/Classification.h>
#include <vector>
#include <CGAL/Classification/Feature_base.h>
#include <CGAL/Classification/Local_eigen_analysis.h>
namespace CGAL {
namespace Classification {
namespace Feature {
/*!
\ingroup PkgClassificationFeatures
%Feature based on the eigenvalues of the covariance matrix of a
local neighborhood.
Its default name is "eigenvalue_0", "eigenvalue_1" or
"eigenvalue_2", depending on which eigenvalue is chosen in the
constructor.
*/
class Eigenvalue : public Feature_base
{
protected:
const Classification::Local_eigen_analysis& eigen;
unsigned int m_idx;
public:
/*!
Constructs the feature.
\tparam Input model of `ConstRange`. Its iterator type
is `RandomAccessIterator`.
\param input input range.
\param eigen class with precomputed eigenvectors and eigenvalues.
\param idx index of the eigen value (0, 1 or 2).
*/
template <typename InputRange>
Eigenvalue (const InputRange& input,
const Classification::Local_eigen_analysis& eigen,
unsigned int idx)
: eigen (eigen), m_idx (idx)
{
CGAL_USE(input);
std::ostringstream oss;
oss << "eigenvalue" << idx;
this->set_name (oss.str());
}
/// \cond SKIP_IN_MANUAL
virtual float value (std::size_t pt_index)
{
return eigen.eigenvalue(pt_index)[std::size_t(m_idx)];
}
/// \endcond
};
} // namespace Feature
} // namespace Classification
} // namespace CGAL
#endif // CGAL_CLASSIFICATION_FEATURES_EIGENVALUE_H
|