Fixed manifold Test
This commit is contained in:
parent
eb14792ee4
commit
1610300e86
|
@ -24,6 +24,9 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.6 2005/09/30 14:13:01 rita_borgo
|
||||
Problem: Text not aligned
|
||||
|
||||
Revision 1.5 2005/09/30 13:29:40 rita_borgo
|
||||
Fixed Manifold Test
|
||||
|
||||
|
@ -66,13 +69,10 @@ Added Standard comments
|
|||
#include <string>
|
||||
#include <stack>
|
||||
using namespace std;
|
||||
|
||||
#include<vcg/simplex/vertex/vertex.h>
|
||||
#include<vcg/simplex/face/with/afav.h>
|
||||
#include<vcg/simplex/face/topology.h>
|
||||
#include<vcg/simplex/face/pos.h> // mi sembra di averlo aggiunto!
|
||||
|
||||
|
||||
#include<vcg/complex/trimesh/base.h>
|
||||
#include<vcg/complex/trimesh/update/topology.h>
|
||||
#include <vcg/complex/trimesh/update/edges.h>
|
||||
|
@ -84,35 +84,27 @@ using namespace std;
|
|||
#include <wrap/io_trimesh/export_ply.h>
|
||||
#include <wrap/io_trimesh/export_stl.h>
|
||||
#include <wrap/io_trimesh/export_dxf.h>
|
||||
|
||||
#include "XMLTree.h"
|
||||
#include <wrap/io_trimesh/export_off.h>
|
||||
|
||||
|
||||
// loader
|
||||
#include<wrap/io_trimesh/import_ply.h>
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
string ans;
|
||||
using namespace vcg;
|
||||
using namespace tri;
|
||||
using namespace face;
|
||||
int prova1;
|
||||
|
||||
class MyFace;
|
||||
class MyEdge;
|
||||
class MyVertex : public Vertex<float,MyEdge,MyFace>{};
|
||||
class MyFace :public FaceAFAV<MyVertex,MyEdge,MyFace>{};
|
||||
class MyMesh: public tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace > >{};
|
||||
|
||||
|
||||
typedef MyMesh::VertexPointer VertexPointer;
|
||||
typedef MyMesh::VertexIterator VertexIterator;
|
||||
|
||||
typedef Point3<MyMesh::ScalarType> Point3x;
|
||||
typedef vector<Point3x> Hole;
|
||||
|
||||
string ans;
|
||||
|
||||
void OpenMesh(const char *filename, MyMesh &m)
|
||||
{
|
||||
int err = tri::io::Importer<MyMesh>::Open(m,filename);
|
||||
|
@ -122,8 +114,6 @@ void OpenMesh(const char *filename, MyMesh &m)
|
|||
}
|
||||
printf("read mesh `%s'\n", filename);
|
||||
}
|
||||
|
||||
|
||||
inline char* GetExtension(char* filename)
|
||||
{
|
||||
for(int i=strlen(filename)-1; i >= 0; i--)
|
||||
|
@ -134,11 +124,8 @@ inline char* GetExtension(char* filename)
|
|||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
typedef MyMesh::VertexPointer VertexPointer;
|
||||
typedef MyMesh::VertexIterator VertexIterator;
|
||||
|
||||
/* classe di confronto per l'algoritmo di individuazione vertici duplicati*/
|
||||
template <class VertexIterator>
|
||||
class DuplicateVert_Compare{
|
||||
|
@ -148,11 +135,8 @@ public:
|
|||
return *a < *b;
|
||||
}
|
||||
};
|
||||
|
||||
static int DuplicateVertex( MyMesh & m )// V1.0
|
||||
{
|
||||
|
||||
if(m.vert.size()==0 || m.vn==0)
|
||||
{if(m.vert.size()==0 || m.vn==0)
|
||||
return 0;
|
||||
std::map<VertexPointer, VertexPointer> mp;
|
||||
int i,j;
|
||||
|
@ -163,9 +147,7 @@ static int DuplicateVertex( MyMesh & m ) // V1.0
|
|||
vector<VertexPointer> perm(num_vert);
|
||||
for(vi=m.vert.begin(); vi!=m.vert.end(); ++vi, ++k)
|
||||
perm[k] = &(*vi);
|
||||
|
||||
DuplicateVert_Compare<VertexPointer> c_obj;
|
||||
|
||||
std::sort(perm.begin(),perm.end(),c_obj);
|
||||
j = 0;
|
||||
i = j;
|
||||
|
@ -203,25 +185,19 @@ static int DuplicateVertex( MyMesh & m ) // V1.0
|
|||
return deleted;
|
||||
}
|
||||
|
||||
|
||||
void main(int argc,char ** argv){
|
||||
|
||||
|
||||
MyMesh m;
|
||||
bool DEBUG = true;
|
||||
int k;
|
||||
k=3;
|
||||
bool DEBUG=false;
|
||||
|
||||
int j;
|
||||
j=0;
|
||||
cout<<"Punto 1"<<endl;
|
||||
/*------------XML file part ------------------*/
|
||||
|
||||
static char* XML_SCHEMA_NAME = "protegekb";
|
||||
/*------------XML file part ------------------*/static char* XML_SCHEMA_NAME = "protegekb";
|
||||
XMLTree doc;
|
||||
MainNode* mn = new MainNode;
|
||||
|
||||
/*--------------------------------------------*/
|
||||
cout<<"Punto 2"<<endl;
|
||||
|
||||
|
||||
//load the mesh
|
||||
//argv[1]=(char*)"c:\\checkup\\debug\\column1m.ply";
|
||||
|
@ -235,7 +211,7 @@ cout<<"Punto 2"<<endl;
|
|||
" release date: "__DATE__"\n"
|
||||
"-------------------------------\n\n");
|
||||
|
||||
cout<<"Punto 3"<<endl;
|
||||
|
||||
|
||||
if(DEBUG)
|
||||
argv[1] = "C:\\sf\\apps\\msvc\\trimeshinfo\\Release\\tests\\kite_hole3.ply";
|
||||
|
@ -249,12 +225,13 @@ cout<<"Punto 3"<<endl;
|
|||
exit(-1);
|
||||
}
|
||||
}
|
||||
cout<<"Punto 4"<<endl;
|
||||
|
||||
|
||||
|
||||
OpenMesh(argv[1],m);
|
||||
|
||||
cout<<"Punto 5"<<endl;
|
||||
|
||||
|
||||
|
||||
|
||||
/*------------XML file part ------------------*/
|
||||
|
@ -281,7 +258,6 @@ cout<<"Punto 5"<<endl;
|
|||
printf("\t Number of faces: %d \n", m.fn);
|
||||
|
||||
|
||||
cout<<"Punto 6"<<endl;
|
||||
|
||||
/*------------XML file part ------------------*/
|
||||
NodeGroup* ng = new NodeGroup;
|
||||
|
@ -315,7 +291,6 @@ cout<<"Punto 6"<<endl;
|
|||
ng->addNode(osn);
|
||||
/*--------------------------------------------*/
|
||||
|
||||
cout<<"Punto 7"<<endl;
|
||||
|
||||
|
||||
if(m.HasPerFaceColor()||m.HasPerVertexColor())
|
||||
|
@ -341,7 +316,7 @@ cout<<"Punto 7"<<endl;
|
|||
/*--------------------------------------------*/
|
||||
}
|
||||
|
||||
cout<<"Punto 8"<<endl;
|
||||
|
||||
vcg::tri::UpdateTopology<MyMesh>::FaceFace(m);
|
||||
|
||||
// IS MANIFOLD
|
||||
|
@ -350,8 +325,13 @@ cout<<"Punto 7"<<endl;
|
|||
vcg::face::Pos<MyMesh::FaceType> he;
|
||||
vcg::face::Pos<MyMesh::FaceType> hei;
|
||||
|
||||
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
||||
for(fi=m.face.begin();fi!=m.face.end();fi++)
|
||||
{
|
||||
(*fi).ClearB(0);
|
||||
(*fi).ClearB(1);
|
||||
(*fi).ClearB(2);
|
||||
(*fi).ClearS();
|
||||
}
|
||||
int cf=0;
|
||||
bool Manifold=true;
|
||||
|
||||
|
@ -368,13 +348,12 @@ cout<<"Punto 7"<<endl;
|
|||
--fi;
|
||||
j=3;
|
||||
}
|
||||
else if((!fi->HasFFAdjacency())&&(fi!=m.face.begin()))
|
||||
}
|
||||
if((BorderCount(*fi)>0))
|
||||
{
|
||||
Manifold = false;
|
||||
fi= m.face.end();
|
||||
--fi;
|
||||
j=3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -692,6 +671,7 @@ cout<<"Punto 7"<<endl;
|
|||
// CONNECTED COMPONENTS
|
||||
|
||||
vector<int> nrfaces;
|
||||
nrfaces.reserve(1);
|
||||
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
||||
(*fi).ClearS();
|
||||
gi=m.face.begin(); fi=gi;
|
||||
|
@ -703,7 +683,7 @@ cout<<"Punto 7"<<endl;
|
|||
if (!(*fi).IsS())
|
||||
{
|
||||
(*fi).SetS();
|
||||
(*fi).Q()=Compindex;
|
||||
//(*fi).Q()=Compindex;
|
||||
nrfaces.push_back(1);
|
||||
sf.push(fi);
|
||||
while (!sf.empty())
|
||||
|
@ -776,7 +756,7 @@ cout<<"Punto 7"<<endl;
|
|||
else//(!Manifold)
|
||||
{
|
||||
fprintf( index,"<p>Genus: UNDEFINED, mesh is non-manifold </p>\n");
|
||||
printf( "Genus: UNDEFINED, mesh is non-manifold \n");
|
||||
printf( "\t Genus: UNDEFINED, mesh is non-manifold \n");
|
||||
}
|
||||
// REGULARITY
|
||||
|
||||
|
|
Loading…
Reference in New Issue