From c50cb1d9cecf53b54828200a040eaeeed5e3040f Mon Sep 17 00:00:00 2001 From: Mike Kremer Date: Wed, 29 Jul 2009 12:32:35 +0000 Subject: [PATCH] Updated tutorial 07 on traits. git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@188 fdac6126-5c0c-442c-9429-916003d36597 --- Doc/Tutorial/07-traits/smooth.cc | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Doc/Tutorial/07-traits/smooth.cc b/Doc/Tutorial/07-traits/smooth.cc index 4385b58c..47d9480d 100644 --- a/Doc/Tutorial/07-traits/smooth.cc +++ b/Doc/Tutorial/07-traits/smooth.cc @@ -3,9 +3,7 @@ // -------------------- OpenMesh #include #include - - -#ifndef DOXY_IGNORE_THIS +#include struct MyTraits : public OpenMesh::DefaultTraits { @@ -23,8 +21,6 @@ struct MyTraits : public OpenMesh::DefaultTraits }; }; -#endif - typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; typedef OpenMesh::TriMesh_ArrayKernelT<> MyMesh2; @@ -38,10 +34,10 @@ template void print_size(const std::string& _prefix = "") { size_t total=0; - SIZEOF(Mesh::Vertex, total); - SIZEOF(Mesh::Halfedge, total); - SIZEOF(Mesh::Edge, total); - SIZEOF(Mesh::Face, total); + SIZEOF(typename Mesh::Vertex, total); + SIZEOF(typename Mesh::Halfedge, total); + SIZEOF(typename Mesh::Edge, total); + SIZEOF(typename Mesh::Face, total); std::cout << _prefix << "total: " << total << std::endl; } @@ -106,16 +102,16 @@ int main(int argc, char **argv) for (vv_it=mesh.vv_iter(v_it.handle()); vv_it; ++vv_it) { - cog += mesh.point( vv_it.handle() ); - ++valence; + cog += mesh.point( vv_it.handle() ); + ++valence; } - v_it->set_cog(cog / valence); + mesh.data(v_it).set_cog(cog / valence); } for (v_it=mesh.vertices_begin(); v_it!=v_end; ++v_it) if (!mesh.is_boundary(v_it.handle())) - mesh.set_point( v_it.handle(), v_it->cog()); + mesh.set_point( v_it.handle(), mesh.data(v_it).cog()); } @@ -129,4 +125,3 @@ int main(int argc, char **argv) } return 1; } -