Ponca  aa50bfdf187919869239c5b44b748842569114c1
Point Cloud Analysis library
Loading...
Searching...
No Matches
covarianceFit.h
1/*
2 Copyright (C) 2021 aniket agarwalla <aniketagarwalla37@gmail.com>
3 Copyright (C) 2022 nicolas mellado <nmellado0@gmail.com>
4
5 This Source Code Form is subject to the terms of the Mozilla Public
6 License, v. 2.0. If a copy of the MPL was not distributed with this
7 file, You can obtain one at http://mozilla.org/MPL/2.0/.
8*/
9
10#pragma once
11#include "./defines.h"
12
13#include <Eigen/Dense>
14
15namespace Ponca
16{
17
49 template < class DataPoint, class _WFunctor, typename T>
50 class CovarianceFitBase : public T
51 {
52 PONCA_FITTING_DECLARE_DEFAULT_TYPES
53
54 protected:
55 enum
56 {
57 Check = Base::PROVIDES_MEAN_POSITION,
58 PROVIDES_POSITION_COVARIANCE
59 };
60
61 public:
62 using MatrixType = typename DataPoint::MatrixType;
64 using Solver = Eigen::SelfAdjointEigenSolver<MatrixType>;
65
66 protected:
67 // computation data
68 MatrixType m_cov {MatrixType::Zero()};
71 public:
72 PONCA_EXPLICIT_CAST_OPERATORS(CovarianceFitBase,covarianceFit)
73 PONCA_FITTING_DECLARE_INIT_ADD_FINALIZE
74
79 PONCA_MULTIARCH inline Scalar surfaceVariation() const;
80
82 PONCA_MULTIARCH inline const Solver& solver() const { return m_solver; }
83 };
84
85
91 template < class DataPoint, class _WFunctor, int DiffType, typename T>
92 class CovarianceFitDer : public T
93 {
94 PONCA_FITTING_DECLARE_DEFAULT_TYPES
95 PONCA_FITTING_DECLARE_MATRIX_TYPE
96 PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
97
98 protected:
99 enum
100 {
101 Check = Base::PROVIDES_PRIMITIVE_DERIVATIVE &&
102 Base::PROVIDES_MEAN_POSITION_DERIVATIVE &&
103 Base::PROVIDES_POSITION_COVARIANCE,
104 PROVIDES_POSITION_COVARIANCE_DERIVATIVE
105 };
106
107 protected:
109 MatrixType m_dCov[Base::NbDerivatives];
110
111 public:
112 PONCA_EXPLICIT_CAST_OPERATORS_DER(CovarianceFitDer,covarianceFitDer)
113 PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE
114 }; //class CovarianceFitDer
115
116#include "covarianceFit.hpp"
117
118} //namespace Ponca
Procedure that compute and decompose the covariance matrix of the neighbors positions in .
Definition: covarianceFit.h:51
typename DataPoint::MatrixType MatrixType
Alias to matrix type.
Definition: covarianceFit.h:62
Eigen::SelfAdjointEigenSolver< MatrixType > Solver
Solver used to analyse the covariance matrix.
Definition: covarianceFit.h:64
MatrixType m_cov
Covariance matrix.
Definition: covarianceFit.h:68
typename DataPoint::Scalar Scalar
Alias to scalar type.
Definition: covarianceFit.h:52
Solver m_solver
Solver used to analyse the covariance matrix.
Definition: covarianceFit.h:69
const Solver & solver() const
Reading access to the Solver used to analyse the covariance matrix.
Definition: covarianceFit.h:82
CovarianceFitBase< DataPoint, _WFunctor, T > & covarianceFit()
Explicit conversion to CovarianceFitBase , to access methods potentially hidden by heritage.
Definition: covarianceFit.h:72
Scalar surfaceVariation() const
Implements surface variation.
Internal generic class computing the derivatives of covariance matrix computed by CovarianceFitBase.
Definition: covarianceFit.h:93
typename DataPoint::MatrixType MatrixType
Alias to matrix type.
Definition: covarianceFit.h:95
MatrixType m_dCov[Base::NbDerivatives]
Computation data: derivatives of the covariance matrix.
CovarianceFitDer< DataPoint, _WFunctor, DiffType, T > & covarianceFitDer()
Explicit conversion to CovarianceFitDer , to access methods potentially hidden by heritage.
This Source Code Form is subject to the terms of the Mozilla Public License, v.