Fixed CMeshO error
This commit is contained in:
parent
04e2464e3d
commit
c39498df1f
|
@ -1109,19 +1109,19 @@ private:
|
|||
static int RemoveTVertexByFlip(MeshType &m, float threshold=40, bool repeat=true)
|
||||
{
|
||||
assert(m.HasFFTopology());
|
||||
assert(m.HasPerVertexMark());
|
||||
assert(m.HasPerVertexMark());
|
||||
//Counters for logging and convergence
|
||||
int count, total = 0;
|
||||
|
||||
do {
|
||||
tri::UpdateTopology<CMeshO>::FaceFace(m);
|
||||
tri::UpdateTopology<MeshType>::FaceFace(m);
|
||||
m.UnMarkAll();
|
||||
count = 0;
|
||||
|
||||
//detection stage
|
||||
for(unsigned int index = 0 ; index < m.face.size(); ++index )
|
||||
{
|
||||
CMeshO::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));
|
||||
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;
|
||||
|
@ -1129,15 +1129,15 @@ private:
|
|||
if( PSDist(f->P2(i),f->P(i),f->P1(i),dummy)*threshold <= sides[i] )
|
||||
{
|
||||
m.Mark(f->V2(i));
|
||||
if(face::CheckFlipEdge<CMeshO::FaceType>( *f, i )) {
|
||||
if(face::CheckFlipEdge<FaceType>( *f, i )) {
|
||||
// Check if EdgeFlipping improves quality
|
||||
CMeshO::FacePointer g = f->FFp(i); int k = f->FFi(i);
|
||||
FacePointer g = f->FFp(i); int k = f->FFi(i);
|
||||
Triangle3<float> t1(f->P(i), f->P1(i), f->P2(i)), t2(g->P(k), g->P1(k), g->P2(k)),
|
||||
t3(f->P(i), g->P2(k), f->P2(i)), t4(g->P(k), f->P2(i), g->P2(k));
|
||||
|
||||
if ( std::min( t1.QualityFace(), t2.QualityFace() ) < std::min( t3.QualityFace(), t4.QualityFace() ))
|
||||
{
|
||||
face::FlipEdge<CMeshO::FaceType>( *f, i );
|
||||
face::FlipEdge<FaceType>( *f, i );
|
||||
++count; ++total;
|
||||
}
|
||||
}
|
||||
|
@ -1145,7 +1145,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
tri::UpdateNormals<CMeshO>::PerFace(m);
|
||||
tri::UpdateNormals<MeshType>::PerFace(m);
|
||||
}
|
||||
while( repeat && count );
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ private:
|
|||
//detection stage
|
||||
for(unsigned int index = 0 ; index < m.face.size(); ++index )
|
||||
{
|
||||
CMeshO::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));
|
||||
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;
|
||||
|
@ -1181,9 +1181,9 @@ private:
|
|||
}
|
||||
|
||||
|
||||
tri::Clean<CMeshO>::RemoveDuplicateVertex(m);
|
||||
tri::Allocator<CMeshO>::CompactFaceVector(m);
|
||||
tri::Allocator<CMeshO>::CompactVertexVector(m);
|
||||
tri::Clean<MeshType>::RemoveDuplicateVertex(m);
|
||||
tri::Allocator<MeshType>::CompactFaceVector(m);
|
||||
tri::Allocator<MeshType>::CompactVertexVector(m);
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue