Ponca  bab7704293a2c36e5bed9dea40def7ba839bfe08
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
27 template <class DataPoint, class _NFilter, typename T>
28 class MeanPlaneFitImpl : public T
29 {
30 PONCA_FITTING_DECLARE_DEFAULT_TYPES
31 PONCA_FITTING_DECLARE_MATRIX_TYPE
32
33 protected:
34 enum
35 {
36 Check = Base::PROVIDES_MEAN_POSITION && Base::PROVIDES_MEAN_NORMAL && Base::PROVIDES_PLANE
37 };
38
39 public:
40 PONCA_EXPLICIT_CAST_OPERATORS(MeanPlaneFitImpl, meanPlaneFit)
41
42 PONCA_FITTING_APIDOC_FINALIZE
43 PONCA_MULTIARCH inline FIT_RESULT finalize()
44 {
45 // handle specific configurations
46 if (Base::finalize() == STABLE)
47 {
48 if (Base::plane().isValid())
49 Base::m_eCurrentState = CONFLICT_ERROR_FOUND;
50 Base::setPlane(Base::m_sumN / Base::getWeightSum(), Base::barycenterLocal());
51 }
52 return Base::m_eCurrentState;
53 }
54 PONCA_FITTING_IS_SIGNED(true)
55 }; // class MeanPlaneFitImpl
56
59 template <class DataPoint, class _NFilter, typename T>
61 DataPoint, _NFilter,
64} // namespace Ponca
Compute the mean normal of the input points.
Definition mean.h:85
Plane fitting procedure computing the mean position and orientation from oriented points.
FIT_RESULT finalize()
Finalize the procedure.
MeanPlaneFitImpl< DataPoint, _NFilter, T > & meanPlaneFit()
Explicit conversion to MeanPlaneFitImpl , to access methods potentially hidden by heritage.
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