7template <
class DataPo
int,
class _WFunctor,
typename T>
8typename AlgebraicSphere<DataPoint, _WFunctor, T>::VectorType
11 PONCA_MULTIARCH_STD_MATH(sqrt);
14 const VectorType lq = Base::m_w.convertToLocalBasis(_q);
16 Scalar potential = m_uc + lq.dot(m_ul) + m_uq * lq.squaredNorm();
23 t = - potential / (norm*norm);
27 t = - (norm - sqrt(norm*norm -
Scalar(4) * m_uq * potential)) / (
Scalar(2) * m_uq * norm);
29 return Base::m_w.convertToGlobalBasis( lq + t * grad );
32template <
class DataPo
int,
class _WFunctor,
typename T>
36 PONCA_MULTIARCH_STD_MATH(min)
39 const VectorType lq = Base::m_w.convertToLocalBasis(_q);
45 Scalar ad = m_uc + m_ul.dot(lq) + m_uq * lq.squaredNorm();
49 for (
int i=0; i<nbIter; ++i)
51 grad = m_ul+
Scalar(2.)*m_uq*proj;
52 ilg =
Scalar(1.)/grad.norm();
53 delta = -(m_uc + proj.dot(m_ul) + m_uq * proj.squaredNorm())*min(ilg,
Scalar(1.));
56 return Base::m_w.convertToGlobalBasis( proj );
59template <
class DataPo
int,
class _WFunctor,
typename T>
64 const VectorType lq = Base::m_w.convertToLocalBasis(_q);
66 return m_uc + lq.dot(m_ul) + m_uq * lq.squaredNorm();
70template <
class DataPo
int,
class _WFunctor,
typename T>
75 const VectorType lq = Base::m_w.convertToLocalBasis(_q);
76 return (m_ul +
Scalar(2.f) * m_uq * lq);
Algebraic Sphere primitive.
typename DataPoint::Scalar Scalar
Alias to scalar type.
typename Base::VectorType VectorType
Alias to vector type.