Generalized FaceFromVertex to works on polyhedral faces

This commit is contained in:
nico 2016-11-02 12:13:36 +01:00
parent f9169b8ec2
commit 5a12a2899a
1 changed files with 4 additions and 1 deletions

View File

@ -164,7 +164,10 @@ static void FaceFromVertex( MeshType &m)
tri::RequirePerVertexQuality(m); tri::RequirePerVertexQuality(m);
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD()) for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD())
{ {
(*fi).Q() = ((*fi).V(0)->Q()+(*fi).V(1)->Q()+(*fi).V(2)->Q())/3.0f; (*fi).Q() =0;
for (size_t i=0;i<(*fi).VN();i++)
(*fi).Q() += (*fi).V(i)->Q();
(*fi).Q()/=(ScalarType)(*fi).VN();
} }
} }