Ponca  94e4a36411c3364f6192f97adfa8ceee67834d6e
Point Cloud Analysis library
Loading...
Searching...
No Matches
weingarten.h
1/*
2This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7#pragma once
8
9#include "./defines.h"
10
11namespace Ponca
12{
32 template < class DataPoint, class _NFilter, typename T >
34 {
35 PONCA_FITTING_DECLARE_DEFAULT_TYPES
36 using Matrix2 = Eigen::Matrix<Scalar, 2, 2>;
37 static_assert ( DataPoint::Dim == 3, "FundamentalFormWeingartenEstimator is only valid in 3D");
38
39 protected:
40 enum {
41 Check = Base::PROVIDES_FIRST_FUNDAMENTAL_FORM_COMPONENTS &&
42 Base::PROVIDES_SECOND_FUNDAMENTAL_FORM_COMPONENTS,
43 PROVIDES_WEINGARTEN_MAP
44 };
45 public:
47
48
52 PONCA_MULTIARCH [[nodiscard]] inline Matrix2 firstFundamentalForm() const;
53
56 template<typename Matrix2Derived>
57 PONCA_MULTIARCH inline void firstFundamentalForm(Matrix2Derived& first) const;
58
63 PONCA_MULTIARCH [[nodiscard]] inline Matrix2 secondFundamentalForm() const;
64
67 template<typename Matrix2Derived>
68 PONCA_MULTIARCH inline void secondFundamentalForm(Matrix2Derived &second) const;
69
74 PONCA_MULTIARCH [[nodiscard]] inline Matrix2 weingartenMap() const;
75
78 template<typename Matrix2Derived>
79 PONCA_MULTIARCH inline void weingartenMap(Matrix2Derived &w) const;
80
82 PONCA_MULTIARCH inline Scalar kMean() const;
83
85 PONCA_MULTIARCH inline Scalar GaussianCurvature() const;
86 };
87
88
106 template < class DataPoint, class _NFilter, int DiffType, typename T >
108 {
109 PONCA_FITTING_DECLARE_DEFAULT_TYPES
110 PONCA_FITTING_DECLARE_MATRIX_TYPE
111 PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
112 using Matrix2 = Eigen::Matrix<Scalar, 2, 2>;
113 static_assert ( DataPoint::Dim == 3, "NormalDerivativeWeingartenEstimator is only valid in 3D");
114 static_assert ( Base::isSpaceDer(), "NormalDerivativeWeingartenEstimator requires spatial derivation");
115
116 protected:
117 enum {
118 Check = Base::PROVIDES_NORMAL_DERIVATIVE,
119 PROVIDES_WEINGARTEN_MAP,
120 PROVIDES_TANGENT_PLANE_BASIS
121 };
122
123 private:
124 MatrixType m_tangentBasis {MatrixType::Zero()};
125
126 public:
128 PONCA_FITTING_DECLARE_FINALIZE
129
134 PONCA_MULTIARCH [[nodiscard]] inline Matrix2 weingartenMap() const;
135
138 template<typename Matrix2Derived>
139 PONCA_MULTIARCH inline void weingartenMap(Matrix2Derived &w) const;
140
141
143 PONCA_MULTIARCH inline VectorType worldToTangentPlane(const VectorType &_q,
144 bool _isPositionVector = true) const;
145
147 PONCA_MULTIARCH inline VectorType tangentPlaneToWorld(const VectorType &_q,
148 bool _isPositionVector = true) const;
149 };
150
151
152namespace internal
153{
170 template < class DataPoint, class _NFilter, typename T >
172 {
173 PONCA_FITTING_DECLARE_DEFAULT_TYPES
174 using Matrix2 = Eigen::Matrix<Scalar, 2, 2>;
175 static_assert ( DataPoint::Dim == 3, "WeingartenCurvatureEstimator is only valid in 3D");
176
177 protected:
178 enum {
179 Check = Base::PROVIDES_TANGENT_PLANE_BASIS && // required for tangentPlaneToWorld
180 Base::PROVIDES_PRINCIPAL_CURVATURES && // required curvature storage
181 Base::PROVIDES_WEINGARTEN_MAP
182 };
183
184 public:
185 PONCA_FITTING_DECLARE_FINALIZE
186 };
187}
188
190 template < class DataPoint, class _NFilter, typename T >
192 PONCA_FITTING_DECLARE_DEFAULT_TYPES
194 };
195
197 template < class DataPoint, class _NFilter, int DiffType, typename T >
199 PONCA_FITTING_DECLARE_DEFAULT_TYPES
200 PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES
202
203 };
204
205} //namespace Ponca
206
207#include "weingarten.hpp"
208
Compute a Weingarten map from fundamental forms.
Definition weingarten.h:34
Scalar GaussianCurvature() const
Returns an estimate of the Gaussian curvature directly from the fundamental forms.
Matrix2 secondFundamentalForm() const
Assembles and returns the second fundamental form from the base class.
FundamentalFormWeingartenEstimator< DataPoint, _NFilter, T > & fundamentalFormWeingartenEstimator()
Explicit conversion to FundamentalFormWeingartenEstimator , to access methods potentially hidden by h...
Definition weingarten.h:46
Matrix2 firstFundamentalForm() const
Assembles and returns the first fundamental form from the base class.
Definition weingarten.hpp:9
typename DataPoint::Scalar Scalar
Alias to scalar type.
Definition weingarten.h:35
Scalar kMean() const
Returns an estimate of the mean curvature directly from the fundamental forms.
Matrix2 weingartenMap() const
Returns the Weingarten Map.
Compute a Weingarten map from the spatial derivatives of the normal field .
Definition weingarten.h:108
typename Base::VectorType VectorType
Alias to vector type.
Definition weingarten.h:109
VectorType tangentPlaneToWorld(const VectorType &_q, bool _isPositionVector=true) const
Transform a point from the tangent plane [h, u, v]^T to ambient space.
NormalDerivativeWeingartenEstimator< DataPoint, _NFilter, DiffType, T > & normalDerivativeWeingartenEstimator()
Explicit conversion to NormalDerivativeWeingartenEstimator , to access methods potentially hidden by ...
Definition weingarten.h:127
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.
Definition weingarten.h:110
Matrix2 weingartenMap() const
Returns the Weingarten Map.
Compute principal curvatures from a base class providing fundamental forms.
Definition weingarten.h:172
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Compute principal curvatures from a base class providing fundamental forms.
Definition weingarten.h:198
WeingartenCurvatureEstimatorDer< DataPoint, _NFilter, DiffType, T > & weingartenCurvatureEstimator()
Explicit conversion to WeingartenCurvatureEstimatorDer , to access methods potentially hidden by heri...
Definition weingarten.h:201
Compute principal curvatures from a base class providing fundamental forms.
Definition weingarten.h:191
WeingartenCurvatureEstimator< DataPoint, _NFilter, T > & weingartenCurvatureEstimator()
Explicit conversion to WeingartenCurvatureEstimator , to access methods potentially hidden by heritag...
Definition weingarten.h:193