Ponca  2cfe00173bb12dda99e12b2b48a0e1f683bc5cdd
Point Cloud Analysis library
Loading...
Searching...
No Matches
covariancePlaneFit.h
1/*
2 Copyright (C) 2014 Nicolas Mellado <nmellado0@gmail.com>
3 Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>
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#include "../concepts.h"
13
14#include "../primitive/plane.h" // used to define CovariancePlaneFit
15#include "../tools/mean.h" // used to define CovariancePlaneFit
16#include "../tools/covariance.h" // used to define CovariancePlaneFit
17
18#include <Eigen/Eigenvalues>
19
20#define COVARIANCE_PLANE_FIT_REQUIREMENTS ProvidesPlane<T>
21#define COVARIANCE_PLANE_DER_REQUIREMENTS ProvidesPlane<T>&& Is3D<DataPoint>
22
23namespace Ponca
24{
25
29 This class can also computes the surface variation measure introduced in
30 \cite Pauly:2002:PSSimplification.
31
32 \inherit Concept::FittingProcedureConcept
33
34 \see Plane
35 */
36 template <class DataPoint, class _NFilter, typename T>
37 requires COVARIANCE_PLANE_FIT_REQUIREMENTS
38 class CovariancePlaneFitImpl : public T
39 {
40 PONCA_FITTING_DECLARE_DEFAULT_TYPES
41 PONCA_FITTING_DECLARE_MATRIX_TYPE
42 public:
43 PONCA_EXPLICIT_BASKET_CAST_OPERATORS(CovariancePlaneFitImpl, covariancePlaneFit)
44 PONCA_EXPLICIT_BASKET_CAST_OPERATORS(CovariancePlaneFitImpl, tangentPlaneBasis)
45 PONCA_FITTING_DECLARE_FINALIZE
46 PONCA_FITTING_IS_SIGNED(false)
47
48 /**************************************************************************/
49 /* Results */
50 /**************************************************************************/
51
62 PONCA_MULTIARCH inline VectorType worldToTangentPlane(const VectorType& _q,
63 bool _isPositionVector = true) const;
64
73 PONCA_MULTIARCH inline VectorType tangentPlaneToWorld(const VectorType& _q,
74 bool _isPositionVector = true) const;
75 }; // class CovariancePlaneFitImpl
76
79 template <class DataPoint, class _NFilter, typename T>
81 DataPoint, _NFilter,
82 CovarianceBase<DataPoint, _NFilter, MeanPosition<DataPoint, _NFilter, Plane<DataPoint, _NFilter, T>>>>;
84
91 template <class DataPoint, class _NFilter, int DiffType, typename T>
92 requires COVARIANCE_PLANE_DER_REQUIREMENTS
93 class CovariancePlaneDerImpl : public T
94 {
95 PONCA_FITTING_DECLARE_DEFAULT_TYPES
96 PONCA_FITTING_DECLARE_MATRIX_TYPE
97 PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
98 private:
99 VectorArray m_dNormal{VectorArray::Zero()};
100 ScalarArray m_dDist{ScalarArray::Zero()};
101
102 public:
103 PONCA_EXPLICIT_BASKET_CAST_OPERATORS_DER(CovariancePlaneDerImpl, covariancePlaneDer)
104 PONCA_EXPLICIT_BASKET_CAST_OPERATORS_DER(CovariancePlaneDerImpl, implicitPrimitiveDer)
105
107 PONCA_MULTIARCH FIT_RESULT finalize();
108
109 /**************************************************************************/
110 /* Use results */
111 /**************************************************************************/
112
113 // \brief Returns the derivatives of the scalar field at the evaluation point
115 PONCA_MULTIARCH [[nodiscard]] inline ScalarArray dPotential() const { return m_dDist; }
116
118 PONCA_MULTIARCH [[nodiscard]] inline VectorArray dNormal() const { return m_dNormal; }
119
120 }; // class CovariancePlaneDer
121
123 template <class DataPoint, class _NFilter, int DiffType, typename T>
125 DataPoint, _NFilter, DiffType,
127
128#include "covariancePlaneFit.hpp"
129
130} // namespace Ponca
Procedure that compute and decompose the covariance matrix of the neighbors positions.
Definition covariance.h:66
Internal generic class computing the derivatives of covariance matrix computed by covarianceBase.
Definition covariance.h:147
[CovariancePlaneFit Definition]
typename Base::VectorArray VectorArray
Alias to vector derivatives array.
VectorArray dNormal() const
Returns the derivatives of the primitive normal.
Plane fitting procedure using only points position.
Compute the barycenter of the input points.
Definition mean.h:29
Implicit hyperplane defined by an homogeneous vector .
Definition plane.h:39
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11
CovariancePlaneFitImpl< DataPoint, _NFilter, CovarianceBase< DataPoint, _NFilter, MeanPosition< DataPoint, _NFilter, Plane< DataPoint, _NFilter, T > > > > CovariancePlaneFit
Helper alias for Plane fitting on 3D points using CovariancePlaneFitImpl [CovariancePlaneFit Definiti...
DiffType
Flags defining which derivatives need to be computed.
Definition enums.h:34
CovariancePlaneDerImpl< DataPoint, _NFilter, DiffType, CovarianceDer< DataPoint, _NFilter, DiffType, MeanPositionDer< DataPoint, _NFilter, DiffType, T > > > CovariancePlaneDer
Helper alias for Plane fitting on 3D points using CovariancePlaneFitImpl.
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns).
Definition enums.h:15