minor performance optimizations.
This commit is contained in:
parent
7e3ad9eced
commit
88ef8fa03b
|
@ -248,7 +248,7 @@ marks (Quality=0) and approx. counts profitable vertex rotations
|
|||
(vertex rotations which make edge shorter
|
||||
*/
|
||||
template <bool perform>
|
||||
static int MarkVertexRotations(MeshType &m, Pos *p=NULL)
|
||||
static int MarkVertexRotations(MeshType &m, Pos *affected=NULL)
|
||||
{
|
||||
int res=0;
|
||||
for (VertexIterator vi = m.vert.begin(); vi!=m.vert.end(); vi++) if (!vi->IsD()) vi->ClearV();
|
||||
|
@ -266,8 +266,8 @@ static int MarkVertexRotations(MeshType &m, Pos *p=NULL)
|
|||
res++; MarkVertex(&*fi, k, m); //fi->Q()=0;
|
||||
}
|
||||
else {
|
||||
if (BQ::RotateVertex(*fi, k, p)) res++; //fi->Q()=0;
|
||||
if (p) return res; // uncomment for only one rotation
|
||||
if (BQ::RotateVertex(*fi, k, m, affected)) res++; //fi->Q()=0;
|
||||
if (affected) return res; // uncomment for only one rotation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,8 +291,8 @@ static int MarkEdgeRotations(MeshType &m, Pos *p=NULL)
|
|||
if (fi->FFp(k)<= &*fi) continue; // only once per real (non faux) edge, and only for non border ones
|
||||
int best = BQ::TestEdgeRotation(*fi, k);
|
||||
if (perform) {
|
||||
if (best==+1) if (BQ::template RotateEdge< true>(*fi, k, p)) count++;
|
||||
if (best==-1) if (BQ::template RotateEdge<false>(*fi, k, p)) count++;
|
||||
if (best==+1) if (BQ::template RotateEdge< true>(*fi, k, m, p)) count++;
|
||||
if (best==-1) if (BQ::template RotateEdge<false>(*fi, k, m, p)) count++;
|
||||
if (p) if (count>0) return count;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -150,12 +150,9 @@ static bool RotateEdge(FaceType& f, int w0a, MeshType &m, Pos *affected=NULL){
|
|||
if (fa->IsF(w2a) == verse) {
|
||||
if (!CheckFlipDiag(*fa)) return false;
|
||||
FlipDiag(*fa);
|
||||
// recover edge index, so that (f, w0a) identifies the same edge as before
|
||||
FaceType *fc = fa->FFp(FauxIndex(fa));
|
||||
for (int i=0; i<3; i++){
|
||||
if ( v0==fa->V0(i) && v1==fa->V1(i) ) w0a = i;
|
||||
if ( v0==fc->V0(i) && v1==fc->V1(i) ) { fa = fc; w0a = i; }
|
||||
}
|
||||
// hack: recover edge index, so that (f, w0a) identifies the same edge as before
|
||||
fa = fb->FFp(w0b);
|
||||
w0a = fb->FFi(w0b);
|
||||
}
|
||||
|
||||
if (fb->IsF(w2b) == verse) {
|
||||
|
|
Loading…
Reference in New Issue