diff --git a/apps/sample/sample.pro b/apps/sample/sample.pro index ab414706..07e6859b 100644 --- a/apps/sample/sample.pro +++ b/apps/sample/sample.pro @@ -1,9 +1,11 @@ TEMPLATE = subdirs SUBDIRS = trimesh_base \ - trimesh_topology\ + trimesh_topology \ trimesh_smooth \ trimesh_curvature \ + trimesh_normal \ + trimesh_inertia \ trimesh_refine \ trimesh_clustering \ trimesh_isosurface \ diff --git a/apps/sample/trimesh_attribute/trimesh_attribute.cpp b/apps/sample/trimesh_attribute/trimesh_attribute.cpp index b4507443..a846fe7e 100644 --- a/apps/sample/trimesh_attribute/trimesh_attribute.cpp +++ b/apps/sample/trimesh_attribute/trimesh_attribute.cpp @@ -20,6 +20,15 @@ * for more details. * * * ****************************************************************************/ +/*! \file trimesh_attribute.cpp +\ingroup code_sample + +\brief the minimal example of using the attributes + +Attributes are a simple mechanism to associate user-defined 'attributes' to the simplicies and to the mesh. +\ref attributes for more Details + +*/ #include @@ -59,13 +68,13 @@ int main() ih[&*vi]= 1.0f; // or a pointer to it ih[i] = 1.0f; // or an integer index } - - // Once created with AddPerVertexAttribute, an handle to the attribute can be obtained as follows - MyMesh::PerVertexAttributeHandle rh = vcg::tri::Allocator::GetPerVertexAttribute(m,"Radiosity"); // you can query if an attribute is present or not bool hasRadiosity = vcg::tri::HasPerVertexAttribute(m,"Radiosity"); + // Once created with AddPerVertexAttribute, an handle to the attribute can be obtained as follows + MyMesh::PerVertexAttributeHandle rh = vcg::tri::Allocator::GetPerVertexAttribute(m,"Radiosity"); + // you can delete an attibute by name vcg::tri::Allocator::DeletePerVertexAttribute(m,"Radiosity"); diff --git a/apps/sample/trimesh_base/trimesh_base.cpp b/apps/sample/trimesh_base/trimesh_base.cpp index 13f120a8..756390f7 100644 --- a/apps/sample/trimesh_base/trimesh_base.cpp +++ b/apps/sample/trimesh_base/trimesh_base.cpp @@ -21,9 +21,10 @@ * * ****************************************************************************/ /*! \file trimesh_base.cpp -\brief the minimal example of using the lib \ingroup code_sample +\brief the minimal example of using the lib + This file contain a minimal example of the library */ diff --git a/apps/sample/trimesh_curvature/trimesh_curvature.cpp b/apps/sample/trimesh_curvature/trimesh_curvature.cpp index 2485ea84..15b1cb73 100644 --- a/apps/sample/trimesh_curvature/trimesh_curvature.cpp +++ b/apps/sample/trimesh_curvature/trimesh_curvature.cpp @@ -60,6 +60,11 @@ int main( int argc, char **argv ) 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); + 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_smooth/trimesh_smooth.cpp b/apps/sample/trimesh_smooth/trimesh_smooth.cpp index c1b0a98d..187c038e 100644 --- a/apps/sample/trimesh_smooth/trimesh_smooth.cpp +++ b/apps/sample/trimesh_smooth/trimesh_smooth.cpp @@ -1,3 +1,33 @@ +/**************************************************************************** +* VCGLib o o * +* Visual and Computer Graphics Library o o * +* _ O _ * +* Copyright(C) 2004-2012 \/)\/ * +* Visual Computing Lab /\/| * +* ISTI - Italian National Research Council | * +* \ * +* All rights reserved. * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * +* for more details. * +* * +****************************************************************************/ +/*! \file trimesh_smooth.cpp +\ingroup code_sample + +\brief the minimal example of using the lib + +This file contain a minimal example of the library + +*/ #include #include @@ -17,9 +47,8 @@ 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::VFAdj, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{}; class MyFace : public Face < MyUsedTypes, face::VFAdj, face::Normal3f, face::VertexRef, face::BitFlags > {}; class MyMesh : public vcg::tri::TriMesh, vector > {}; @@ -32,6 +61,8 @@ int main(int argc,char ** argv) return 0; } + int Step= atoi(argv[2]); + MyMesh m; //open a mesh @@ -45,7 +76,6 @@ int main(int argc,char ** argv) int dup = tri::Clean::RemoveDuplicateVertex(m); int unref = tri::Clean::RemoveUnreferencedVertex(m); printf("Removed %i duplicate and %i unreferenced vertices from mesh %s\n",dup,unref,argv[1]); - int Step= atoi(argv[2]); tri::UpdateTopology::VertexFace(m);