added check for deleted faces and modified/added std namespace qualifier.
This commit is contained in:
parent
b24b496f50
commit
acf23d578f
vcg/complex/trimesh
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.2 2006/05/18 13:59:20 cignoni
|
||||||
|
Some minor optimizations
|
||||||
|
|
||||||
Revision 1.1 2006/05/16 21:56:06 cignoni
|
Revision 1.1 2006/05/16 21:56:06 cignoni
|
||||||
First working Version
|
First working Version
|
||||||
|
|
||||||
|
@ -137,9 +140,9 @@ class Clustering
|
||||||
void sort()
|
void sort()
|
||||||
{
|
{
|
||||||
//std::sort(&(v[0]),&(v[3]));
|
//std::sort(&(v[0]),&(v[3]));
|
||||||
if(v[0] > v[1] ) swap(v[0],v[1]); // now v0 < v1
|
if(v[0] > v[1] ) std::swap(v[0],v[1]); // now v0 < v1
|
||||||
if(v[0] > v[2] ) swap(v[0],v[2]); // now v0 is the minimum
|
if(v[0] > v[2] ) std::swap(v[0],v[2]); // now v0 is the minimum
|
||||||
if(v[1] > v[2] ) swap(v[1],v[2]); // sorted!
|
if(v[1] > v[2] ) std::swap(v[1],v[2]); // sorted!
|
||||||
}
|
}
|
||||||
// Hashing Function;
|
// Hashing Function;
|
||||||
operator size_t () const
|
operator size_t () const
|
||||||
|
@ -179,6 +182,10 @@ class Clustering
|
||||||
FaceIterator fi;
|
FaceIterator fi;
|
||||||
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
for(fi=m.face.begin();fi!=m.face.end();++fi)
|
||||||
{
|
{
|
||||||
|
if ((*fi).IsD())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
HashedPoint3i pi;
|
HashedPoint3i pi;
|
||||||
SimpleTri st;
|
SimpleTri st;
|
||||||
for(int i=0;i<3;++i)
|
for(int i=0;i<3;++i)
|
||||||
|
@ -200,7 +207,7 @@ class Clustering
|
||||||
{
|
{
|
||||||
m.Clear();
|
m.Clear();
|
||||||
Allocator<MeshType>::AddVertices(m,GridCell.size());
|
Allocator<MeshType>::AddVertices(m,GridCell.size());
|
||||||
std::hash_map<HashedPoint3i,CellType>::iterator gi;
|
STDEXT::hash_map<HashedPoint3i,CellType>::iterator gi;
|
||||||
int i=0;
|
int i=0;
|
||||||
for(gi=GridCell.begin();gi!=GridCell.end();++gi)
|
for(gi=GridCell.begin();gi!=GridCell.end();++gi)
|
||||||
{
|
{
|
||||||
|
@ -209,7 +216,7 @@ class Clustering
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
Allocator<MeshType>::AddFaces(m,TriSet.size());
|
Allocator<MeshType>::AddFaces(m,TriSet.size());
|
||||||
std::hash_set<SimpleTri>::iterator ti;
|
STDEXT::hash_set<SimpleTri>::iterator ti;
|
||||||
i=0;
|
i=0;
|
||||||
for(ti=TriSet.begin();ti!=TriSet.end();++ti)
|
for(ti=TriSet.begin();ti!=TriSet.end();++ti)
|
||||||
{
|
{
|
||||||
|
@ -222,7 +229,7 @@ class Clustering
|
||||||
if( N*(*ti).v[1]->n <0) ++badOrient;
|
if( N*(*ti).v[1]->n <0) ++badOrient;
|
||||||
if( N*(*ti).v[2]->n <0) ++badOrient;
|
if( N*(*ti).v[2]->n <0) ++badOrient;
|
||||||
if(badOrient>2)
|
if(badOrient>2)
|
||||||
swap(m.face[i].V(0),m.face[i].V(1));
|
std::swap(m.face[i].V(0),m.face[i].V(1));
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue