1#include <Eigen/Eigenvalues>
7 template <
class DataPo
int,
class _NFilter,
typename T>
8 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
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
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
55 template <
class DataPo
int,
class _NFilter,
typename T>
56 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
57 template <
typename Matrix2Derived>
63 template <
class DataPo
int,
class _NFilter,
typename T>
64 requires FUNDAMENTAL_FORM_WEINGARTEN_ESTIMATOR_REQUIREMENTS
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
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
98 FIT_RESULT NormalDerivativeWeingartenEstimator<DataPoint, _NFilter, DiffType, T>::finalize()
101 PONCA_MULTIARCH_STD_MATH(abs);
102 PONCA_MULTIARCH_STD_MATH(sqrt);
104 using Index =
typename VectorType::Index;
107 (void)Base::finalize();
112 Index i0 = Index(-1), i1 = Index(-1), i2 = Index(-1);
114 MatrixType dN = Base::dNormal().template middleCols<DataPoint::Dim>(Base::isScaleDer() ? 1 : 0);
117 VectorType n = Base::primitiveGradient(Base::getNeighborFilter().center()).normalized();
118 n.array().abs().minCoeff(&i0);
122 m_tangentBasis.col(0) = n;
124 m_tangentBasis.col(1)[i0] = 0;
125 m_tangentBasis.col(1)[i1] = n[i2];
126 m_tangentBasis.col(1)[i2] = -n[i1];
128 m_tangentBasis.col(1).normalize();
129 m_tangentBasis.col(2) = m_tangentBasis.col(1).cross(n);
131 return Base::m_eCurrentState;
134 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
135 requires NORMAL_DERIVATIVE_WEINGARTEN_ESTIMATOR_REQUIREMENTS
136 template <
typename Matrix2Derived>
139 PONCA_MULTIARCH_STD_MATH(abs);
140 PONCA_MULTIARCH_STD_MATH(sqrt);
142 using Index =
typename VectorType::Index;
143 using Matrix32 = Eigen::Matrix<Scalar, 3, 2>;
146 MatrixType dN = Base::dNormal().template middleCols<DataPoint::Dim>(Base::isScaleDer() ? 1 : 0);
149 auto B = m_tangentBasis.template rightCols<2>();
153 W = B.transpose() * dN * B;
169 W(0, 1) = W(1, 0) = (W(0, 1) + W(1, 0)) /
Scalar(2);
172 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
173 requires NORMAL_DERIVATIVE_WEINGARTEN_ESTIMATOR_REQUIREMENTS
176 const VectorType& _q,
bool _isPositionVector)
const
178 return m_tangentBasis.transpose() * Base::getNeighborFrame().convertToLocalBasis(_q, _isPositionVector);
181 template <
class DataPo
int,
class _NFilter,
int DiffType,
typename T>
182 requires NORMAL_DERIVATIVE_WEINGARTEN_ESTIMATOR_REQUIREMENTS
185 const VectorType& _lq,
bool _isPositionVector)
const
187 return Base::getNeighborFrame().convertToGlobalBasis(m_tangentBasis * _lq, _isPositionVector);
193 template <
class DataPo
int,
class _NFilter,
typename T>
194 requires WIENGARTEN_CURVATURE_ESTIMATOR_REQUIREMENTS
195 FIT_RESULT WeingartenCurvatureEstimatorBase<DataPoint, _NFilter, T>::finalize()
197 if (Base::finalize() !=
STABLE)
198 return Base::m_eCurrentState;
201 Base::weingartenMap(w);
202 m_solver.computeDirect(w);
204 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.
typename DataPoint::Scalar Scalar
Alias to scalar type.
Matrix2 weingartenMap() const
Returns the Weingarten Map.
Copyright (c) 2022 Jacques-Olivier Lachaud (jacques-olivier.lachaud@univ-savoie.fr) Laboratory of Mat...
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.