Ponca  94e4a36411c3364f6192f97adfa8ceee67834d6e
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
43 bool m_isValid {false};
44
45 static_assert ( DataPoint::Dim == 3, "CurvatureEstimatorBase is only valid in 3D");
46
47 public:
48 PONCA_FITTING_DECLARE_INIT
49
51 PONCA_MULTIARCH [[nodiscard]] inline bool isValid() const { return m_isValid; }
52
53 /**************************************************************************/
54 /* Use results */
55 /**************************************************************************/
57 PONCA_MULTIARCH [[nodiscard]] inline Scalar kmin() const { return m_kmin; }
58
60 PONCA_MULTIARCH [[nodiscard]] inline Scalar kmax() const { return m_kmax; }
61
63 PONCA_MULTIARCH [[nodiscard]] inline VectorType kminDirection() const { return m_vmin; }
64
66 PONCA_MULTIARCH [[nodiscard]] inline VectorType kmaxDirection() const { return m_vmax; }
67
69 PONCA_MULTIARCH [[nodiscard]] inline Scalar kMean() const { return (m_kmin + m_kmax)/Scalar(2);}
70
72 PONCA_MULTIARCH [[nodiscard]] inline Scalar GaussianCurvature() const { return m_kmin * m_kmax;}
73
74 protected:
81 PONCA_MULTIARCH inline void setCurvatureValues(Scalar kmin, Scalar kmax, const VectorType& vmin, const VectorType& vmax);
82 };
83 }
84
86 template < class DataPoint, class _NFilter, typename T>
87 class CurvatureEstimator : public internal::CurvatureEstimatorBase<DataPoint, _NFilter, T>
88 {
89 public:
90 PONCA_EXPLICIT_CAST_OPERATORS(CurvatureEstimator, curvatureEstimator)
91 };
92
94 template < class DataPoint, class _NFilter, int DiffType, typename T>
95 class CurvatureEstimatorDer : public internal::CurvatureEstimatorBase<DataPoint, _NFilter, T>
96 {
97 public:
98 PONCA_EXPLICIT_CAST_OPERATORS_DER(CurvatureEstimatorDer, curvatureEstimator)
99 };
100
101} //namespace Ponca
102
103#include "curvature.hpp"
Make CurvatureEstimatorBase available to BasketDiff object.
Definition curvature.h:96
CurvatureEstimatorDer< DataPoint, _NFilter, DiffType, T > & curvatureEstimator()
Explicit conversion to CurvatureEstimatorDer , to access methods potentially hidden by heritage.
Definition curvature.h:98
Make CurvatureEstimatorBase available to standard Basket object.
Definition curvature.h:88
CurvatureEstimator< DataPoint, _NFilter, T > & curvatureEstimator()
Explicit conversion to CurvatureEstimator , to access methods potentially hidden by heritage.
Definition curvature.h:90
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:63
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:51
Scalar kMean() const
Returns an estimate of the mean curvature.
Definition curvature.h:69
Scalar kmin() const
Returns an estimate of the minimal principal curvature value.
Definition curvature.h:57
Scalar GaussianCurvature() const
Returns an estimate of the Gaussian curvature.
Definition curvature.h:72
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:60
VectorType kmaxDirection() const
Returns an estimate of the maximal principal curvature direction.
Definition curvature.h:66
This Source Code Form is subject to the terms of the Mozilla Public License, v.