Ponca  bab7704293a2c36e5bed9dea40def7ba839bfe08
Point Cloud Analysis library
Loading...
Searching...
No Matches
curvature.h
1/*
2 This 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{
13 namespace internal
14 {
15 template <class DataPoint, class _NFilter, typename T>
21 class CurvatureEstimatorBase : public T
22 {
23 PONCA_FITTING_DECLARE_DEFAULT_TYPES
24 PONCA_FITTING_DECLARE_MATRIX_TYPE
25
26 protected:
27 enum
28 {
29 PROVIDES_PRINCIPAL_CURVATURES
30 };
31
32 private:
34 Scalar m_kmin{0},
36 m_kmax{0};
38 VectorType m_vmin{VectorType::Zero()},
40 m_vmax{VectorType::Zero()};
41
44 bool m_isValid{false};
45
46 static_assert(DataPoint::Dim == 3, "CurvatureEstimatorBase is only valid in 3D");
47
48 public:
49 PONCA_FITTING_DECLARE_INIT
50
52 PONCA_MULTIARCH [[nodiscard]] inline bool isValid() const { return m_isValid; }
53
54 /**************************************************************************/
55 /* Use results */
56 /**************************************************************************/
58 PONCA_MULTIARCH [[nodiscard]] inline Scalar kmin() const { return m_kmin; }
59
61 PONCA_MULTIARCH [[nodiscard]] inline Scalar kmax() const { return m_kmax; }
62
64 PONCA_MULTIARCH [[nodiscard]] inline VectorType kminDirection() const { return m_vmin; }
65
67 PONCA_MULTIARCH [[nodiscard]] inline VectorType kmaxDirection() const { return m_vmax; }
68
70 PONCA_MULTIARCH [[nodiscard]] inline Scalar kMean() const { return (m_kmin + m_kmax) / Scalar(2); }
71
73 PONCA_MULTIARCH [[nodiscard]] inline Scalar GaussianCurvature() const { return m_kmin * m_kmax; }
74
75 protected:
82 PONCA_MULTIARCH inline void setCurvatureValues(Scalar kmin, Scalar kmax, const VectorType& vmin,
83 const VectorType& vmax);
84 };
85 } // namespace internal
86
88 template <class DataPoint, class _NFilter, typename T>
89 class CurvatureEstimator : public internal::CurvatureEstimatorBase<DataPoint, _NFilter, T>
90 {
91 public:
92 PONCA_EXPLICIT_CAST_OPERATORS(CurvatureEstimator, curvatureEstimator)
93 };
94
96 template <class DataPoint, class _NFilter, int DiffType, typename T>
97 class CurvatureEstimatorDer : public internal::CurvatureEstimatorBase<DataPoint, _NFilter, T>
98 {
99 public:
100 PONCA_EXPLICIT_CAST_OPERATORS_DER(CurvatureEstimatorDer, curvatureEstimator)
101 };
102
103} // namespace Ponca
104
105#include "curvature.hpp"
Make CurvatureEstimatorBase available to BasketDiff object.
Definition curvature.h:98
CurvatureEstimatorDer< DataPoint, _NFilter, DiffType, T > & curvatureEstimator()
Explicit conversion to CurvatureEstimatorDer , to access methods potentially hidden by heritage.
Definition curvature.h:100
Make CurvatureEstimatorBase available to standard Basket object.
Definition curvature.h:90
CurvatureEstimator< DataPoint, _NFilter, T > & curvatureEstimator()
Explicit conversion to CurvatureEstimator , to access methods potentially hidden by heritage.
Definition curvature.h:92
Base class for any 3d curvature estimator: holds , and associated vectors, such that .
Definition curvature.h:22
void setCurvatureValues(Scalar kmin, Scalar kmax, const VectorType &vmin, const VectorType &vmax)
Set curvature values. To be called in finalize() by child classes.
Definition curvature.hpp:26
VectorType kminDirection() const
Returns an estimate of the minimal principal curvature direction.
Definition curvature.h:64
typename Base::VectorType VectorType
Alias to vector type.
Definition curvature.h:23
bool isValid() const
Returns true if contains valid curvature values (and not default ones)
Definition curvature.h:52
Scalar kMean() const
Returns an estimate of the mean curvature.
Definition curvature.h:70
Scalar kmin() const
Returns an estimate of the minimal principal curvature value.
Definition curvature.h:58
Scalar GaussianCurvature() const
Returns an estimate of the Gaussian curvature.
Definition curvature.h:73
typename DataPoint::Scalar Scalar
Alias to scalar type.
Definition curvature.h:23
Scalar kmax() const
Returns an estimate of the maximal principal curvature value.
Definition curvature.h:61
VectorType kmaxDirection() const
Returns an estimate of the maximal principal curvature direction.
Definition curvature.h:67
This Source Code Form is subject to the terms of the Mozilla Public License, v.