VCG Library
trimesh_select.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 * VCGLib o o *
3 * Visual and Computer Graphics Library o o *
4 * _ O _ *
5 * Copyright(C) 2004-2016 \/)\/ *
6 * Visual Computing Lab /\/| *
7 * ISTI - Italian National Research Council | *
8 * \ *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
20 * for more details. *
21 * *
22 ****************************************************************************/
29 #include<vcg/complex/complex.h>
30 #include<vcg/complex/algorithms/create/platonic.h>
31 
32 using namespace vcg;
33 using namespace std;
34 
35 
36 class MyFace;
37 class MyVertex;
38 
39 struct MyUsedTypes : public UsedTypes< Use<MyVertex>::AsVertexType, Use<MyFace>::AsFaceType>{};
40 class MyVertex : public Vertex< MyUsedTypes, vertex::VFAdj, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{};
41 class MyFace : public Face < MyUsedTypes, face::VFAdj, face::Normal3f, face::VertexRef, face::BitFlags > {};
42 class MyMesh : public vcg::tri::TriMesh<vector<MyVertex>, vector<MyFace> > {};
43 
44 int main(int ,char ** )
45 {
46  MyMesh m;
47  // build a 10x10 grid of 100 vertices and 200 faces.
48  tri::Grid(m,10,10,1.0f,1.0f);
50  int cornerNum = tri::UpdateSelection<MyMesh>::VertexCornerBorder(m,math::ToRad(100.0f));
51  printf("Mesh has %i vertexes %i faces and %i corners\n",m.VN(),m.FN(),cornerNum);
52 
54  int internalNum = tri::UpdateSelection<MyMesh>::VertexInvert(m);
55  int faceNotOnBoundaryNum = tri::UpdateSelection<MyMesh>::FaceFromVertexStrict(m);
56  printf("%i vertexes are on the boundary and %i internal and internal faces are %i \n",borderNum,internalNum,faceNotOnBoundaryNum);
57  int innerFacesNum = tri::UpdateSelection<MyMesh>::FaceErode(m);
58  printf("Eroding the face selection of on ring of faces bring it to %i faces\n",innerFacesNum);
59 
60 
61  return 0;
62 }
63