4 #include <OpenMesh/Core/IO/MeshIO.hh> 5 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh> 10 int main(
int argc,
char **argv)
18 std::cerr <<
"Usage: " << argv[0] <<
" #iterations infile outfile\n";
27 std::cerr <<
"Error: Cannot read mesh from " << argv[2] << std::endl;
35 mesh.add_property(cogs);
38 MyMesh::VertexIter v_it, v_end(mesh.vertices_end());
42 unsigned int i, N(atoi(argv[1]));
47 for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it)
49 mesh.property(cogs,v_it).vectorize(0.0f);
52 for (vv_it=mesh.vv_iter( v_it ); vv_it; ++vv_it)
54 mesh.property(cogs,v_it) += mesh.point( vv_it );
57 mesh.property(cogs,v_it) /= valence;
60 for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it)
61 if ( !mesh.is_boundary( v_it ) )
62 mesh.set_point( v_it, mesh.property(cogs,v_it) );
69 std::cerr <<
"Error: cannot write mesh to " << argv[3] << std::endl;
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Kernel::VertexVertexIter VertexVertexIter
Circulator.
Kernel::Point Point
Coordinate type.
Kernel::Scalar Scalar
Scalar 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.