VCG Library
trimesh_selfintersection.cpp
1 /****************************************************************************
2 * VCGLib o o *
3 * Visual and Computer Graphics Library o o *
4 * _ O _ *
5 * Copyright(C) 2004-2012 \/)\/ *
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 
31 #include<wrap/io_trimesh/import_ply.h>
32 
33 #include<vcg/complex/algorithms/clean.h>
34 #include<vcg/complex/algorithms/update/bounding.h>
35 
36 using namespace vcg;
37 using namespace std;
38 
39 class MyEdge;
40 class MyFace;
41 class MyVertex;
42 struct MyUsedTypes : public UsedTypes< Use<MyVertex> ::AsVertexType,
43  Use<MyEdge> ::AsEdgeType,
44  Use<MyFace> ::AsFaceType>{};
45 
46 class MyVertex : public Vertex<MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{};
47 class MyFace : public Face< MyUsedTypes, face::Mark, face::VertexRef, face::Normal3f, face::BitFlags > {};
48 class MyEdge : public Edge<MyUsedTypes>{};
49 class MyMesh : public tri::TriMesh< vector<MyVertex>, vector<MyFace> , vector<MyEdge> > {};
50 
51 int main( int argc, char **argv )
52 {
53  MyMesh m;
54 
55  if(tri::io::ImporterPLY<MyMesh>::Open(m,"../../meshes/SelfIntersection2.ply")!=0)
56  {
57  printf("Error reading file %s\n",argv[1]);
58  exit(0);
59  }
60  std::vector<MyFace *> retVec;
64  printf("Mesh has %i selfintersecting faces\n",retVec.size());
65  return 0;
66 }