OMToolkit  1.0
The polygonal mesh processing tool.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OMMatrixCurvature.h
Go to the documentation of this file.
1 //==============================================================================
14 #include <OMToolkit\OMTypes.h>
15 
16 namespace OMToolkit
17 {
19  {
20  public:
22  typedef MeshT::Scalar ScalarT;
23  typedef MeshT::Normal NormalT;
27 
28  OMMatrixCurvature(MeshT *mesh);
29  bool Compute(OpenMesh::VPropHandleT<MatrixT> matrixH, OpenMesh::VPropHandleT<NormalT> curvatureH, OpenMesh::VPropHandleT<AScalarT> curvatureMagH, MatrixType type = MAX);
30  private:
31  MeshT *m_mesh;
32  };
33 
34  static OMMatrixCurvature::AScalarT sobelHoriz3x3[] = { 1.0, 0.0, -1.0,
35  2.0, 0.0, -2.0,
36  1.0, 0.0, -1.0 };
37 
38  static OMMatrixCurvature::AScalarT sobelVert3x3[] = { 1.0, 2.0, 1.0,
39  0.0, 0.0, 0.0,
40  -1.0, -2.0, -1.0 };
41 
42  static OMMatrixCurvature::AScalarT sobelHoriz5x5[] = { 2.0, 1.0, 0.0, -1.0, -2.0,
43  3.0, 2.0, 0.0, -2.0, -3.0,
44  4.0, 3.0, 0.0, -3.0, -4.0,
45  3.0, 2.0, 0.0, -2.0, -3.0,
46  2.0, 1.0, 0.0, -1.0, -2.0 };
47 
48  static OMMatrixCurvature::AScalarT sobelVert5x5[] = { 2.0, 3.0, 4.0, 3.0, 2.0,
49  1.0, 2.0, 3.0, 2.0, 1.0,
50  0.0, 0.0, 0.0, 0.0, 0.0,
51  -1.0, -2.0, -3.0, -2.0, -1.0,
52  -2.0, -3.0, -4.0, -3.0, -2.0 };
53 
54  static OMMatrixCurvature::AScalarT sobelHoriz7x7[] = { 3.0, 2.0, 1.0, 0.0, -1.0, -2.0, -3.0,
55  4.0, 3.0, 2.0, 0.0, -2.0, -3.0, -4.0,
56  5.0, 4.0, 3.0, 0.0, -3.0, -4.0, -5.0,
57  6.0, 5.0, 4.0, 0.0, -4.0, -5.0, -6.0,
58  5.0, 4.0, 3.0, 0.0, -3.0, -4.0, -5.0,
59  4.0, 3.0, 2.0, 0.0, -2.0, -3.0, -4.0,
60  3.0, 2.0, 1.0, 0.0, -1.0, -2.0, -3.0 };
61 
62  static OMMatrixCurvature::AScalarT sobelVert7x7[] = { 3.0, 4.0, 5.0, 6.0, 5.0, 4.0, 3.0,
63  2.0, 3.0, 4.0, 5.0, 4.0, 3.0, 2.0,
64  1.0, 2.0, 3.0, 4.0, 3.0, 2.0, 1.0,
65  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
66  -1.0, -2.0, -3.0, -4.0, -3.0, -2.0, -1.0,
67  -2.0, -3.0, -4.0, -5.0, -4.0, -3.0, -2.0,
68  -3.0, -4.0, -5.0, -6.0, -5.0, -4.0, -3.0 };
69 
70  static OMMatrixCurvature::AScalarT sobelHoriz9x9[] = { 4.0, 3.0, 2.0, 1.0, 0.0, -1.0, -2.0, -3.0, -4.0,
71  5.0, 4.0, 3.0, 2.0, 0.0, -2.0, -3.0, -4.0, -5.0,
72  6.0, 5.0, 4.0, 3.0, 0.0, -3.0, -4.0, -5.0, -6.0,
73  7.0, 6.0, 5.0, 4.0, 0.0, -4.0, -5.0, -6.0, -7.0,
74  8.0, 7.0, 6.0, 5.0, 0.0, -5.0, -6.0, -7.0, -8.0,
75  7.0, 6.0, 5.0, 4.0, 0.0, -4.0, -5.0, -6.0, -7.0,
76  6.0, 5.0, 4.0, 3.0, 0.0, -3.0, -4.0, -5.0, -6.0,
77  5.0, 4.0, 3.0, 2.0, 0.0, -2.0, -3.0, -4.0, -5.0,
78  4.0, 3.0, 2.0, 1.0, 0.0, -1.0, -2.0, -3.0, -4.0 };
79 
80  static OMMatrixCurvature::AScalarT sobelVert9x9[] = { 4.0, 5.0, 6.0, 7.0, 8.0, 7.0, 6.0, 5.0, 4.0,
81  3.0, 4.0, 5.0, 6.0, 7.0, 6.0, 5.0, 4.0, 3.0,
82  2.0, 3.0, 4.0, 5.0, 6.0, 5.0, 4.0, 3.0, 2.0,
83  1.0, 2.0, 3.0, 4.0, 5.0, 4.0, 3.0, 2.0, 1.0,
84  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
85  -1.0, -2.0, -3.0, -4.0, -5.0, -4.0, -3.0, -2.0, -1.0,
86  -2.0, -3.0, -4.0, -5.0, -6.0, -5.0, -4.0, -3.0, -2.0,
87  -3.0, -4.0, -5.0, -6.0, -7.0, -6.0, -5.0, -4.0, -3.0,
88  -4.0, -5.0, -6.0, -7.0, -8.0, -7.0, -6.0, -5.0, -4.0 };
89  }