8template <
class DataPo
int,
class _WFunctor,
typename T>
16template <
class DataPo
int,
class _WFunctor,
typename T>
20 const DataPoint &attributes)
22 if( Base::addLocalNeighbor(w, localQ, attributes) ) {
26 a.template segment<DataPoint::Dim>(1) = localQ;
27 a(DataPoint::Dim+1) = localQ.squaredNorm();
29 a << 1, localQ, localQ.squaredNorm();
31 m_matA += w * a * a.transpose();
39template <
class DataPo
int,
class _WFunctor,
typename T>
44 if(Base::finalize() !=
STABLE)
45 return Base::m_eCurrentState;
46 if(Base::getNumNeighbors() < DataPoint::Dim)
48 if (Base::algebraicSphere().isValid())
51 Base::m_eCurrentState = Base::getNumNeighbors() < 2*DataPoint::Dim ?
UNSTABLE :
STABLE;
55 matC.template topRightCorner<1,1>() << -2;
56 matC.template bottomLeftCorner<1,1>() << -2;
57 matC.template topLeftCorner<1,1>() << 0;
58 matC.template bottomRightCorner<1,1>() << 0;
61 invCpratt.setIdentity();
62 invCpratt.template topRightCorner<1,1>() << -0.5;
63 invCpratt.template bottomLeftCorner<1,1>() << -0.5;
64 invCpratt.template topLeftCorner<1,1>() << 0;
65 invCpratt.template bottomRightCorner<1,1>() << 0;
74 m_solver.computeDirect(invCpratt * m_matA);
76 m_solver.compute(invCpratt * m_matA);
78 VectorA eivals = m_solver.eigenvalues().real();
80 for(
int i=0 ; i<DataPoint::Dim+2 ; ++i)
83 if((ev>0) && (minId==-1 || ev<eivals(minId)))
88 VectorA vecU = m_solver.eigenvectors().col(minId).real();
89 Base::m_uq = vecU[1+DataPoint::Dim];
90 Base::m_ul = vecU.template segment<DataPoint::Dim>(1);
93 Base::m_isNormalized =
false;
95 return Base::m_eCurrentState;
Algebraic Sphere fitting procedure on point set without normals.
typename DataPoint::Scalar Scalar
Alias to scalar type.
typename Base::VectorType VectorType
Alias to vector type.
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns)
@ UNDEFINED
The fitting is undefined, you can't use it for valid results.
@ CONFLICT_ERROR_FOUND
Multiple classes of the fitting procedure initialize the primitive.
@ STABLE
The fitting is stable and ready to use.
@ UNSTABLE
The fitting is ready to use but it is considered as unstable (if the number of neighbors is low for e...