OMToolkit 1.0 The polygonal mesh processing tool.

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OMTypes.h
Go to the documentation of this file.
1 //==============================================================================
14 #ifndef _OM_TYPES_H_
15 #define _OM_TYPES_H_
16
17 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
18 #include <MDSTk\Math\mdsMatrix.h>
19 #include <OMToolkit\OMSerializableMatrix.h>
20 #include <OMToolkit\OMSerializableVector.h>
21 #include <Eigen/QR>
22 #include <Eigen/Geometry>
23
24
25 namespace OMToolkit
26 {
27 namespace Types
28 {
29 struct Traits : public OpenMesh::DefaultTraits
30 {
31 //typedef OpenMesh::Vec3d Point; // use double-values points
32 //typedef OpenMesh::Vec3d Normal; // use double-values points
33 };
34
38 typedef OpenMesh::TriMesh_ArrayKernelT<Traits> DefaultMesh;
39
48 template <typename AScalar>
49 class ModuleMesh : public DefaultMesh
50 {
51 public:
52 typedef AScalar AttributeScalar;
53 typedef OMSerializableMatrix<AttributeScalar> VertexMatrix;
54 typedef OMSerializableVector<AttributeScalar> VertexAttributeVector;
55
59 ModuleMesh() : DefaultMesh()
60 {
61 add_property(m_curvature, "<vertexCurvature>");
62 property(m_curvature).set_persistent(true);
63
64 add_property(m_curvature_mag, "<vCurvatureMag>");
65 property(m_curvature_mag).set_persistent(true);
66
67 add_property(m_vertexAttributes, "<vertexAttributes>");
68 property(m_vertexAttributes).set_persistent(true);
69
70 request_vertex_colors();
71
72 add_property(m_matrix, "<vertexMatrix>");
73 property(m_matrix).set_persistent(true);
74
75 add_property(m_flag, "<vertexFlag>");
76 property(m_flag).set_persistent(true);
77 }
78
84 Normal &curvature(VertexHandle vertex) { return property(m_curvature, vertex); }
85
91 AttributeScalar &curvatureMagnitude(VertexHandle vertex) { return property(m_curvature_mag, vertex);}
92
97 OpenMesh::VPropHandleT<AttributeScalar> getCurvatureMagHandle() { return m_curvature_mag; }
98
103 OpenMesh::VPropHandleT<Normal> getCurvatureHandle() { return m_curvature; }
104
109 VertexMatrix &getMatrix(VertexHandle vertex) { return property(m_matrix, vertex);}
110
115 VertexAttributeVector &getAttributes(VertexHandle vertex) { return property(m_vertexAttributes, vertex);}
116
121 OpenMesh::VPropHandleT<VertexMatrix> getMatrixHandle() {return m_matrix;}
122
126 OpenMesh::VPropHandleT<int> m_flag;
127
131 OpenMesh::VPropHandleT<int> getFlagHandle() {return m_flag;}
132
137 OpenMesh::VPropHandleT<VertexAttributeVector> getVertexAttributeHandle() {return m_vertexAttributes;}
138
139 private:
140
144 OpenMesh::VPropHandleT<Normal> m_curvature;
145
149 OpenMesh::VPropHandleT<AttributeScalar> m_curvature_mag;
150
154 OpenMesh::VPropHandleT<VertexMatrix> m_matrix;
155
159 OpenMesh::VPropHandleT<VertexAttributeVector> m_vertexAttributes;
160 };
161
162
163 typedef ModuleMesh<float> ModuleMeshd;
164 } // namespace Types
165 } // namespace OMToolkit
166
167 #endif