diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 3db4735ce..f6c7e9b02 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -1975,6 +1975,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, std::vector normals; - ComputePolygonNormals(normals); + ComputePolygonNormals(normals, false); + + bool drop = false; + size_t inor = 0; std::vector::const_iterator vit = verts.begin(); - for (std::vector::const_iterator it = vertcnt.begin(); it != vertcnt.end();) { + for (std::vector::const_iterator it = vertcnt.begin(); it != vertcnt.end(); ++inor) { const unsigned int pcount = *it; - if (normals[std::distance(static_cast::const_iterator>(vertcnt.begin()),it)].SquareLength() < 1e-5f) { + if (normals[inor].SquareLength() < 1e-5f) { it = vertcnt.erase(it); vit = verts.erase(vit, vit + pcount); + + drop = true; continue; } vit += pcount; ++it; } + + if(drop) { + IFCImporter::LogDebug("removing degenerate faces"); + } } // ------------------------------------------------------------------------------------------------ @@ -298,7 +307,7 @@ void TempMesh::RemoveAdjacentDuplicates() base += cnt; } if(drop) { - IFCImporter::LogDebug("removed duplicate vertices"); + IFCImporter::LogDebug("removing duplicate vertices"); } }