diff --git a/vcg/complex/algorithms/local_optimization/tri_edge_collapse_quadric.h b/vcg/complex/algorithms/local_optimization/tri_edge_collapse_quadric.h index 8c1f0925e..687882e03 100644 --- a/vcg/complex/algorithms/local_optimization/tri_edge_collapse_quadric.h +++ b/vcg/complex/algorithms/local_optimization/tri_edge_collapse_quadric.h @@ -566,13 +566,17 @@ class TriEdgeCollapseQuadric: public TriEdgeCollapse< TriMeshType, VertexPair, M if((*fi).V(0)->IsR() &&(*fi).V(1)->IsR() &&(*fi).V(2)->IsR()) { Plane3 facePlane; - facePlane.SetDirection( ( (*fi).V(1)->cP() - (*fi).V(0)->cP() ) ^ ( (*fi).V(2)->cP() - (*fi).V(0)->cP() )); - if(!pp->UseArea) - facePlane.Normalize(); + const Point3 dirArea = ( (*fi).V(1)->cP() - (*fi).V(0)->cP() ) ^ ( (*fi).V(2)->cP() - (*fi).V(0)->cP() ); + facePlane.SetDirection(dirArea); + facePlane.Normalize(); + const ScalarType area = dirArea.Norm(); facePlane.SetOffset( facePlane.Direction().dot((*fi).V(0)->cP())); QuadricType q; - q.ByPlane(facePlane); + q.ByPlane(facePlane); + if (pp->UseArea) { + q *= area; + } // The basic < add face quadric to each vertex > loop for(int j=0;j<3;++j)