3#include <Eigen/Geometry>
5template <
class DataPo
int,
class _WFunctor,
typename T>
13 m_planeIsReady =
false;
16template <
class DataPo
int,
class _WFunctor,
typename T>
20 const DataPoint &attributes)
24 return Base::addLocalNeighbor(w, localQ, attributes);
29 const VectorType local = Base::worldToTangentPlane(attributes.pos());
30 const Scalar& h = *(local.data());
31 const Scalar& u = *(local.data()+1);
32 const Scalar& v = *(local.data()+2);
34 Eigen::Matrix<Scalar, 6, 1 > p;
35 p << u*u, v*v, u*v, u, v, 1;
36 m_A += w*p*p.transpose();
44template <
class DataPo
int,
class _WFunctor,
typename T>
49 if (! m_planeIsReady) {
53 m_planeIsReady =
true;
54 m_A = SampleMatrix(6,6);
66 m_x = m_A.bdcSvd(Eigen::ComputeThinU | Eigen::ComputeThinV).solve(m_b);
67 return Base::m_eCurrentState =
STABLE;
71template <
class DataPo
int,
class _WFunctor,
typename T>
74 PONCA_MULTIARCH_STD_MATH(pow);
75 static const Scalar one (1);
76 static const Scalar two (2);
78 return ((one + pow(h_v(),two) ) * h_uu() * two*h_u()*h_v()*h_uv() + (one+pow(h_u(),two))*h_vv()) /
79 (two * pow(one +pow(h_u(),two) + pow(h_v(),two),threeOverTwo));
82template <
class DataPo
int,
class _WFunctor,
typename T>
85 PONCA_MULTIARCH_STD_MATH(pow);
86 static const Scalar one (1);
87 static const Scalar two (2);
88 return (h_uu()*h_vv() - pow(h_uv(),two)) /
89 pow((one + pow(h_u(),two) + pow(h_v(),two) ), two);
Extension to compute the best fit quadric on 3d points expressed as .
typename Base::VectorType VectorType
Alias to vector type.
typename DataPoint::Scalar Scalar
Alias to scalar type.
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns)
@ NEED_OTHER_PASS
The fitting procedure needs to analyse the neighborhood another time.
@ STABLE
The fitting is stable and ready to use.