12#include PONCA_MULTIARCH_INCLUDE_STD(cmath)
13#include PONCA_MULTIARCH_INCLUDE_STD(limits)
45template <
class DataPo
int,
class _WFunctor,
typename T >
48 PONCA_FITTING_DECLARE_DEFAULT_TYPES
53 check = Base::PROVIDES_PRIMITIVE_BASE,
76 Base::init(_basisCenter);
79 m_ul = VectorType::Zero();
88 PONCA_MULTIARCH
inline bool isValid()
const{
94 PONCA_MULTIARCH_STD_MATH(pow);
95 const Scalar epsilon = Eigen::NumTraits<Scalar>::dummy_precision();
96 const Scalar squaredEpsilon = epsilon*epsilon;
104 return ! ((*this) == other);
138 VectorType diff = Base::m_w.basisCenter() - newbasis;
139 Base::m_w.init( newbasis );
150 PONCA_MULTIARCH_STD_MATH(sqrt);
191 return std::numeric_limits<Scalar>::infinity();
195 PONCA_MULTIARCH_STD_MATH(sqrt);
212 return VectorType::Constant(std::numeric_limits<Scalar>::infinity());
217 return Base::m_w.convertToGlobalBasis((
Scalar(-0.5)*b)*
m_ul);
264 PONCA_MULTIARCH_STD_MATH(abs);
265 Scalar epsilon = Eigen::NumTraits<Scalar>::dummy_precision();
266 bool bPlanar = Eigen::internal::isMuchSmallerThan(abs(
m_uq),
Scalar(1.), epsilon);
267 bool bReady = Base::isReady();
269 return bReady && bPlanar;
274#include "algebraicSphere.hpp"
Algebraic Sphere primitive.
void changeBasis(const VectorType &newbasis)
Express the scalar field relatively to a new basis.
bool isValid() const
Tell if the sphere as been correctly set. Used to set CONFLICT_ERROR_FOUND during fitting.
const VectorType & primitiveGradient() const
Approximation of the scalar field gradient at the evaluation point.
Scalar potential() const
Value of the scalar field at the evaluation point.
bool m_isNormalized
Is the implicit scalar field normalized using Pratt.
@ check
Requires PrimitiveBase.
@ PROVIDES_ALGEBRAIC_SPHERE
Provides Algebraic Sphere.
Scalar radius() const
return the estimated radius of the sphere
Scalar m_uc
Constant parameter of the Algebraic hyper-sphere.
bool isPlane() const
Used to know if the fitting result to a plane.
void init(const VectorType &_basisCenter=VectorType::Zero())
Set the scalar field values to 0 and reset the isNormalized() status.
VectorType project(const VectorType &_q) const
Project a point on the algebraic hypersphere.
bool operator==(const AlgebraicSphere< DataPoint, WFunctor, T > &other) const
Comparison operator.
VectorType m_ul
Linear parameter of the Algebraic hyper-sphere.
typename DataPoint::Scalar Scalar
Alias to scalar type.
Scalar prattNorm() const
compute the Pratt norm of the implicit scalar field.
Scalar prattNorm2() const
compute the squared Pratt norm of the implicit scalar field.
bool operator!=(const AlgebraicSphere< DataPoint, WFunctor, T > &other) const
Comparison operator, convenience function.
bool isNormalized() const
State indicating when the sphere has been normalized.
VectorType center() const
return the estimated center of the sphere
Scalar m_uq
Quadratic parameter of the Algebraic hyper-sphere.
bool applyPrattNorm()
Normalize the scalar field by the Pratt norm.
VectorType projectDescent(const VectorType &_q, int nbIter=16) const
Project a point on the algebraic hypersphere using Gradient Descent This projection is realized by fo...
typename Base::VectorType VectorType
Alias to vector type.
AlgebraicSphere< DataPoint, _WFunctor, T > & algebraicSphere()
Explicit conversion to AlgebraicSphere , to access methods potentially hidden by heritage.
This Source Code Form is subject to the terms of the Mozilla Public License, v.