52 #include <OpenMesh/Core/IO/MeshIO.hh> 53 #include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh> 84 std::vector<MyMesh::VertexHandle> face_vhandles;
86 face_vhandles.clear();
87 face_vhandles.push_back(vhandle[0]);
88 face_vhandles.push_back(vhandle[1]);
89 face_vhandles.push_back(vhandle[2]);
90 face_vhandles.push_back(vhandle[3]);
91 mesh.add_face(face_vhandles);
93 face_vhandles.clear();
94 face_vhandles.push_back(vhandle[7]);
95 face_vhandles.push_back(vhandle[6]);
96 face_vhandles.push_back(vhandle[5]);
97 face_vhandles.push_back(vhandle[4]);
98 mesh.add_face(face_vhandles);
100 face_vhandles.clear();
101 face_vhandles.push_back(vhandle[1]);
102 face_vhandles.push_back(vhandle[0]);
103 face_vhandles.push_back(vhandle[4]);
104 face_vhandles.push_back(vhandle[5]);
105 mesh.add_face(face_vhandles);
107 face_vhandles.clear();
108 face_vhandles.push_back(vhandle[2]);
109 face_vhandles.push_back(vhandle[1]);
110 face_vhandles.push_back(vhandle[5]);
111 face_vhandles.push_back(vhandle[6]);
112 mesh.add_face(face_vhandles);
114 face_vhandles.clear();
115 face_vhandles.push_back(vhandle[3]);
116 face_vhandles.push_back(vhandle[2]);
117 face_vhandles.push_back(vhandle[6]);
118 face_vhandles.push_back(vhandle[7]);
119 mesh.add_face(face_vhandles);
121 face_vhandles.clear();
122 face_vhandles.push_back(vhandle[0]);
123 face_vhandles.push_back(vhandle[3]);
124 face_vhandles.push_back(vhandle[7]);
125 face_vhandles.push_back(vhandle[4]);
126 mesh.add_face(face_vhandles);
134 std::cerr <<
"Cannot write mesh to file 'output.off'" << std::endl;
138 catch( std::exception& x )
140 std::cerr << x.what() << std::endl;
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
Kernel::Point Point
Coordinate type.
bool write_mesh(const Mesh &_mesh, const std::string &_filename, Options _opt=Options::Default, std::streamsize _precision=6)
Write a mesh to the file _filename.