DGtal  1.5.beta
NormalCycleComputer.h
1 
17 #pragma once
18 
31 #if defined(NormalCycleComputer_RECURSES)
32 #error Recursive header files inclusion detected in NormalCycleComputer.h
33 #else // defined(NormalCycleComputer_RECURSES)
35 #define NormalCycleComputer_RECURSES
36 
37 #if !defined NormalCycleComputer_h
39 #define NormalCycleComputer_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/NormalCycleFormula.h"
47 #include "DGtal/shapes/SurfaceMesh.h"
48 
49 
50 namespace DGtal
51 {
53  // template class NormalCycleComputer
66  template < typename TRealPoint, typename TRealVector >
68  {
69  typedef TRealPoint RealPoint;
70  typedef TRealVector RealVector;
72  static const Dimension dimension = RealPoint::dimension;
75  typedef typename RealVector::Component Scalar;
80  typedef std::vector< Scalar > Scalars;
81  typedef std::vector< RealPoint > RealPoints;
82  typedef std::vector< RealVector > RealVectors;
83  typedef std::vector< RealTensor > RealTensors;
84  typedef typename SurfaceMesh::Size Size;
85  typedef typename SurfaceMesh::Index Index;
86  typedef typename SurfaceMesh::Vertex Vertex;
87  typedef typename SurfaceMesh::Face Face;
88 
89 
93 
108 
109  //-------------------------------------------------------------------------
110  public:
113 
117  static
119  {
120  return ( mu0 != 0.0 ) ? mu1 / ( 2.0 * mu0 ) : 0.0;
121  }
122 
126  static
128  {
129  return ( mu0 != 0.0 ) ? mu2 / mu0 : 0.0;
130  }
131 
139  static
140  std::tuple< Scalar, Scalar, RealVector, RealVector >
142  {
143  muXY += muXY.transpose();
144  muXY *= 0.5;
145  const double coef_N = 1000.0 * mu0;
146  // Trick to force orthogonality to normal vector.
147  for ( int j = 0; j < 3; j++ )
148  for ( int k = 0; k < 3; k++ )
149  muXY( j, k ) += coef_N * N[ j ] * N[ k ];
150  RealTensor V;
151  RealVector L;
153  return std::make_tuple( ( mu0 != 0.0 ) ? -L[ 1 ] / mu0 : 0.0,
154  ( mu0 != 0.0 ) ? -L[ 0 ] / mu0 : 0.0,
155  V.column( 1 ),
156  V.column( 0 ) );
157  }
159 
160  // ------------------------- Protected Datas ------------------------------
161  protected:
162 
165 
166 
167 
168  }; // end of class NormalCycleComputer
169 
170 } // namespace DGtal
171 
173 // Includes inline functions.
174 #include "NormalCycleComputer.ih"
175 // //
177 
178 #endif // !defined NormalCycleComputer_h
179 
180 #undef NormalCycleComputer_RECURSES
181 #endif // else defined(NormalCycleComputer_RECURSES)
182 
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
static void getEigenDecomposition(const Matrix &matrix, Matrix &eigenVectors, Vector &eigenValues)
Compute both eigen vectors and eigen values from an input matrix.
TEuclideanRing Component
Type for Vector elements.
Definition: PointVector.h:614
Aim: implements basic MxN Matrix services (M,N>=1).
Definition: SimpleMatrix.h:76
ColumnVector column(const DGtal::Dimension j) const
SimpleMatrix< Component, TN, TM > transpose() const
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Definition: Common.h:136
Aim: Utility class to compute curvatures measures induced by (1) the normal cycle induced by a Surfac...
static Scalar meanCurvature(Scalar mu0, Scalar mu1)
std::vector< RealPoint > RealPoints
static const Dimension dimension
std::vector< RealVector > RealVectors
NormalCycleComputer(ConstAlias< SurfaceMesh > aMesh)
RealVector::Component Scalar
std::vector< Scalar > Scalars
const SurfaceMesh & myMesh
A reference to the mesh over which computations are done.
ScalarMeasure computeMu0() const
NormalCycleFormula< RealPoint, RealVector > Formula
TensorMeasure computeMuXY() const
static Scalar GaussianCurvature(Scalar mu0, Scalar mu2)
SurfaceMeshMeasure< RealPoint, RealVector, RealTensor > TensorMeasure
std::vector< RealTensor > RealTensors
ScalarMeasure computeMu2() const
ScalarMeasure computeMu1() const
SimpleMatrix< Scalar, dimension, dimension > RealTensor
TensorMeasure computeMuXYs() const
DGtal::SurfaceMesh< RealPoint, RealVector > SurfaceMesh
BOOST_STATIC_ASSERT((dimension==3))
static std::tuple< Scalar, Scalar, RealVector, RealVector > principalCurvatures(Scalar mu0, RealTensor muXY, const RealVector &N)
NormalCycleComputer< RealPoint, RealVector > Self
SurfaceMeshMeasure< RealPoint, RealVector, Scalar > ScalarMeasure
Aim: A helper class that provides static methods to compute normal cycle formulas of curvatures.
Aim: stores an arbitrary measure on a SurfaceMesh object. The measure can be spread onto its vertices...
Aim: Represents an embedded mesh as faces and a list of vertices. Vertices may be shared among faces ...
Definition: SurfaceMesh.h:92
std::size_t Index
The type used for numbering vertices and faces.
Definition: SurfaceMesh.h:105
std::size_t Size
The type for counting elements.
Definition: SurfaceMesh.h:103