1#include <Eigen/Eigenvalues>
7 template<
class DataPo
int,
class _NFilter,
typename T>
8 typename FundamentalFormWeingartenEstimator<DataPoint, _NFilter, T>::Matrix2
11 firstFundamentalForm(first);
15 template<
class DataPo
int,
class _NFilter,
typename T>
16 template<
typename Matrix2Derived>
18 Base::firstFundamentalFormComponents(first(0,0), first(1,0), first(1,1));
19 first(0,1) = first(1,0);
22 template<
class DataPo
int,
class _NFilter,
typename T>
23 typename FundamentalFormWeingartenEstimator<DataPoint, _NFilter, T>::Matrix2
26 secondFundamentalForm(second);
30 template<
class DataPo
int,
class _NFilter,
typename T>
31 template<
typename Matrix2Derived>
33 Base::secondFundamentalFormComponents(second(0,0), second(1,0), second(1,1));
34 second(0,1) = second(1,0);
38 template<
class DataPo
int,
class _NFilter,
typename T>
39 typename FundamentalFormWeingartenEstimator<DataPoint, _NFilter, T>::Matrix2
46 template<
class DataPo
int,
class _NFilter,
typename T>
47 template<
typename Matrix2Derived>
49 w = firstFundamentalForm().inverse() * secondFundamentalForm();
52 template<
class DataPo
int,
class _NFilter,
typename T>
56 Base::firstFundamentalFormComponents(E, F, G);
57 Base::secondFundamentalFormComponents(L, M, N);
61 template<
class DataPo
int,
class _NFilter,
typename T>
65 Base::firstFundamentalFormComponents(E, F, G);
66 Base::secondFundamentalFormComponents(L, M, N);
67 return (L*N-M*M)/(E*G-F*F);
71 template<
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
72 typename NormalDerivativeWeingartenEstimator<DataPoint, _NFilter, DiffType, T>::Matrix2
79 template<
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
83 PONCA_MULTIARCH_STD_MATH(abs);
84 PONCA_MULTIARCH_STD_MATH(sqrt);
86 using Index =
typename VectorType::Index;
92 Index i0=Index(-1), i1=Index(-1), i2=Index(-1);
94 MatrixType dN = Base::dNormal().template middleCols<DataPoint::Dim>(Base::isScaleDer() ? 1 : 0);
97 n.array().abs().minCoeff(&i0);
101 m_tangentBasis.col(0) = n;
103 m_tangentBasis.col(1)[i0] = 0;
104 m_tangentBasis.col(1)[i1] = n[i2];
105 m_tangentBasis.col(1)[i2] = -n[i1];
107 m_tangentBasis.col(1).normalize();
108 m_tangentBasis.col(2) = m_tangentBasis.col(1).cross(n);
110 return Base::m_eCurrentState;
113 template<
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
114 template<
typename Matrix2Derived>
116 PONCA_MULTIARCH_STD_MATH(abs);
117 PONCA_MULTIARCH_STD_MATH(sqrt);
119 using Index =
typename VectorType::Index;
120 using Matrix32 = Eigen::Matrix<Scalar,3,2>;
123 MatrixType dN = Base::dNormal().template middleCols<DataPoint::Dim>(Base::isScaleDer() ? 1: 0);
126 auto B = m_tangentBasis.template rightCols<2>();
130 W = B.transpose() * dN * B;
144 W(0,1) = W(1,0) = (W(0,1) + W(1,0))/
Scalar(2);
147 template<
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
150 bool _isPositionVector)
const{
151 return m_tangentBasis.normalized().transpose() *
152 Base::getNeighborFilter().convertToLocalBasis(_q, _isPositionVector);
155 template<
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
158 bool _isPositionVector)
const{
159 return Base::getNeighborFilter().convertToGlobalBasis(m_tangentBasis.normalized().transpose().inverse() * _lq,
165 template<
class DataPo
int,
class _NFilter,
typename T>
169 if(Base::finalize() !=
STABLE)
170 return Base::m_eCurrentState;
173 Base::weingartenMap(w);
176 Eigen::SelfAdjointEigenSolver<Matrix2> solver;
177 solver.computeDirect(w);
179 Scalar kmin = solver.eigenvalues().x();
180 Scalar kmax = solver.eigenvalues().y();
185 vmin.template bottomRows<2>() = solver.eigenvectors().col(0);
186 vmax.template bottomRows<2>() = solver.eigenvectors().col(1);
188 vmin = Base::tangentPlaneToWorld(vmin,
false);
189 vmax = Base::tangentPlaneToWorld(vmax,
false);
191 Base::setCurvatureValues(kmin, kmax, vmin, vmax);
193 return Base::m_eCurrentState;
typename Base::VectorType VectorType
Alias to vector type.
VectorType tangentPlaneToWorld(const VectorType &_q, bool _isPositionVector=true) const
Transform a point from the tangent plane [h, u, v]^T to ambient space.
VectorType worldToTangentPlane(const VectorType &_q, bool _isPositionVector=true) const
Express a point in ambient space relatively to the tangent plane.
typename DataPoint::MatrixType MatrixType
Alias to matrix type.
Matrix2 weingartenMap() const
Returns the Weingarten Map.
typename DataPoint::Scalar Scalar
Alias to scalar type.
FIT_RESULT finalize()
Finalize the procedure.
typename Base::VectorType VectorType
Alias to vector type.
FIT_RESULT finalize()
Finalize the procedure.
typename DataPoint::Scalar Scalar
Alias to scalar type.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns)
@ STABLE
The fitting is stable and ready to use.