Added ClearFaceFace method to avoid messed topology status

This commit is contained in:
Paolo Cignoni 2015-07-14 10:44:23 +00:00
parent 4b3b1da6b1
commit bc9c61a92e
1 changed files with 48 additions and 31 deletions

View File

@ -205,6 +205,24 @@ static void AllocateEdge(MeshType &m)
}
/// \brief Clear the Face-Face topological relation setting each involved pointer to null.
/// useful when you passed a mesh with ff adjacency to an algorithm that does not use it and could have messed it.
static void ClearFaceFace(MeshType &m)
{
RequireFFAdjacency(m);
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
{
if( ! (*fi).IsD() )
{
for(int j=0;j<fi->VN();++j)
{
fi->FFp(j)=0;
fi->FFi(j)=-1;
}
}
}
}
/// \brief Update the Face-Face topological relation by allowing to retrieve for each face what other faces shares their edges.
static void FaceFace(MeshType &m)
{
@ -348,7 +366,6 @@ static void FaceFaceFromTexCoord(MeshType &m)
{
for (int i = 0; i < (*fi).VN(); i++)
{
bool isBorder = false;
if (!vcg::face::IsBorder((*fi), i))
{
typename MeshType::FacePointer nextFace = (*fi).FFp(i);