45 #include <OpenMesh/Core/IO/MeshIO.hh> 46 #include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh> 77 std::vector<MyMesh::VertexHandle> face_vhandles;
79 face_vhandles.clear();
80 face_vhandles.push_back(vhandle[0]);
81 face_vhandles.push_back(vhandle[1]);
82 face_vhandles.push_back(vhandle[2]);
83 face_vhandles.push_back(vhandle[3]);
84 mesh.add_face(face_vhandles);
86 face_vhandles.clear();
87 face_vhandles.push_back(vhandle[7]);
88 face_vhandles.push_back(vhandle[6]);
89 face_vhandles.push_back(vhandle[5]);
90 face_vhandles.push_back(vhandle[4]);
91 mesh.add_face(face_vhandles);
93 face_vhandles.clear();
94 face_vhandles.push_back(vhandle[1]);
95 face_vhandles.push_back(vhandle[0]);
96 face_vhandles.push_back(vhandle[4]);
97 face_vhandles.push_back(vhandle[5]);
98 mesh.add_face(face_vhandles);
100 face_vhandles.clear();
101 face_vhandles.push_back(vhandle[2]);
102 face_vhandles.push_back(vhandle[1]);
103 face_vhandles.push_back(vhandle[5]);
104 face_vhandles.push_back(vhandle[6]);
105 mesh.add_face(face_vhandles);
107 face_vhandles.clear();
108 face_vhandles.push_back(vhandle[3]);
109 face_vhandles.push_back(vhandle[2]);
110 face_vhandles.push_back(vhandle[6]);
111 face_vhandles.push_back(vhandle[7]);
112 mesh.add_face(face_vhandles);
114 face_vhandles.clear();
115 face_vhandles.push_back(vhandle[0]);
116 face_vhandles.push_back(vhandle[3]);
117 face_vhandles.push_back(vhandle[7]);
118 face_vhandles.push_back(vhandle[4]);
119 mesh.add_face(face_vhandles);
127 std::cerr <<
"Cannot write mesh to file 'output.off'" << std::endl;
131 catch( std::exception& x )
133 std::cerr << x.what() << std::endl;
Kernel::Point Point
Coordinate type.
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
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.
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.