DGtal  1.3.beta
CorrectedNormalCurrentComputer.h
1 
17 #pragma once
18 
31 #if defined(CorrectedNormalCurrentComputer_RECURSES)
32 #error Recursive header files inclusion detected in CorrectedNormalCurrentComputer.h
33 #else // defined(CorrectedNormalCurrentComputer_RECURSES)
34 
35 #define CorrectedNormalCurrentComputer_RECURSES
36 
37 #if !defined CorrectedNormalCurrentComputer_h
38 
39 #define CorrectedNormalCurrentComputer_h
40 
42 // Inclusions
43 #include "DGtal/base/Common.h"
44 #include "DGtal/math/linalg/EigenDecomposition.h"
45 #include "DGtal/geometry/meshes/SurfaceMeshMeasure.h"
46 #include "DGtal/geometry/meshes/CorrectedNormalCurrentFormula.h"
47 #include "DGtal/shapes/SurfaceMesh.h"
48 
49 
50 namespace DGtal
51 {
53  // template class CorrectedNormalCurrentComputer
68  template < typename TRealPoint, typename TRealVector >
70  {
71  typedef TRealPoint RealPoint;
72  typedef TRealVector RealVector;
75  BOOST_STATIC_ASSERT( ( dimension == 3 ) );
77  typedef typename RealVector::Component Scalar;
82  typedef std::vector< Scalar > Scalars;
83  typedef std::vector< RealPoint > RealPoints;
84  typedef std::vector< RealVector > RealVectors;
85  typedef std::vector< RealTensor > RealTensors;
86  typedef typename SurfaceMesh::Size Size;
87  typedef typename SurfaceMesh::Index Index;
88  typedef typename SurfaceMesh::Vertex Vertex;
89  typedef typename SurfaceMesh::Face Face;
90 
91 
102  bool unit_u = false );
103 
106  ScalarMeasure computeMu0() const;
109  ScalarMeasure computeMu1() const;
112  ScalarMeasure computeMu2() const;
115  TensorMeasure computeMuXY() const;
116 
117  //-------------------------------------------------------------------------
118  public:
121 
125  static
127  {
128  return ( mu0 != 0.0 ) ? mu1 / ( 2.0 * mu0 ) : 0.0;
129  }
130 
134  static
136  {
137  return ( mu0 != 0.0 ) ? mu2 / mu0 : 0.0;
138  }
139 
147  static
148  std::tuple< Scalar, Scalar, RealVector, RealVector >
150  {
151  muXY += muXY.transpose();
152  muXY *= 0.5;
153  const double coef_N = 1000.0 * mu0;
154  // Trick to force orthogonality to normal vector.
155  // (see @cite lachaud2020interpolated, section 2)
156  for ( int j = 0; j < 3; j++ )
157  for ( int k = 0; k < 3; k++ )
158  muXY( j, k ) += coef_N * N[ j ] * N[ k ];
159  RealTensor V;
160  RealVector L;
162  return std::make_tuple( ( mu0 != 0.0 ) ? -L[ 1 ] / mu0 : 0.0,
163  ( mu0 != 0.0 ) ? -L[ 0 ] / mu0 : 0.0,
164  V.column( 1 ),
165  V.column( 0 ) );
166  }
168 
169  // ------------------------- Public Datas ------------------------------
170  public:
171 
172  // ------------------------- Protected Datas ------------------------------
173  protected:
174 
179  bool myUnitU;
180 
181  // ------------------------- Private Datas --------------------------------
182  private:
183 
184  // ------------------------- Internals ------------------------------------
185  protected:
186 
207 
228 
229 
230  }; // end of class CorrectedNormalCurrentComputer
231 
232 } // namespace DGtal
233 
235 // Includes inline functions.
236 #include "CorrectedNormalCurrentComputer.ih"
237 // //
239 
240 #endif // !defined CorrectedNormalCurrentComputer_h
241 
242 #undef CorrectedNormalCurrentComputer_RECURSES
243 #endif // else defined(CorrectedNormalCurrentComputer_RECURSES)
244 
DGtal::SurfaceMesh::Vertex
Index Vertex
Definition: SurfaceMesh.h:108
DGtal::CorrectedNormalCurrentComputer::SurfaceMesh
DGtal::SurfaceMesh< RealPoint, RealVector > SurfaceMesh
Definition: CorrectedNormalCurrentComputer.h:76
DGtal::SimpleMatrix::transpose
SimpleMatrix< Component, TN, TM > transpose() const
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DGtal::CorrectedNormalCurrentComputer::myUnitU
bool myUnitU
Definition: CorrectedNormalCurrentComputer.h:179
DGtal::CorrectedNormalCurrentComputer::Formula
CorrectedNormalCurrentFormula< RealPoint, RealVector > Formula
Definition: CorrectedNormalCurrentComputer.h:79
DGtal::CorrectedNormalCurrentComputer::meanCurvature
static Scalar meanCurvature(Scalar mu0, Scalar mu1)
Definition: CorrectedNormalCurrentComputer.h:126
DGtal::CorrectedNormalCurrentComputer::CorrectedNormalCurrentComputer
CorrectedNormalCurrentComputer(ConstAlias< SurfaceMesh > aMesh, bool unit_u=false)
DGtal::CorrectedNormalCurrentComputer::principalCurvatures
static std::tuple< Scalar, Scalar, RealVector, RealVector > principalCurvatures(Scalar mu0, RealTensor muXY, const RealVector &N)
Definition: CorrectedNormalCurrentComputer.h:149
DGtal::CorrectedNormalCurrentComputer::dimension
static const Dimension dimension
Definition: CorrectedNormalCurrentComputer.h:74
DGtal::EigenDecomposition::getEigenDecomposition
static void getEigenDecomposition(const Matrix &matrix, Matrix &eigenVectors, Vector &eigenValues)
Compute both eigen vectors and eigen values from an input matrix.
DGtal::CorrectedNormalCurrentComputer::RealTensors
std::vector< RealTensor > RealTensors
Definition: CorrectedNormalCurrentComputer.h:85
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:137
DGtal::SurfaceMesh
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...
Definition: SurfaceMesh.h:91
DGtal::CorrectedNormalCurrentComputer::ScalarMeasure
SurfaceMeshMeasure< RealPoint, RealVector, Scalar > ScalarMeasure
Definition: CorrectedNormalCurrentComputer.h:80
DGtal::CorrectedNormalCurrentComputer::myMesh
const SurfaceMesh & myMesh
A reference to the mesh over which computations are done.
Definition: CorrectedNormalCurrentComputer.h:176
DGtal::CorrectedNormalCurrentComputer::computeMu2ConstantU
ScalarMeasure computeMu2ConstantU() const
DGtal::CorrectedNormalCurrentComputer::TensorMeasure
SurfaceMeshMeasure< RealPoint, RealVector, RealTensor > TensorMeasure
Definition: CorrectedNormalCurrentComputer.h:81
DGtal::CorrectedNormalCurrentComputer::Index
SurfaceMesh::Index Index
Definition: CorrectedNormalCurrentComputer.h:87
DGtal::CorrectedNormalCurrentComputer::GaussianCurvature
static Scalar GaussianCurvature(Scalar mu0, Scalar mu2)
Definition: CorrectedNormalCurrentComputer.h:135
DGtal::PointVector::Component
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:614
DGtal::CorrectedNormalCurrentComputer
Aim: Utility class to compute curvature measures induced by (1) a corrected normal current defined by...
Definition: CorrectedNormalCurrentComputer.h:69
DGtal::CorrectedNormalCurrentComputer::computeMuXY
TensorMeasure computeMuXY() const
DGtal::CorrectedNormalCurrentComputer::computeMu0ConstantU
ScalarMeasure computeMu0ConstantU() const
DGtal::CorrectedNormalCurrentComputer::RealVectors
std::vector< RealVector > RealVectors
Definition: CorrectedNormalCurrentComputer.h:84
DGtal::CorrectedNormalCurrentComputer::Scalars
std::vector< Scalar > Scalars
Definition: CorrectedNormalCurrentComputer.h:82
DGtal::CorrectedNormalCurrentComputer::computeMu2
ScalarMeasure computeMu2() const
DGtal::CorrectedNormalCurrentComputer::computeMu0
ScalarMeasure computeMu0() const
DGtal::SimpleMatrix::column
ColumnVector column(const DGtal::Dimension j) const
DGtal::SimpleMatrix
Aim: implements basic MxN Matrix services (M,N>=1).
Definition: SimpleMatrix.h:75
DGtal::CorrectedNormalCurrentComputer::RealTensor
SimpleMatrix< Scalar, dimension, dimension > RealTensor
Definition: CorrectedNormalCurrentComputer.h:78
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::CorrectedNormalCurrentComputer::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT((dimension==3))
DGtal::CorrectedNormalCurrentComputer::computeMu1
ScalarMeasure computeMu1() const
DGtal::CorrectedNormalCurrentComputer::computeMu1ConstantU
ScalarMeasure computeMu1ConstantU() const
DGtal::CorrectedNormalCurrentFormula
Aim: A helper class that provides static methods to compute corrected normal current formulas of curv...
Definition: CorrectedNormalCurrentFormula.h:99
DGtal::CorrectedNormalCurrentComputer::RealVector
TRealVector RealVector
Definition: CorrectedNormalCurrentComputer.h:72
DGtal::CorrectedNormalCurrentComputer::computeMuXYConstantU
TensorMeasure computeMuXYConstantU() const
DGtal::CorrectedNormalCurrentComputer::RealPoint
TRealPoint RealPoint
Definition: CorrectedNormalCurrentComputer.h:71
DGtal::CorrectedNormalCurrentComputer::Face
SurfaceMesh::Face Face
Definition: CorrectedNormalCurrentComputer.h:89
DGtal::SurfaceMeshMeasure
Aim: stores an arbitrary measure on a SurfaceMesh object. The measure can be spread onto its vertices...
Definition: SurfaceMeshMeasure.h:82
DGtal::CorrectedNormalCurrentComputer::Size
SurfaceMesh::Size Size
Definition: CorrectedNormalCurrentComputer.h:86
DGtal::SurfaceMesh::Face
Index Face
Definition: SurfaceMesh.h:106
DGtal::PointVector::dimension
static const Dimension dimension
Copy of the static dimension of the Point/Vector.
Definition: PointVector.h:626
DGtal::CorrectedNormalCurrentComputer::computeMuXYInterpolatedU
TensorMeasure computeMuXYInterpolatedU() const
DGtal::CorrectedNormalCurrentComputer::computeMu1InterpolatedU
ScalarMeasure computeMu1InterpolatedU() const
DGtal::CorrectedNormalCurrentComputer::computeMu0InterpolatedU
ScalarMeasure computeMu0InterpolatedU() const
DGtal::SurfaceMesh::Size
std::size_t Size
The type for counting elements.
Definition: SurfaceMesh.h:103
DGtal::CorrectedNormalCurrentComputer::Scalar
RealVector::Component Scalar
Definition: CorrectedNormalCurrentComputer.h:77
DGtal::CorrectedNormalCurrentComputer::computeMu2InterpolatedU
ScalarMeasure computeMu2InterpolatedU() const
DGtal::CorrectedNormalCurrentComputer::Vertex
SurfaceMesh::Vertex Vertex
Definition: CorrectedNormalCurrentComputer.h:88
DGtal::CorrectedNormalCurrentComputer::RealPoints
std::vector< RealPoint > RealPoints
Definition: CorrectedNormalCurrentComputer.h:83
DGtal::CorrectedNormalCurrentComputer::Self
CorrectedNormalCurrentComputer< RealPoint, RealVector > Self
Definition: CorrectedNormalCurrentComputer.h:73
DGtal::SurfaceMesh::Index
std::size_t Index
The type used for numbering vertices and faces.
Definition: SurfaceMesh.h:105