From bebfa3eb8b968137da5caac1b8f861d4abf430d2 Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 15 Oct 2012 14:09:24 +0000 Subject: [PATCH] Removed using namespace vcg from samples --- .../trimesh_attribute/trimesh_attribute.cpp | 37 +++++++++---------- apps/sample/trimesh_base/trimesh_base.cpp | 6 +-- .../trimesh_clustering/trimesh_clustering.cpp | 8 +--- .../trimesh_curvature/trimesh_curvature.cpp | 23 +++++------- 4 files changed, 32 insertions(+), 42 deletions(-) diff --git a/apps/sample/trimesh_attribute/trimesh_attribute.cpp b/apps/sample/trimesh_attribute/trimesh_attribute.cpp index a7d0fed3..9a8b44cf 100644 --- a/apps/sample/trimesh_attribute/trimesh_attribute.cpp +++ b/apps/sample/trimesh_attribute/trimesh_attribute.cpp @@ -31,7 +31,6 @@ Attributes are a simple mechanism to associate user-defined 'attributes' to the */ #include -using namespace vcg; class MyEdge; class MyFace; class MyVertex; @@ -41,22 +40,22 @@ struct MyUsedTypes : public UsedTypes< Use ::AsVertexType, class MyVertex : public Vertex< MyUsedTypes, vertex::Coord3f,vertex::Normal3f>{}; class MyFace : public Face< MyUsedTypes, face::VertexRef, face::Normal3f> {}; -class MyMesh : public tri::TriMesh< std::vector, std::vector > {}; +class MyMesh : public vcg::tri::TriMesh< std::vector, std::vector > {}; int main() { MyMesh m; // add a per-vertex attribute with type float named "Irradiance" - MyMesh::PerVertexAttributeHandle named_hv = tri::Allocator::AddPerVertexAttribute (m,std::string("Irradiance")); + MyMesh::PerVertexAttributeHandle named_hv = vcg::tri::Allocator::AddPerVertexAttribute (m,std::string("Irradiance")); // add a per-vertex attribute with type float named "Radiosity" - tri::Allocator::AddPerVertexAttribute (m,std::string("Radiosity")); + vcg::tri::Allocator::AddPerVertexAttribute (m,std::string("Radiosity")); // add a per-vertex attribute with type bool and no name specified - MyMesh::PerVertexAttributeHandle anon_hv = tri::Allocator::AddPerVertexAttribute (m); + MyMesh::PerVertexAttributeHandle anon_hv = vcg::tri::Allocator::AddPerVertexAttribute (m); // add a per-face attribute with type bool and no name specified - MyMesh::PerFaceAttributeHandle anon_hf = tri::Allocator::AddPerFaceAttribute (m); + MyMesh::PerFaceAttributeHandle anon_hf = vcg::tri::Allocator::AddPerFaceAttribute (m); MyMesh::VertexIterator vi; int i = 0; for(vi = m.vert.begin(); vi != m.vert.end(); ++vi,++i){ @@ -67,30 +66,30 @@ int main() } // query if an attribute is present or not - bool hasRadiosity = tri::HasPerVertexAttribute(m,"Radiosity"); + bool hasRadiosity = vcg::tri::HasPerVertexAttribute(m,"Radiosity"); // obtain another handle of a previously attribute - MyMesh::PerVertexAttributeHandle ret_hv = tri::Allocator::GetPerVertexAttribute(m,"Radiosity"); + MyMesh::PerVertexAttributeHandle ret_hv = vcg::tri::Allocator::GetPerVertexAttribute(m,"Radiosity"); // you can also have PerMesh attributes - MyMesh::PerMeshAttributeHandle hm = tri::Allocator::AddPerMeshAttribute (m,std::string("ADummyIntegerAttribute")); + MyMesh::PerMeshAttributeHandle hm = vcg::tri::Allocator::AddPerMeshAttribute (m,std::string("ADummyIntegerAttribute")); // PerMesh attributes are accessed directly using the handle itself hm() = 10; // delete an attribute by name - tri::Allocator::DeletePerVertexAttribute(m,"Radiosity"); + vcg::tri::Allocator::DeletePerVertexAttribute(m,"Radiosity"); // delete an attribute by handle - tri::Allocator::DeletePerVertexAttribute(m,anon_hv); + vcg::tri::Allocator::DeletePerVertexAttribute(m,anon_hv); bool res; - res = tri::Allocator::IsValidHandle(m,named_hv); printf("Is Valid: %s\n",res?"Yes":"No"); - res = tri::Allocator::IsValidHandle(m,anon_hf); printf("Is Valid: %s\n",res?"Yes":"No"); - res = tri::Allocator::IsValidHandle(m,hm); printf("Is Valid: %s\n",res?"Yes":"No"); - tri::Allocator::DeletePerVertexAttribute(m,ret_hv); - tri::Allocator::DeletePerFaceAttribute(m,anon_hf); - res = tri::Allocator::IsValidHandle(m,named_hv); printf("Is Valid: %s\n",res?"Yes":"No"); - res = tri::Allocator::IsValidHandle(m,anon_hf); printf("Is Valid: %s\n",res?"Yes":"No"); - res = tri::Allocator::IsValidHandle(m,hm); printf("Is Valid: %s\n",res?"Yes":"No"); + res = vcg::tri::Allocator::IsValidHandle(m,named_hv); printf("Is Valid: %s\n",res?"Yes":"No"); + res = vcg::tri::Allocator::IsValidHandle(m,anon_hf); printf("Is Valid: %s\n",res?"Yes":"No"); + res = vcg::tri::Allocator::IsValidHandle(m,hm); printf("Is Valid: %s\n",res?"Yes":"No"); + vcg::tri::Allocator::DeletePerVertexAttribute(m,ret_hv); + vcg::tri::Allocator::DeletePerFaceAttribute(m,anon_hf); + res = vcg::tri::Allocator::IsValidHandle(m,named_hv); printf("Is Valid: %s\n",res?"Yes":"No"); + res = vcg::tri::Allocator::IsValidHandle(m,anon_hf); printf("Is Valid: %s\n",res?"Yes":"No"); + res = vcg::tri::Allocator::IsValidHandle(m,hm); printf("Is Valid: %s\n",res?"Yes":"No"); } diff --git a/apps/sample/trimesh_base/trimesh_base.cpp b/apps/sample/trimesh_base/trimesh_base.cpp index 756390f7..a4028c3c 100644 --- a/apps/sample/trimesh_base/trimesh_base.cpp +++ b/apps/sample/trimesh_base/trimesh_base.cpp @@ -40,8 +40,6 @@ This file contain a minimal example of the library // normals #include -using namespace vcg; -using namespace std; class MyEdge; class MyFace; @@ -53,7 +51,7 @@ struct MyUsedTypes : public UsedTypes< Use ::AsVertexType, class MyVertex : public Vertex{}; class MyFace : public Face< MyUsedTypes, face::FFAdj, face::VertexRef, face::BitFlags > {}; class MyEdge : public Edge{}; -class MyMesh : public tri::TriMesh< vector, vector , vector > {}; +class MyMesh : public vcg::tri::TriMesh< std::vector, std::vector , std::vector > {}; int main( int argc, char **argv ) { @@ -71,7 +69,7 @@ int main( int argc, char **argv ) exit(0); } - tri::UpdateNormal::PerVertexNormalized(m); + vcg::tri::UpdateNormal::PerVertexNormalized(m); printf("Input mesh vn:%i fn:%i\n",m.VN(),m.FN()); printf( "Mesh has %i vert and %i faces\n", m.VN(), m.FN() ); diff --git a/apps/sample/trimesh_clustering/trimesh_clustering.cpp b/apps/sample/trimesh_clustering/trimesh_clustering.cpp index 7c86f2f9..5efd61da 100644 --- a/apps/sample/trimesh_clustering/trimesh_clustering.cpp +++ b/apps/sample/trimesh_clustering/trimesh_clustering.cpp @@ -32,18 +32,14 @@ #include #include -using namespace vcg; -using namespace std; - class MyFace; class MyVertex; -struct MyUsedTypes : public UsedTypes< Use ::AsVertexType, - Use ::AsFaceType>{}; +struct MyUsedTypes : public UsedTypes< Use::AsVertexType, Use::AsFaceType>{}; class MyVertex : public Vertex< MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{}; class MyFace : public Face < MyUsedTypes, face::VertexRef, face::Normal3f, face::BitFlags > {}; -class MyMesh : public vcg::tri::TriMesh< vector, vector > {}; +class MyMesh : public vcg::tri::TriMesh< std::vector, std::vector > {}; int main(int argc, char **argv) { diff --git a/apps/sample/trimesh_curvature/trimesh_curvature.cpp b/apps/sample/trimesh_curvature/trimesh_curvature.cpp index 5fc897ce..e824c810 100644 --- a/apps/sample/trimesh_curvature/trimesh_curvature.cpp +++ b/apps/sample/trimesh_curvature/trimesh_curvature.cpp @@ -28,9 +28,6 @@ #include #include -using namespace vcg; -using namespace std; - class MyEdge; class MyFace; class MyVertex; @@ -41,22 +38,22 @@ struct MyUsedTypes : public UsedTypes< Use ::AsVertexType, class MyVertex : public Vertex{}; class MyFace : public Face< MyUsedTypes, face::FFAdj, face::VertexRef, face::BitFlags > {}; class MyEdge : public Edge{}; -class MyMesh : public tri::TriMesh< vector, vector , vector > {}; +class MyMesh : public vcg::tri::TriMesh< std::vector, std::vector , std::vector > {}; int main( int argc, char **argv ) { MyMesh m; - tri::Torus(m,30,10); - tri::io::ExporterOFF::Save(m,"torus.off"); + vcg::tri::Torus(m,30,10); + vcg::tri::io::ExporterOFF::Save(m,"torus.off"); - tri::UpdateTopology::FaceFace(m); - tri::UpdateCurvature::PerVertex(m); -// tri::UpdateCurvature::MeanAndGaussian(m); -// tri::UpdateCurvature::PrincipalDirections(m); - tri::UpdateCurvature::PrincipalDirectionsNormalCycle(m); -// tri::UpdateCurvature::PrincipalDirectionsPCA(m,m.bbox.Diag()/100); + vcg::tri::UpdateTopology::FaceFace(m); + vcg::tri::UpdateCurvature::PerVertex(m); + vcg::tri::UpdateCurvature::MeanAndGaussian(m); + vcg::tri::UpdateCurvature::PrincipalDirections(m); + vcg::tri::UpdateCurvature::PrincipalDirectionsNormalCycle(m); + vcg::tri::UpdateCurvature::PrincipalDirectionsPCA(m,m.bbox.Diag()/100); - tri::UpdateNormal::PerVertexNormalized(m); + vcg::tri::UpdateNormal::PerVertexNormalized(m); printf("Input mesh vn:%i fn:%i\n",m.VN(),m.FN()); printf( "Mesh has %i vert and %i faces\n", m.VN(), m.FN() );