converted to the new style with mark outside the trimesh class

This commit is contained in:
Paolo Cignoni 2010-03-19 22:56:30 +00:00
parent 2f8a8945cc
commit d55a1069de
2 changed files with 12 additions and 11 deletions

View File

@ -262,9 +262,9 @@ public:
if( !face::IsBorder(*fpt,j) ) if( !face::IsBorder(*fpt,j) )
{ {
FacePointer l=fpt->FFp(j); FacePointer l=fpt->FFp(j);
if( !mp->IsMarked(l) ) if( !tri::IsMarked(*mp,l) )
{ {
mp->Mark(l); tri::Mark(*mp,l);
sf.push(l); sf.push(l);
} }
} }
@ -274,10 +274,10 @@ public:
{ {
mp=&m; mp=&m;
while(!sf.empty()) sf.pop(); while(!sf.empty()) sf.pop();
mp->UnMarkAll(); UnMarkAll(m);
assert(p); assert(p);
assert(!p->IsD()); assert(!p->IsD());
mp->Mark(p); tri::Mark(m,p);
sf.push(p); sf.push(p);
} }
bool completed() { bool completed() {
@ -1341,7 +1341,7 @@ private:
do { do {
tri::UpdateTopology<MeshType>::FaceFace(m); tri::UpdateTopology<MeshType>::FaceFace(m);
m.UnMarkAll(); tri::UnMarkAll(m);
count = 0; count = 0;
//detection stage //detection stage
@ -1350,11 +1350,11 @@ private:
FacePointer f = &(m.face[index]); float sides[3]; Point3<float> dummy; FacePointer f = &(m.face[index]); float sides[3]; Point3<float> dummy;
sides[0] = Distance(f->P(0), f->P(1)); sides[1] = Distance(f->P(1), f->P(2)); sides[2] = Distance(f->P(2), f->P(0)); sides[0] = Distance(f->P(0), f->P(1)); sides[1] = Distance(f->P(1), f->P(2)); sides[2] = Distance(f->P(2), f->P(0));
int i = std::find(sides, sides+3, std::max( std::max(sides[0],sides[1]), sides[2])) - (sides); int i = std::find(sides, sides+3, std::max( std::max(sides[0],sides[1]), sides[2])) - (sides);
if( m.IsMarked(f->V2(i) )) continue; if( tri::IsMarked(m,f->V2(i) )) continue;
if( PSDist(f->P2(i),f->P(i),f->P1(i),dummy)*threshold <= sides[i] ) if( PSDist(f->P2(i),f->P(i),f->P1(i),dummy)*threshold <= sides[i] )
{ {
m.Mark(f->V2(i)); tri::Mark(m,f->V2(i));
if(face::CheckFlipEdge<FaceType>( *f, i )) { if(face::CheckFlipEdge<FaceType>( *f, i )) {
// Check if EdgeFlipping improves quality // Check if EdgeFlipping improves quality
FacePointer g = f->FFp(i); int k = f->FFi(i); FacePointer g = f->FFp(i); int k = f->FFi(i);
@ -1385,7 +1385,7 @@ private:
int count, total = 0; int count, total = 0;
do { do {
m.UnMarkAll(); tri::UnMarkAll(m);
count = 0; count = 0;
//detection stage //detection stage
@ -1394,14 +1394,14 @@ private:
FacePointer f = &(m.face[index]); float sides[3]; Point3<float> dummy; FacePointer f = &(m.face[index]); float sides[3]; Point3<float> dummy;
sides[0] = Distance(f->P(0), f->P(1)); sides[1] = Distance(f->P(1), f->P(2)); sides[2] = Distance(f->P(2), f->P(0)); sides[0] = Distance(f->P(0), f->P(1)); sides[1] = Distance(f->P(1), f->P(2)); sides[2] = Distance(f->P(2), f->P(0));
int i = std::find(sides, sides+3, std::max( std::max(sides[0],sides[1]), sides[2])) - (sides); int i = std::find(sides, sides+3, std::max( std::max(sides[0],sides[1]), sides[2])) - (sides);
if( m.IsMarked(f->V2(i) )) continue; if( tri::IsMarked(m,f->V2(i) )) continue;
if( PSDist(f->P2(i),f->P(i),f->P1(i),dummy)*threshold <= sides[i] ) if( PSDist(f->P2(i),f->P(i),f->P1(i),dummy)*threshold <= sides[i] )
{ {
m.Mark(f->V2(i)); tri::Mark(m,f->V2(i));
int j = Distance(dummy,f->P(i))<Distance(dummy,f->P1(i))?i:(i+1)%3; int j = Distance(dummy,f->P(i))<Distance(dummy,f->P1(i))?i:(i+1)%3;
f->P2(i) = f->P(j); m.Mark(f->V(j)); f->P2(i) = f->P(j); tri::Mark(m,f->V(j));
++count; ++total; ++count; ++total;
} }
} }

View File

@ -135,6 +135,7 @@ header added
#include <vcg/simplex/vertex/distance.h> #include <vcg/simplex/vertex/distance.h>
#include <vcg/space/intersection3.h> #include <vcg/space/intersection3.h>
#include <vcg/space/index/space_iterators.h> #include <vcg/space/index/space_iterators.h>
#include <vcg/complex/trimesh/base.h>
namespace vcg { namespace vcg {
namespace tri { namespace tri {