Ponca  b63e69866b9b277a96802d3d06e6492d50ffc055
Point Cloud Analysis library
Loading...
Searching...
No Matches
curvatureEstimation.h
1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7#pragma once
8
9#include "./defines.h"
10
11namespace Ponca
12{
21 template < class DataPoint, class _NFilter, int DiffType, typename T>
23 {
24 PONCA_FITTING_DECLARE_DEFAULT_TYPES
25 PONCA_FITTING_DECLARE_MATRIX_TYPE
26
27 protected:
28 enum
29 {
30 Check = Base::PROVIDES_NORMAL_DERIVATIVE && Base::PROVIDES_PRINCIPAL_CURVATURES
31 };
32
33 private:
34 typedef Eigen::Matrix<Scalar,3,2> Mat32;
35 typedef Eigen::Matrix<Scalar,2,2> Mat22;
37 public:
39 PONCA_FITTING_DECLARE_FINALIZE
40
41 private:
47 PONCA_MULTIARCH [[nodiscard]] inline FIT_RESULT computeCurvature(bool useNormal = false);
48
49 protected:
55 PONCA_MULTIARCH [[nodiscard]] inline Mat32 tangentPlane(bool useNormal = false) const;
56 };
57
58
74template < class DataPoint, class _NFilter, int DiffType, typename T>
76{
77PONCA_FITTING_DECLARE_DEFAULT_TYPES
78PONCA_FITTING_DECLARE_MATRIX_TYPE
79PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
80
81protected:
82 enum
83 {
84 Check = Base::PROVIDES_PRINCIPAL_CURVATURES
85 };
86
87 //TODO(thib) check the curvature values that might be wrong
88 //TODO(thib) use weighting function
89 //TODO(thib) which eigenvectors should be selected ? extreme of maximal ?
90
91public:
93 typedef Eigen::SelfAdjointEigenSolver<MatrixType> Solver;
94
95protected:
97 MatrixType m_cov {MatrixType::Zero()};
99 VectorType m_cog {VectorType::Zero()};
102public:
104 PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE
105};
106
107
123template < class DataPoint, class _NFilter, int DiffType, typename T>
125{
126 //TODO(thib) check the curvature values that might be wrong
127 //TODO(thib) use weighting function
128
129PONCA_FITTING_DECLARE_DEFAULT_TYPES
130PONCA_FITTING_DECLARE_MATRIX_TYPE
131PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
132
133protected:
134 enum
135 {
136 Check = Base::PROVIDES_PRINCIPAL_CURVATURES &&
137 Base::PROVIDES_PLANE // \todo This class relies on the primitiveGradient, so update this
138 };
139
141 enum PASS : int
142 {
143 FIRST_PASS = 0,
144 SECOND_PASS,
145 PASS_COUNT
146 };
147
148public:
149 //TODO(thib) use of Eigen::RowAtCompileTime-1 ?
150 typedef Eigen::Matrix<Scalar,2,2> Mat22;
151 typedef Eigen::Matrix<Scalar,3,2> Mat32;
152 typedef Eigen::Matrix<Scalar,2,1> Vector2;
153 typedef typename VectorType::Index Index;
155 typedef Eigen::SelfAdjointEigenSolver<Mat22> Solver;
156
157protected:
158 Vector2 m_cog {Vector2::Zero()};
159 Mat22 m_cov {Mat22::Zero()};
160 PASS m_pass {FIRST_PASS};
161 Mat32 m_tframe {Mat32::Zero()};
164public:
166 PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE
167};
168
169#include "curvatureEstimation.hpp"
170
171} //namespace Ponca
Extension to compute curvature values based on a covariance analysis of normal vectors of neighbors.
Eigen::SelfAdjointEigenSolver< MatrixType > Solver
Solver used to analyse the covariance matrix.
typename Base::VectorType VectorType
Alias to vector type.
VectorType m_cog
Gravity center of the normal vectors.
NormalCovarianceCurvatureEstimator< DataPoint, _NFilter, DiffType, T > & normalCovarianceCurvatureEstimator()
Explicit conversion to NormalCovarianceCurvatureEstimator , to access methods potentially hidden by h...
typename DataPoint::MatrixType MatrixType
Alias to matrix type.
MatrixType m_cov
Covariance matrix of the normal vectors.
Solver m_solver
Solver used to analyse the covariance matrix.
Extension to compute curvature values from the Weingarten map .
Mat32 tangentPlane(bool useNormal=false) const
Compute a tangent plane basis.
NormalDerivativesCurvatureEstimator< DataPoint, _NFilter, DiffType, T > & normalDerivativesCurvatureEstimator()
Explicit conversion to NormalDerivativesCurvatureEstimator , to access methods potentially hidden by ...
Extension to compute curvature values based on a covariance analysis of normal vectors of neighbors p...
ProjectedNormalCovarianceCurvatureEstimator< DataPoint, _NFilter, DiffType, T > & projectedNormalCovarianceCurvature()
Explicit conversion to ProjectedNormalCovarianceCurvatureEstimator , to access methods potentially hi...
Solver m_solver
Solver used to analyse the covariance matrix.
Eigen::SelfAdjointEigenSolver< Mat22 > Solver
Solver used to analyse the covariance matrix.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns)
Definition enums.h:15