Skip to content

Commit

Permalink
fix face area weighting in quadric edge collapse
Browse files Browse the repository at this point in the history
  • Loading branch information
flm8620 committed May 21, 2024
1 parent 1016837 commit b331b83
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<ScalarType,false> 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<ScalarType> 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)
Expand Down

0 comments on commit b331b83

Please sign in to comment.