3 #include <OpenMesh/Core/IO/MeshIO.hh>
4 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
10 int main(
int argc,
char **argv)
16 std::cerr <<
"Usage: " << argv[0] <<
" <input>\n";
22 mesh.request_vertex_normals();
25 if (!mesh.has_vertex_normals())
27 std::cerr <<
"ERROR: Standard vertex property 'Normals' not available!\n";
34 std::cerr <<
"Error loading mesh from file " << argv[1] << std::endl;
42 mesh.request_face_normals();
48 mesh.release_face_normals();
52 for (MyMesh::VertexIter v_it = mesh.vertices_begin();
53 v_it != mesh.vertices_end(); ++v_it)
55 std::cout <<
"Vertex #" << *v_it <<
": " << mesh.point( *v_it );
56 mesh.set_point( *v_it, mesh.point(*v_it)+mesh.normal(*v_it) );
57 std::cout <<
" moved to " << mesh.point( *v_it ) << std::endl;
61 mesh.release_vertex_normals();
64 if (mesh.has_vertex_normals())
66 std::cerr <<
"Ouch! ERROR! Shouldn't have any vertex normals anymore!\n";
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Has (r) / store (w) vertex normals.
Set options for reader/writer modules.
void update_normals()
Compute normals for all primitives.