OMToolkit  1.0
The polygonal mesh processing tool.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OMCurvature.h
Go to the documentation of this file.
1 //==============================================================================
14 #ifndef _OM_CURVATURE_H_
15 #define _OM_CURVATURE_H_
16 
17 #include <OpenMesh\Core\Utils\Property.hh>
18 #include <math.h>
19 #include <Eigen/QR>
20 
21 namespace OMToolkit
22 {
28  template <class Mesh, class Scalar>
30  {
31  protected:
35  typedef typename Mesh::Normal Normal;
36 
40  typedef typename Mesh::VertexHandle VertexHandle;
41 
45  typedef typename Mesh::FaceHandle FaceHandle;
46 
50  typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
51 
55  typedef Eigen::Matrix<Scalar, 3, 3> Matrix3x3;
56 
60  typedef Eigen::Matrix<Scalar, 2, 2> Matrix2x2;
61 
65  typedef Eigen::Matrix<Scalar, 1, 3> RowVector3;
66 
70  typedef Eigen::Matrix<Scalar, 1, 2> RowVector2;
71 
75  typedef Eigen::Matrix<Scalar, 3, 1> ColumnVector3;
76 
80  typedef Eigen::Matrix<Scalar, 3, 1> ColumnVector2;
81 
82  public:
83 
90  OMCurvature(Mesh *mesh, OpenMesh::VPropHandleT<Normal> &curvVectorHandle, OpenMesh::VPropHandleT<Scalar> &curvMagHandle);
91 
96  bool calcMeanCurvature();
97 
102  bool calcGaussCurvature();
103 
109  bool calcMinCurvature();
110 
116  bool calcMaxCurvature();
117 
118  protected:
126  void getCurvatureDirections(VertexHandle vertex, Normal &max, Normal &min);
127 
133  Scalar getVoronoiArea(VertexHandle vertex);
134 
141 
147  Scalar getGaussOperator(VertexHandle vertex);
148 
155  Scalar getVoronoiAreaTri(FaceHandle face, VertexHandle vertex);
156 
163  Scalar getVoronoiAreaTriO(FaceHandle face, VertexHandle vertex);
164 
171  bool isObtuse(FaceHandle face, HalfedgeHandle &half_edge);
172 
176  Mesh *m_mesh;
177 
181  OpenMesh::VPropHandleT<Normal> m_curvVectorHandle;
182 
186  OpenMesh::VPropHandleT<Scalar> m_curvMagHandle;
187 
191  typedef OpenMesh::VectorT<Scalar, 3> AreasVector;
192 
196  OpenMesh::FPropHandleT<AreasVector> m_areas;
197  }; // class
198 
199 #include <OMToolkit\OMCurvature.hxx>
200 } // namespace OMToolkit
201 
202 #endif