10#include "../../defines.h"
11#include "../concepts.h"
13#include "../primitive/algebraicSphere.h"
14#include "../tools/mean.h"
18#define UNORIENTED_SPHERE_FIT_REQUIREMENTS ProvidesAlgebraicSphere<T>&& ProvidesMeanPosition<T>
19#define UNORIENTED_SPHERE_DER_REQUIREMENTS \
20 ProvidesBasketDiffUnitBase<T>&& ProvidesAlgebraicSphere<T>&& ProvidesMeanPositionDerivative<T>
53 template <
class DataPo
int,
class _NFilter,
typename T>
54 requires UNORIENTED_SPHERE_FIT_REQUIREMENTS
57 PONCA_FITTING_DECLARE_DEFAULT_TYPES
60 using VectorB = Eigen::Matrix<Scalar, DataPoint::Dim + 1, 1>;
61 using MatrixBB = Eigen::Matrix<Scalar, DataPoint::Dim + 1, DataPoint::Dim + 1>;
64 using Solver = Eigen::EigenSolver<MatrixBB>;
74 PONCA_FITTING_DECLARE_INIT_ADD_FINALIZE
75 PONCA_FITTING_IS_SIGNED(
false)
80 template <
class DataPo
int,
class _NFilter,
typename T>
85 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
90 PONCA_FITTING_DECLARE_DEFAULT_TYPES
91 PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
93 using VectorB =
typename Base::VectorB;
94 using MatrixBB =
typename Base::MatrixBB;
98 MatrixBB m_dmatA[Base::NbDerivatives];
103 ScalarArray m_dUc{ScalarArray::Zero()};
104 VectorArray m_dUl{VectorArray::Zero()};
105 ScalarArray m_dUq{ScalarArray::Zero()};
112 PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE
120 return Scalar(2.) * Base::m_ul.transpose() * m_dUl -
Scalar(4.) * Base::m_uq * m_dUc -
121 Scalar(4.) * Base::m_uc * m_dUq;
127 return Scalar(2.) * m_dUl.col(
_d).dot(Base::m_ul) -
Scalar(4.) * m_dUc.col(
_d)[0] * Base::m_uq -
128 Scalar(4.) * m_dUq.col(
_d)[0] * Base::m_uc;
134 PONCA_MULTIARCH_STD_MATH(
sqrt);
141 PONCA_MULTIARCH_STD_MATH(
sqrt);
153 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
154 using UnorientedSphereDer =
155 UnorientedSphereDerImpl<DataPoint, _NFilter, DiffType, MeanPositionDer<DataPoint, _NFilter, DiffType, T>>;
159#include "unorientedSphereFit.hpp"
Aggregator class used to declare specialized structures using CRTP.
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.