- Ifc: always remove degenerate geometry from geometric entities after finishing processing.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1320 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/6/merge
parent
a598ac53b4
commit
c3adc004bf
|
@ -1975,6 +1975,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, std::vector<unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
meshtmp.RemoveAdjacentDuplicates();
|
meshtmp.RemoveAdjacentDuplicates();
|
||||||
|
meshtmp.RemoveDegenerates();
|
||||||
|
|
||||||
if(fix_orientation) {
|
if(fix_orientation) {
|
||||||
meshtmp.FixupFaceOrientation();
|
meshtmp.FixupFaceOrientation();
|
||||||
|
|
|
@ -137,21 +137,30 @@ void TempMesh::RemoveDegenerates()
|
||||||
// of the polygons, which is close to zero for lines.
|
// of the polygons, which is close to zero for lines.
|
||||||
|
|
||||||
std::vector<IfcVector3> normals;
|
std::vector<IfcVector3> normals;
|
||||||
ComputePolygonNormals(normals);
|
ComputePolygonNormals(normals, false);
|
||||||
|
|
||||||
|
bool drop = false;
|
||||||
|
size_t inor = 0;
|
||||||
|
|
||||||
std::vector<IfcVector3>::const_iterator vit = verts.begin();
|
std::vector<IfcVector3>::const_iterator vit = verts.begin();
|
||||||
for (std::vector<unsigned int>::const_iterator it = vertcnt.begin(); it != vertcnt.end();) {
|
for (std::vector<unsigned int>::const_iterator it = vertcnt.begin(); it != vertcnt.end(); ++inor) {
|
||||||
const unsigned int pcount = *it;
|
const unsigned int pcount = *it;
|
||||||
|
|
||||||
if (normals[std::distance(static_cast<std::vector<unsigned int>::const_iterator>(vertcnt.begin()),it)].SquareLength() < 1e-5f) {
|
if (normals[inor].SquareLength() < 1e-5f) {
|
||||||
it = vertcnt.erase(it);
|
it = vertcnt.erase(it);
|
||||||
vit = verts.erase(vit, vit + pcount);
|
vit = verts.erase(vit, vit + pcount);
|
||||||
|
|
||||||
|
drop = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
vit += pcount;
|
vit += pcount;
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(drop) {
|
||||||
|
IFCImporter::LogDebug("removing degenerate faces");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -298,7 +307,7 @@ void TempMesh::RemoveAdjacentDuplicates()
|
||||||
base += cnt;
|
base += cnt;
|
||||||
}
|
}
|
||||||
if(drop) {
|
if(drop) {
|
||||||
IFCImporter::LogDebug("removed duplicate vertices");
|
IFCImporter::LogDebug("removing duplicate vertices");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue