10#include "../../defines.h"
11#include "../concepts.h"
13#include "../primitive/algebraicSphere.h"
14#include "../tools/mean.h"
18#define UNORIENTED_SPHERE_FIT_REQUIREMENTS \
19 ProvidesAlgebraicSphere<T>&& ProvidesMeanPosition<T>&& ProvidesNormal<DataPoint>
20#define UNORIENTED_SPHERE_DER_REQUIREMENTS \
21 ProvidesBasketDiffUnitBase<T>&& ProvidesAlgebraicSphere<T>&& ProvidesMeanPositionDerivative<T>
54 template <
class DataPo
int,
class _NFilter,
typename T>
55 requires UNORIENTED_SPHERE_FIT_REQUIREMENTS
58 PONCA_FITTING_DECLARE_DEFAULT_TYPES
61 using VectorB = Eigen::Matrix<Scalar, DataPoint::Dim + 1, 1>;
62 using MatrixBB = Eigen::Matrix<Scalar, DataPoint::Dim + 1, DataPoint::Dim + 1>;
65 using Solver = Eigen::EigenSolver<MatrixBB>;
75 PONCA_FITTING_DECLARE_INIT_ADD_FINALIZE
76 PONCA_FITTING_IS_SIGNED(
false)
81 template <
class DataPo
int,
class _NFilter,
typename T>
86 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
91 PONCA_FITTING_DECLARE_DEFAULT_TYPES
92 PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
94 using VectorB =
typename Base::VectorB;
95 using MatrixBB =
typename Base::MatrixBB;
99 MatrixBB m_dmatA[Base::NbDerivatives];
104 ScalarArray m_dUc{ScalarArray::Zero()};
105 VectorArray m_dUl{VectorArray::Zero()};
106 ScalarArray m_dUq{ScalarArray::Zero()};
113 PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE
115 PONCA_MULTIARCH inline
ScalarArray dPotential() const;
116 PONCA_MULTIARCH inline
VectorArray dNormal() const;
121 return Scalar(2.) * Base::m_ul.transpose() * m_dUl -
Scalar(4.) * Base::m_uq * m_dUc -
122 Scalar(4.) * Base::m_uc * m_dUq;
128 return Scalar(2.) * m_dUl.col(_d).dot(Base::m_ul) -
Scalar(4.) * m_dUc.col(_d)[0] * Base::m_uq -
129 Scalar(4.) * m_dUq.col(_d)[0] * Base::m_uc;
135 PONCA_MULTIARCH_STD_MATH(sqrt);
142 PONCA_MULTIARCH_STD_MATH(sqrt);
154 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
155 using UnorientedSphereDer =
156 UnorientedSphereDerImpl<DataPoint, _NFilter, DiffType, MeanPositionDer<DataPoint, _NFilter, DiffType, T>>;
160#include "unorientedSphereFit.hpp"
Compute the barycenter of the input points.
UnorientedSphereDerImpl< DataPoint, _NFilter, DiffType, T > & implicitPrimitiveDer()
Explicit conversion to UnorientedSphereDerImpl , to access methods potentially hidden by heritage.
ScalarArray dprattNorm() const
compute the Pratt norm derivative
Scalar dprattNorm2(unsigned int _d) const
compute the square of the Pratt norm derivative for dimension _d
typename Base::ScalarArray ScalarArray
Alias to scalar derivatives array.
UnorientedSphereDerImpl< DataPoint, _NFilter, DiffType, T > & algebraicSphereDer()
Explicit conversion to UnorientedSphereDerImpl , to access methods potentially hidden by heritage.
Scalar dprattNorm(unsigned int _d) const
compute the Pratt norm derivative for the dimension _d
ScalarArray dprattNorm2() const
compute the square of the Pratt norm derivative
typename DataPoint::Scalar Scalar
Alias to scalar type.
typename Base::VectorArray VectorArray
Alias to vector derivatives array.
bool applyPrattNorm()
Normalize the scalar field by the Pratt norm.
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 concept ensures that the default types and accessors in a BasketDiff are well-formed.
This Source Code Form is subject to the terms of the Mozilla Public License, v.