Skip to content

Commit

Permalink
use Dim for stability check
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultLejemble committed Aug 4, 2023
1 parent 5e2777f commit d1ae906
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Ponca/src/Fitting/covarianceFit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ CovarianceFitBase<DataPoint, _WFunctor, T>::finalize ()
// handle specific configurations
if(Base::finalize() != STABLE)
return Base::m_eCurrentState;
// With less than 3 neighbors the fitting is undefined
if(Base::getNumNeighbors() < 3)
// With less than Dim neighbors the fitting is undefined
if(Base::getNumNeighbors() < Base::Dim)
return Base::m_eCurrentState = UNDEFINED;

// Center the covariance on the centroid
Expand Down
4 changes: 2 additions & 2 deletions Ponca/src/Fitting/orientedSphereFit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ OrientedSphereFitImpl<DataPoint, _WFunctor, T>::finalize ()
// Compute status
if(Base::finalize() != STABLE)
return Base::m_eCurrentState;
if(Base::getNumNeighbors() < 3)
if(Base::getNumNeighbors() < Base::Dim)
return Base::m_eCurrentState = UNDEFINED;
if (Base::algebraicSphere().isValid())
Base::m_eCurrentState = CONFLICT_ERROR_FOUND;
else
Base::m_eCurrentState = Base::getNumNeighbors() < 6 ? UNSTABLE : STABLE;
Base::m_eCurrentState = Base::getNumNeighbors() < 2*Base::Dim ? UNSTABLE : STABLE;

// 1. finalize sphere fitting
Scalar epsilon = Eigen::NumTraits<Scalar>::dummy_precision();
Expand Down
4 changes: 2 additions & 2 deletions Ponca/src/Fitting/sphereFit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ SphereFitImpl<DataPoint, _WFunctor, T>::finalize ()
// Compute status
if(Base::finalize() != STABLE)
return Base::m_eCurrentState;
if(Base::getNumNeighbors() < 3)
if(Base::getNumNeighbors() < Base::Dim)
return Base::m_eCurrentState = UNDEFINED;
if (Base::algebraicSphere().isValid())
Base::m_eCurrentState = CONFLICT_ERROR_FOUND;
else
Base::m_eCurrentState = Base::getNumNeighbors() < 6 ? UNSTABLE : STABLE;
Base::m_eCurrentState = Base::getNumNeighbors() < 2*Base::Dim ? UNSTABLE : STABLE;

MatrixA matC;
matC.setIdentity();
Expand Down
4 changes: 2 additions & 2 deletions Ponca/src/Fitting/unorientedSphereFit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ UnorientedSphereFitImpl<DataPoint, _WFunctor, T>::finalize ()
// Compute status
if(Base::finalize() != STABLE)
return Base::m_eCurrentState;
if(Base::getNumNeighbors() < 3)
if(Base::getNumNeighbors() < Base::Dim)
return Base::m_eCurrentState = UNDEFINED;
if (Base::algebraicSphere().isValid())
Base::m_eCurrentState = CONFLICT_ERROR_FOUND;
else
Base::m_eCurrentState = Base::getNumNeighbors() < 6 ? UNSTABLE : STABLE;
Base::m_eCurrentState = Base::getNumNeighbors() < 2*Base::Dim ? UNSTABLE : STABLE;

// 1. finalize sphere fitting
Scalar invSumW = Scalar(1.) / Base::getWeightSum();
Expand Down

0 comments on commit d1ae906

Please sign in to comment.