From c2fb20c70bff9f267b7d95433cf6816b3f0eba6f Mon Sep 17 00:00:00 2001 From: cignoni Date: Sat, 7 Oct 2006 17:20:25 +0000 Subject: [PATCH] Updated to the new style face->Normal() becomes Normal(face) --- .../tri_edge_collapse_quadric.h | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/vcg/complex/local_optimization/tri_edge_collapse_quadric.h b/vcg/complex/local_optimization/tri_edge_collapse_quadric.h index d4d262dd..73b6d295 100644 --- a/vcg/complex/local_optimization/tri_edge_collapse_quadric.h +++ b/vcg/complex/local_optimization/tri_edge_collapse_quadric.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.8 2005/10/02 23:19:36 cignoni +Changed the sign of the priority of a collapse. Now it is its the error as it should (and not -error) + Revision 1.7 2005/04/14 11:35:07 ponchio *** empty log message *** @@ -301,11 +304,11 @@ public: // store the old normals for non-collapsed face in v0 for(x.F() = v[0]->VFp(), x.I() = v[0]->VFi(); x.F()!=0; ++x ) // for all faces in v0 if(x.F()->V(0)!=v[1] && x.F()->V(1)!=v[1] && x.F()->V(2)!=v[1] ) // skip faces with v1 - on.push_back(x.F()->NormalizedNormal()); + on.push_back(NormalizedNormal(*x.F())); // store the old normals for non-collapsed face in v1 for(x.F() = v[1]->VFp(), x.I() = v[1]->VFi(); x.F()!=0; ++x ) // for all faces in v1 if(x.F()->V(0)!=v[0] && x.F()->V(1)!=v[0] && x.F()->V(2)!=v[0] ) // skip faces with v0 - on.push_back(x.F()->NormalizedNormal()); + on.push_back(NormalizedNormal(*x.F())); } //// Move the two vertexe into new position (storing the old ones) @@ -325,12 +328,12 @@ public: if(x.F()->V(0)!=v[1] && x.F()->V(1)!=v[1] && x.F()->V(2)!=v[1] ) // skip faces with v1 { if(Params().NormalCheck){ - nn=x.F()->NormalizedNormal(); + nn=NormalizedNormal(*x.F()); ndiff=nn*on[i++]; if(ndiffQualityFace(); + qt= QualityFace(*x.F()); if(qtV(0)!=v[0] && x.F()->V(1)!=v[0] && x.F()->V(2)!=v[0] ) // skip faces with v0 { if(Params().NormalCheck){ - nn=x.F()->NormalizedNormal(); + nn=NormalizedNormal(*x.F()); ndiff=nn*on[i++]; if(ndiffQualityFace(); + qt= QualityFace(*x.F()); if(qtW()+v[0]->W())/2; - if(!Params().QualityCheck && !Params().NormalCheck) error = QuadErr; - if( Params().QualityCheck && !Params().NormalCheck) error = QuadErr / MinQual; - if(!Params().QualityCheck && Params().NormalCheck) error = QuadErr / MinCos; - if( Params().QualityCheck && Params().NormalCheck) error = QuadErr / (MinQual*MinCos); + if(!Params().QualityCheck && !Params().NormalCheck) error = (ScalarType)(QuadErr); + if( Params().QualityCheck && !Params().NormalCheck) error = (ScalarType)(QuadErr / MinQual); + if(!Params().QualityCheck && Params().NormalCheck) error = (ScalarType)(QuadErr / MinCos); + if( Params().QualityCheck && Params().NormalCheck) error = (ScalarType)(QuadErr / (MinQual*MinCos)); //Rrestore old position of v0 and v1 v[0]->P()=OldPos0; @@ -407,29 +410,29 @@ public: if( !(vfi.V1()->IsV()) && vfi.V1()->IsRW()) { vfi.V1()->SetV(); - h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.V0(),vfi.V1()), this->GlobalMark()))); + h_ret.push_back(HeapElem(new MYTYPE(EdgeType(vfi.V0(),vfi.V1()), this->GlobalMark()))); std::push_heap(h_ret.begin(),h_ret.end()); if(!IsSymmetric()){ - h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.V1(),vfi.V0()), this->GlobalMark()))); + h_ret.push_back(HeapElem(new MYTYPE(EdgeType(vfi.V1(),vfi.V0()), this->GlobalMark()))); std::push_heap(h_ret.begin(),h_ret.end()); } } if( !(vfi.V2()->IsV()) && vfi.V2()->IsRW()) { vfi.V2()->SetV(); - h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.V0(),vfi.V2()),this->GlobalMark()))); + h_ret.push_back(HeapElem(new MYTYPE(EdgeType(vfi.V0(),vfi.V2()),this->GlobalMark()))); std::push_heap(h_ret.begin(),h_ret.end()); if(!IsSymmetric()){ - h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.V2(),vfi.V0()), this->GlobalMark()))); + h_ret.push_back(HeapElem(new MYTYPE(EdgeType(vfi.V2(),vfi.V0()), this->GlobalMark()))); std::push_heap(h_ret.begin(),h_ret.end()); } } if(Params().SafeHeapUpdate && vfi.V1()->IsRW() && vfi.V2()->IsRW() ) { - h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.V1(),vfi.V2()),this->GlobalMark()))); + h_ret.push_back(HeapElem(new MYTYPE(EdgeType(vfi.V1(),vfi.V2()),this->GlobalMark()))); std::push_heap(h_ret.begin(),h_ret.end()); if(!IsSymmetric()){ - h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.V2(),vfi.V1()), this->GlobalMark()))); + h_ret.push_back(HeapElem(new MYTYPE(EdgeType(vfi.V2(),vfi.V1()), this->GlobalMark()))); std::push_heap(h_ret.begin(),h_ret.end()); } }