Ponca  bab7704293a2c36e5bed9dea40def7ba839bfe08
Point Cloud Analysis library
Loading...
Searching...
No Matches
unorientedSphereFit.h
1/*
2 Copyright (C) 2013 Gael Guennebaud <gael.guennebaud@inria.fr>
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 "./algebraicSphere.h"
12#include "./mean.h" // used to define UnorientedSphereFit
13
14#include <Eigen/Dense>
15
16namespace Ponca
17{
47 template <class DataPoint, class _NFilter, typename T>
48 class UnorientedSphereFitImpl : public T
49 {
50 PONCA_FITTING_DECLARE_DEFAULT_TYPES
51
52 protected:
53 enum
54 {
55 Check = Base::PROVIDES_ALGEBRAIC_SPHERE && Base::PROVIDES_MEAN_POSITION
56 };
57
58 typedef Eigen::Matrix<Scalar, DataPoint::Dim + 1, 1> VectorB;
59 typedef Eigen::Matrix<Scalar, DataPoint::Dim + 1, DataPoint::Dim + 1> MatrixBB;
60
61 public:
62 using Solver = Eigen::EigenSolver<MatrixBB>;
63
64 MatrixBB m_matA{MatrixBB::Zero()};
65 MatrixBB m_matQ{MatrixBB::Zero()};
68 Solver m_solver;
69
70 public:
71 PONCA_EXPLICIT_CAST_OPERATORS(UnorientedSphereFitImpl, unorientedSphereFit)
72 PONCA_FITTING_DECLARE_INIT_ADD_FINALIZE
73 PONCA_FITTING_IS_SIGNED(false)
74
75 }; // class UnorientedSphereFitImpl
76
78 template <class DataPoint, class _NFilter, typename T>
80 UnorientedSphereFitImpl<DataPoint, _NFilter,
82
83 template <class DataPoint, class _NFilter, int DiffType, typename T>
84 class UnorientedSphereDerImpl : public T
85 {
86 protected:
87 PONCA_FITTING_DECLARE_DEFAULT_TYPES
88 PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
89
90 using VectorB = typename Base::VectorB;
91 using MatrixBB = typename Base::MatrixBB;
92
93 protected:
94 enum
95 {
96 Check = Base::PROVIDES_ALGEBRAIC_SPHERE & Base::PROVIDES_MEAN_POSITION_DERIVATIVE &
97 Base::PROVIDES_PRIMITIVE_DERIVATIVE,
98 PROVIDES_ALGEBRAIC_SPHERE_DERIVATIVE,
99 PROVIDES_NORMAL_DERIVATIVE
100 };
101
102 protected:
103 // computation data
104 MatrixBB m_dmatA[Base::NbDerivatives];
105 ScalarArray m_dSumDotPP{ScalarArray::Zero()};
106
107 public:
108 // results
109 ScalarArray m_dUc{ScalarArray::Zero()};
110 VectorArray m_dUl{VectorArray::Zero()};
111 ScalarArray m_dUq{ScalarArray::Zero()};
112
113 public:
114 PONCA_EXPLICIT_CAST_OPERATORS_DER(UnorientedSphereDerImpl, unorientedSphereDer)
115
116 PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE
117
118 PONCA_MULTIARCH inline ScalarArray dPotential() const;
119 PONCA_MULTIARCH inline VectorArray dNormal() const;
120
121 }; // class UnorientedSphereDerImpl
122
123 template <class DataPoint, class _NFilter, int DiffType, typename T>
124 using UnorientedSphereDer =
126
127} // namespace Ponca
128
129#include "unorientedSphereFit.hpp"
Compute the barycenter of the input points.
Definition mean.h:26
typename Base::ScalarArray ScalarArray
Alias to scalar derivatives array.
typename Base::VectorArray VectorArray
Alias to vector derivatives array.
UnorientedSphereDerImpl< DataPoint, _NFilter, DiffType, T > & unorientedSphereDer()
Explicit conversion to UnorientedSphereDerImpl , to access methods potentially hidden by heritage.
Algebraic Sphere fitting procedure on point sets with non-oriented normals.
Scalar m_sumDotPP
Sum of the squared relative positions.
UnorientedSphereFitImpl< DataPoint, _NFilter, T > & unorientedSphereFit()
Explicit conversion to UnorientedSphereFitImpl , to access methods potentially hidden by heritage.
MatrixBB m_matA
The accumulated covariance matrix.
MatrixBB m_matQ
The constraint matrix.
typename DataPoint::Scalar Scalar
Alias to scalar type.
This Source Code Form is subject to the terms of the Mozilla Public License, v.