Ponca  aa50bfdf187919869239c5b44b748842569114c1
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
11#include <Eigen/Eigenvalues>
12#include <Eigen/Core>
13
14namespace Ponca
15{
16 template < class DataPoint, class _WFunctor, int DiffType, typename T>
22 class CurvatureEstimatorBase : public T
23 {
24 PONCA_FITTING_DECLARE_DEFAULT_TYPES
25 PONCA_FITTING_DECLARE_MATRIX_TYPE
26
27 protected:
28 enum
29 {
30 PROVIDES_PRINCIPAL_CURVATURES
31 };
32
33 private:
35 Scalar m_kmin {0},
37 m_kmax {0};
39 VectorType m_vmin {VectorType::Zero()},
41 m_vmax {VectorType::Zero()};
42
44 bool m_isValid {false};
45
46 static_assert ( DataPoint::Dim == 3, "CurvatureEstimatorBase is only valid in 3D");
47
48 public:
49 PONCA_EXPLICIT_CAST_OPERATORS_DER(CurvatureEstimatorBase, curvatureEstimatorBase)
50 PONCA_FITTING_DECLARE_INIT
51
53 PONCA_MULTIARCH inline bool isValid() const { return m_isValid; }
54
55 /**************************************************************************/
56 /* Use results */
57 /**************************************************************************/
59 PONCA_MULTIARCH inline Scalar kmin() const { return m_kmin; }
60
62 PONCA_MULTIARCH inline Scalar kmax() const { return m_kmax; }
63
65 PONCA_MULTIARCH inline VectorType kminDirection() const { return m_vmin; }
66
68 PONCA_MULTIARCH inline VectorType kmaxDirection() const { return m_vmax; }
69
71 PONCA_MULTIARCH inline Scalar kMean() const { return (m_kmin + m_kmax)/Scalar(2);}
72
74 PONCA_MULTIARCH inline Scalar GaussianCurvature() const { return m_kmin * m_kmax;}
75
76 protected:
83 PONCA_MULTIARCH inline void setCurvatureValues(Scalar kmin, Scalar kmax, const VectorType& vmin, const VectorType& vmax);
84 };
85
86} //namespace Ponca
87
88#include "curvature.hpp"
Base class for any 3d curvature estimator: holds , and associated vectors, such that .
Definition: curvature.h:23
Scalar kMean() const
Returns an estimate of the mean curvature.
Definition: curvature.h:71
Scalar GaussianCurvature() const
Returns an estimate of the Gaussian curvature.
Definition: curvature.h:74
VectorType kminDirection() const
Returns an estimate of the minimal principal curvature direction.
Definition: curvature.h:65
typename DataPoint::Scalar Scalar
Alias to scalar type.
Definition: curvature.h:24
CurvatureEstimatorBase< DataPoint, _WFunctor, DiffType, T > & curvatureEstimatorBase()
Explicit conversion to CurvatureEstimatorBase , to access methods potentially hidden by heritage.
Definition: curvature.h:49
Scalar kmax() const
Returns an estimate of the maximal principal curvature value.
Definition: curvature.h:62
Scalar kmin() const
Returns an estimate of the minimal principal curvature value.
Definition: curvature.h:59
bool isValid() const
Returns true if contains valid curvature values (and not default ones)
Definition: curvature.h:53
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:17
typename Base::VectorType VectorType
Alias to vector type.
Definition: curvature.h:24
VectorType kmaxDirection() const
Returns an estimate of the maximal principal curvature direction.
Definition: curvature.h:68
This Source Code Form is subject to the terms of the Mozilla Public License, v.