Developer Documentation

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mymesh.cc
1 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
2
3
4 // define traits
5 struct MyTraits : public OpenMesh::DefaultTraits
6 {
7 // use double valued coordinates
8 typedef OpenMesh::Vec3d Point;
9
10 // use vertex normals and vertex colors
11 VertexAttributes( OpenMesh::DefaultAttributer::Normal |
12 OpenMesh::DefaultAttributer::Color );
13
14 // store the previous halfedge
15 HalfedgeAttributes( OpenMesh::DefaultAttributer::PrevHalfedge );
16
17 // use face normals
18 FaceAttributes( OpenMesh::DefaultAttributer::Normal );
19
20 // store a face handle for each vertex
21 VertexTraits
22 {
23 typename Base::Refs::FaceHandle my_face_handle;
24 };
25
26 };
27
28
29 // Select mesh type (TriMesh) and kernel (ArrayKernel)
30 // and define my personal mesh type (MyMesh)
31 typedef OpenMesh::TriMesh_ArrayKernelT<MyTraits> MyMesh;
32
33 int main(int argc, char **argv)
34 {
35 MyMesh mesh;
36
37 // -------------------- Add dynamic data
38
39 // for each vertex an extra double value
40 OpenMesh::VPropHandleT< double > vprop_double;
41 mesh.add_property( vprop_double );
42
43 // for the mesh an extra string
44 OpenMesh::MPropHandleT< string > mprop_string;
45 mesh.add_property( mprop_string );
46
47 // -------------------- do something
48
49 ...;
50
51 }
OpenMesh::Attributes::Color
Add colors to mesh item (vertices/faces/edges)
Definition: Attributes.hh:88
OpenMesh::TriMesh_ArrayKernelT
Definition: TriMesh_ArrayKernelT.hh:98
OpenMesh::VPropHandleT
Definition: Property.hh:487
OpenMesh::VectorT< double, 3 >
OpenMesh::Attributes::PrevHalfedge
Add storage for previous halfedge (halfedges). The bit is set by default in the DefaultTraits.
Definition: Attributes.hh:89
OpenMesh::Attributes::Normal
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:87
MyTraits
Definition: mymesh.cc:5
OpenMesh::MPropHandleT
Definition: Property.hh:543
OpenMesh::DefaultTraits
Definition: Traits.hh:126