Ponca  aa50bfdf187919869239c5b44b748842569114c1
Point Cloud Analysis library
Loading...
Searching...
No Matches
meanPlaneFit.h
1/*
2 Copyright (C) 2018 Nicolas Mellado <nmellado0@gmail.com>
3
4 This Source Code Form is subject to the terms of the Mozilla Public
5 License, v. 2.0. If a copy of the MPL was not distributed with this
6 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7*/
8
9#pragma once
10
11#include "./plane.h"
12#include "./mean.h"
13
14namespace Ponca
15{
16
27template < class DataPoint, class _WFunctor, typename T >
28class MeanPlaneFitImpl : public T
29{
30PONCA_FITTING_DECLARE_DEFAULT_TYPES
31PONCA_FITTING_DECLARE_MATRIX_TYPE
32
33protected:
34 enum { Check = Base::PROVIDES_MEAN_POSITION && Base::PROVIDES_MEAN_NORMAL && Base::PROVIDES_PLANE };
35
36public:
37 PONCA_EXPLICIT_CAST_OPERATORS(MeanPlaneFitImpl,meanPlaneFit)
38
39 PONCA_FITTING_APIDOC_FINALIZE
40 PONCA_MULTIARCH inline FIT_RESULT finalize()
41 {
42 // handle specific configurations
43 if(Base::finalize() == STABLE)
44 {
45 if (Base::plane().isValid()) Base::m_eCurrentState = CONFLICT_ERROR_FOUND;
46 Base::setPlane(Base::m_sumN / Base::getWeightSum(), Base::barycenterLocal());
47 }
48 return Base::m_eCurrentState;
49 }
50 PONCA_FITTING_IS_SIGNED(true)
51}; //class MeanPlaneFitImpl
52
55 template < class DataPoint, class _WFunctor, typename T>
57 MeanPlaneFitImpl<DataPoint, _WFunctor,
58 MeanNormal<DataPoint, _WFunctor,
59 MeanPosition<DataPoint, _WFunctor,
62} //namespace Ponca
Compute the barycenter of the input points + their normals.
Definition: mean.h:79
Plane fitting procedure computing the mean position and orientation from oriented points.
Definition: meanPlaneFit.h:29
MeanPlaneFitImpl< DataPoint, _WFunctor, T > & meanPlaneFit()
Explicit conversion to MeanPlaneFitImpl , to access methods potentially hidden by heritage.
Definition: meanPlaneFit.h:37
FIT_RESULT finalize()
Finalize the procedure.
Definition: meanPlaneFit.h:40
Compute the barycenter of the input points.
Definition: mean.h:24
Implicit hyperplane defined by an homogeneous vector .
Definition: plane.h:37
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
@ CONFLICT_ERROR_FOUND
Multiple classes of the fitting procedure initialize the primitive.
Definition: enums.h:27
@ STABLE
The fitting is stable and ready to use.
Definition: enums.h:17