Cleaning and updating all the samples...
This commit is contained in:
parent
a315eceb3d
commit
6750b5d80a
|
|
@ -1,9 +1,11 @@
|
||||||
|
|
||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
SUBDIRS = trimesh_base \
|
SUBDIRS = trimesh_base \
|
||||||
trimesh_topology\
|
trimesh_topology \
|
||||||
trimesh_smooth \
|
trimesh_smooth \
|
||||||
trimesh_curvature \
|
trimesh_curvature \
|
||||||
|
trimesh_normal \
|
||||||
|
trimesh_inertia \
|
||||||
trimesh_refine \
|
trimesh_refine \
|
||||||
trimesh_clustering \
|
trimesh_clustering \
|
||||||
trimesh_isosurface \
|
trimesh_isosurface \
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,15 @@
|
||||||
* for more details. *
|
* 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>
|
#include<vcg/complex/complex.h>
|
||||||
|
|
||||||
|
|
@ -59,13 +68,13 @@ int main()
|
||||||
ih[&*vi]= 1.0f; // or a pointer to it
|
ih[&*vi]= 1.0f; // or a pointer to it
|
||||||
ih[i] = 1.0f; // or an integer index
|
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
|
// you can query if an attribute is present or not
|
||||||
bool hasRadiosity = vcg::tri::HasPerVertexAttribute(m,"Radiosity");
|
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
|
// you can delete an attibute by name
|
||||||
vcg::tri::Allocator<MyMesh>::DeletePerVertexAttribute(m,"Radiosity");
|
vcg::tri::Allocator<MyMesh>::DeletePerVertexAttribute(m,"Radiosity");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,10 @@
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/*! \file trimesh_base.cpp
|
/*! \file trimesh_base.cpp
|
||||||
\brief the minimal example of using the lib
|
|
||||||
\ingroup code_sample
|
\ingroup code_sample
|
||||||
|
|
||||||
|
\brief the minimal example of using the lib
|
||||||
|
|
||||||
This file contain a minimal example of the library
|
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::UpdateTopology<MyMesh>::FaceFace(m);
|
||||||
tri::UpdateCurvature<MyMesh>::PerVertex(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);
|
tri::UpdateNormal<MyMesh>::PerVertexNormalized(m);
|
||||||
printf("Input mesh vn:%i fn:%i\n",m.VN(),m.FN());
|
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() );
|
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/complex.h>
|
||||||
#include <vcg/complex/algorithms/update/topology.h>
|
#include <vcg/complex/algorithms/update/topology.h>
|
||||||
|
|
@ -17,9 +47,8 @@ using namespace std;
|
||||||
|
|
||||||
class MyFace;
|
class MyFace;
|
||||||
class MyVertex;
|
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 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 MyFace : public Face < MyUsedTypes, face::VFAdj, face::Normal3f, face::VertexRef, face::BitFlags > {};
|
||||||
class MyMesh : public vcg::tri::TriMesh<vector<MyVertex>, vector<MyFace> > {};
|
class MyMesh : public vcg::tri::TriMesh<vector<MyVertex>, vector<MyFace> > {};
|
||||||
|
|
@ -32,6 +61,8 @@ int main(int argc,char ** argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Step= atoi(argv[2]);
|
||||||
|
|
||||||
MyMesh m;
|
MyMesh m;
|
||||||
|
|
||||||
//open a mesh
|
//open a mesh
|
||||||
|
|
@ -45,7 +76,6 @@ int main(int argc,char ** argv)
|
||||||
int dup = tri::Clean<MyMesh>::RemoveDuplicateVertex(m);
|
int dup = tri::Clean<MyMesh>::RemoveDuplicateVertex(m);
|
||||||
int unref = tri::Clean<MyMesh>::RemoveUnreferencedVertex(m);
|
int unref = tri::Clean<MyMesh>::RemoveUnreferencedVertex(m);
|
||||||
printf("Removed %i duplicate and %i unreferenced vertices from mesh %s\n",dup,unref,argv[1]);
|
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);
|
tri::UpdateTopology<MyMesh>::VertexFace(m);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue