Cleaning and updating all the samples...
This commit is contained in:
parent
a315eceb3d
commit
6750b5d80a
|
@ -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 \
|
||||
|
|
|
@ -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<vcg/complex/complex.h>
|
||||
|
||||
|
@ -60,12 +69,12 @@ int main()
|
|||
ih[i] = 1.0f; // or an integer index
|
||||
}
|
||||
|
||||
// Once created with AddPerVertexAttribute, an handle to the attribute can be obtained as follows
|
||||
MyMesh::PerVertexAttributeHandle<float> rh = vcg::tri::Allocator<MyMesh>::GetPerVertexAttribute<float>(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<float> rh = vcg::tri::Allocator<MyMesh>::GetPerVertexAttribute<float>(m,"Radiosity");
|
||||
|
||||
// you can delete an attibute by name
|
||||
vcg::tri::Allocator<MyMesh>::DeletePerVertexAttribute(m,"Radiosity");
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
*/
|
||||
|
|
|
@ -60,6 +60,11 @@ int main( int argc, char **argv )
|
|||
|
||||
tri::UpdateTopology<MyMesh>::FaceFace(m);
|
||||
tri::UpdateCurvature<MyMesh>::PerVertex(m);
|
||||
tri::UpdateCurvature<MyMesh>::MeanAndGaussian(m);
|
||||
tri::UpdateCurvature<MyMesh>::PrincipalDirections(m);
|
||||
tri::UpdateCurvature<MyMesh>::PrincipalDirectionsNormalCycle(m);
|
||||
tri::UpdateCurvature<MyMesh>::PrincipalDirectionsPCA(m,m.bbox.Diag()/100);
|
||||
|
||||
tri::UpdateNormal<MyMesh>::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() );
|
||||
|
|
|
@ -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<vcg/complex/complex.h>
|
||||
#include <vcg/complex/algorithms/update/topology.h>
|
||||
|
@ -17,9 +47,8 @@ using namespace std;
|
|||
|
||||
class MyFace;
|
||||
class MyVertex;
|
||||
struct MyUsedTypes : public UsedTypes< Use<MyVertex>::AsVertexType,
|
||||
Use<MyFace>::AsFaceType>{};
|
||||
|
||||
struct MyUsedTypes : public UsedTypes< Use<MyVertex>::AsVertexType, Use<MyFace>::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<MyVertex>, vector<MyFace> > {};
|
||||
|
@ -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<MyMesh>::RemoveDuplicateVertex(m);
|
||||
int unref = tri::Clean<MyMesh>::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<MyMesh>::VertexFace(m);
|
||||
|
||||
|
|
Loading…
Reference in New Issue