Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include<vcg/complex/complex.h>
00025 #include<vcg/complex/algorithms/create/platonic.h>
00026
00027 #include<vcg/complex/algorithms/update/topology.h>
00028
00029 #include<vcg/simplex/face/pos.h>
00030
00031 using namespace vcg;
00032
00033 class MyEdge;
00034 class MyFace;
00035 class MyVertex;
00036 struct MyUsedTypes : public UsedTypes< Use<MyVertex>::AsVertexType, Use<MyFace>::AsFaceType>{};
00037
00038 class MyVertex : public Vertex< MyUsedTypes, vertex::Coord3f, vertex::BitFlags >{};
00039 class MyFace : public Face < MyUsedTypes, face::VertexRef,face::FFAdj, face::Mark, face::BitFlags > {};
00040 class MyMesh : public tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace > >{};
00041
00042
00043 int main(int ,char ** )
00044 {
00045 MyMesh m;
00046
00047
00048 vcg::tri::Icosahedron(m);
00049
00050
00051 vcg::tri::UpdateTopology<MyMesh>::FaceFace(m);
00052
00053
00054
00055 if(face::IsBorder(m.face[0],0)) printf("Edge 0 of face 0 is a border\n");
00056 else printf("Edge 0 of face 0 is NOT a border\n");
00057
00058 vcg::face::FFDetach<MyFace>(m.face[0],0);
00059 vcg::face::FFDetach<MyFace>(m.face[0],1);
00060 vcg::face::FFDetach<MyFace>(m.face[0],2);
00061
00062 if(face::IsBorder(m.face[0],0)) printf("Edge 0 of face 0 is a border\n");
00063 else printf("Edge 0 of face 0 is NOT a border\n");
00064
00065 tri::Allocator<MyMesh>::DeleteFace(m,m.face[0]);
00066
00067
00068 vcg::face::Pos<MyMesh::FaceType> he, hei;
00069
00070 UnMarkAll(m);
00071
00072
00073 int BorderEdgeNum=0;
00074 int HoleNum=0;
00075 for(MyMesh::FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD())
00076 {
00077 for(int j=0;j<3;j++)
00078 {
00079 if ( face::IsBorder(*fi,j) && !tri::IsMarked(m,&*fi))
00080 {
00081 tri::Mark(m,&*fi);
00082 hei.Set(&*fi,j,fi->V(j));
00083 he=hei;
00084 do
00085 {
00086 BorderEdgeNum++;
00087 he.NextB();
00088 tri::Mark(m,he.f);
00089 }
00090 while (he.f!=hei.f);
00091 HoleNum++;
00092 }
00093 }
00094 }
00095
00096 printf("Mesh has %i holes and %i border edges\n",HoleNum,BorderEdgeNum);
00097 return 0;
00098 }
00099