Merge pull request #5022 from Megidd/fix-infinite-loop
Mesh: Infinite loop when repairing mesh facet indices
This commit is contained in:
@@ -1249,9 +1249,12 @@ bool MeshFixCorruptedFacets::Fixup()
|
||||
if ( it->Area() <= FLOAT_EPS )
|
||||
{
|
||||
unsigned long uId = it.Position();
|
||||
cTopAlg.RemoveCorruptedFacet(uId);
|
||||
// due to a modification of the array the iterator became invalid
|
||||
it.Set(uId-1);
|
||||
bool removed = cTopAlg.RemoveCorruptedFacet(uId);
|
||||
if (removed) {
|
||||
// due to a modification of the array the iterator became invalid
|
||||
it.Set(uId-1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1474,9 +1474,9 @@ void MeshTopoAlgorithm::RemoveDegeneratedFacet(unsigned long index)
|
||||
}
|
||||
}
|
||||
|
||||
void MeshTopoAlgorithm::RemoveCorruptedFacet(unsigned long index)
|
||||
bool MeshTopoAlgorithm::RemoveCorruptedFacet(unsigned long index)
|
||||
{
|
||||
if (index >= _rclMesh._aclFacetArray.size()) return;
|
||||
if (index >= _rclMesh._aclFacetArray.size()) return false;
|
||||
MeshFacet& rFace = _rclMesh._aclFacetArray[index];
|
||||
|
||||
// coincident corners (topological)
|
||||
@@ -1494,9 +1494,11 @@ void MeshTopoAlgorithm::RemoveCorruptedFacet(unsigned long index)
|
||||
rFace._aulNeighbours[1] = ULONG_MAX;
|
||||
rFace._aulNeighbours[2] = ULONG_MAX;
|
||||
_rclMesh.DeleteFacet(index);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MeshTopoAlgorithm::FillupHoles(unsigned long length, int level,
|
||||
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
* Removes the corrupted facet at position \a index from the mesh structure.
|
||||
* A facet is corrupted if the indices of its corner points are not all different.
|
||||
*/
|
||||
void RemoveCorruptedFacet(unsigned long index);
|
||||
bool RemoveCorruptedFacet(unsigned long index);
|
||||
/**
|
||||
* Closes holes in the mesh that consists of up to \a length edges. In case a fit
|
||||
* needs to be done then the points of the neighbours of \a level rings will be used.
|
||||
|
||||
Reference in New Issue
Block a user