1#include <Eigen/Eigenvalues>
7 template <
class DataPo
int,
class _NFilter,
typename T>
8 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
9 typename FundamentalFormWeingartenEstimator<DataPoint, _NFilter, T>::Matrix2 FundamentalFormWeingartenEstimator<
10 DataPoint, _NFilter, T>::firstFundamentalForm()
const
13 firstFundamentalForm(first);
17 template <
class DataPo
int,
class _NFilter,
typename T>
18 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
19 template <
typename Matrix2Derived>
22 Base::firstFundamentalFormComponents(first(0, 0), first(1, 0), first(1, 1));
23 first(0, 1) = first(1, 0);
26 template <
class DataPo
int,
class _NFilter,
typename T>
27 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
29 DataPoint, _NFilter, T>::secondFundamentalForm()
const
32 secondFundamentalForm(second);
36 template <
class DataPo
int,
class _NFilter,
typename T>
37 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
38 template <
typename Matrix2Derived>
41 Base::secondFundamentalFormComponents(second(0, 0), second(1, 0), second(1, 1));
42 second(0, 1) = second(1, 0);
45 template <
class DataPo
int,
class _NFilter,
typename T>
46 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
48 DataPoint, _NFilter, T>::weingartenMap()
const
55 template <
class DataPo
int,
class _NFilter,
typename T>
56 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
57 template <
typename Matrix2Derived>
60 w = firstFundamentalForm().inverse() * secondFundamentalForm();
63 template <
class DataPo
int,
class _NFilter,
typename T>
64 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
66 DataPoint, _NFilter, T>::kMean()
const
69 Base::firstFundamentalFormComponents(E, F, G);
70 Base::secondFundamentalFormComponents(L, M, N);
71 return (G * L -
Scalar(2) * F * M + E * N) / (
Scalar(2) * (E * G - F * F));
74 template <
class DataPo
int,
class _NFilter,
typename T>
75 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
77 DataPoint, _NFilter, T>::GaussianCurvature()
const
80 Base::firstFundamentalFormComponents(E, F, G);
81 Base::secondFundamentalFormComponents(L, M, N);
82 return (L * N - M * M) / (E * G - F * F);
86 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
87 requires NORMAL_DERIVATIVE_WEINGARTEN_ESTIMATOR_REQUIREMENTS
88 typename NormalDerivativeWeingartenEstimator<DataPoint, _NFilter, DiffType, T>::Matrix2
96 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
97 requires NORMAL_DERIVATIVE_WEINGARTEN_ESTIMATOR_REQUIREMENTS
101 PONCA_MULTIARCH_STD_MATH(abs);
102 PONCA_MULTIARCH_STD_MATH(sqrt);
104 using Index =
typename VectorType::Index;
110 Index i0 = Index(-1), i1 = Index(-1), i2 = Index(-1);
112 MatrixType dN = Base::dNormal().template middleCols<DataPoint::Dim>(Base::isScaleDer() ? 1 : 0);
115 n.array().abs().minCoeff(&i0);
119 m_tangentBasis.col(0) = n;
121 m_tangentBasis.col(1)[i0] = 0;
122 m_tangentBasis.col(1)[i1] = n[i2];
123 m_tangentBasis.col(1)[i2] = -n[i1];
125 m_tangentBasis.col(1).normalize();
126 m_tangentBasis.col(2) = m_tangentBasis.col(1).cross(n);
128 return Base::m_eCurrentState;
131 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
132 requires NORMAL_DERIVATIVE_WEINGARTEN_ESTIMATOR_REQUIREMENTS
133 template <
typename Matrix2Derived>
136 PONCA_MULTIARCH_STD_MATH(abs);
137 PONCA_MULTIARCH_STD_MATH(sqrt);
139 using Index =
typename VectorType::Index;
140 using Matrix32 = Eigen::Matrix<Scalar, 3, 2>;
143 MatrixType dN = Base::dNormal().template middleCols<DataPoint::Dim>(Base::isScaleDer() ? 1 : 0);
146 auto B = m_tangentBasis.template rightCols<2>();
150 W = B.transpose() * dN * B;
166 W(0, 1) = W(1, 0) = (W(0, 1) + W(1, 0)) /
Scalar(2);
169 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
170 requires NORMAL_DERIVATIVE_WEINGARTEN_ESTIMATOR_REQUIREMENTS
173 const VectorType& _q,
bool _isPositionVector)
const
175 return m_tangentBasis.normalized().transpose() *
176 Base::getNeighborFrame().convertToLocalBasis(_q, _isPositionVector);
179 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
180 requires NORMAL_DERIVATIVE_WEINGARTEN_ESTIMATOR_REQUIREMENTS
183 const VectorType& _lq,
bool _isPositionVector)
const
185 return Base::getNeighborFrame().convertToGlobalBasis(m_tangentBasis.normalized().transpose().inverse() * _lq,
192 template <
class DataPo
int,
class _NFilter,
typename T>
193 requires WIENGARTEN_CURVATURE_ESTIMATOR_REQUIREMENTS
196 if (Base::finalize() !=
STABLE)
197 return Base::m_eCurrentState;
200 Base::weingartenMap(w);
201 m_solver.computeDirect(w);
203 return Base::m_eCurrentState;
typename Base::VectorType VectorType
Alias to vector type.
FIT_RESULT finalize()
Finalize the procedure.
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.
typename DataPoint::Scalar Scalar
Alias to scalar type.
Matrix2 weingartenMap() const
Returns the Weingarten Map.
FIT_RESULT finalize()
Finalize the procedure.
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.