From f6f2c087db55303132f33464a90d41f25e6f7cf1 Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Sun, 21 Oct 2012 17:08:12 +0000 Subject: [PATCH] - Ifc: skip lines during boolean differentiation between two solids. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1316 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/IFCGeometry.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index d841b0a09..b1cd5d14a 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -282,10 +282,12 @@ void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result, TempMesh meshout; BOOST_FOREACH(const IfcFaceBound& bound, face.Bounds) { - // XXX implement proper merging for polygonal loops if(const IfcPolyLoop* const polyloop = bound.Bound->ToPtr()) { if(ProcessPolyloop(*polyloop, meshout,conv)) { + // The outer boundary is better determined by checking which + // polygon covers the largest area. + //if(bound.ToPtr()) { // ob = cnt; //} @@ -298,6 +300,9 @@ void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result, continue; } + // And this, even though it is sometimes TRUE and sometimes FALSE, + // does not really improve results. + /*if(!IsTrue(bound.Orientation)) { size_t c = 0; BOOST_FOREACH(unsigned int& c, meshout.vertcnt) { @@ -305,7 +310,6 @@ void ProcessConnectedFaceSet(const IfcConnectedFaceSet& fset, TempMesh& result, cnt += c; } }*/ - } ProcessPolygonBoundaries(result, meshout); } @@ -1903,6 +1907,17 @@ void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, T temp.verts.insert(temp.verts.end(), vit, vit + pcount); temp.vertcnt.push_back(pcount); + // The algorithms used to generate mesh geometry sometimes + // spit out lines or other degenerates which must be + // filtered to avoid running into assertions later on. + + // ComputePolygonNormal returns the Newell normal, so the + // length of the normal is the area of the polygon. + const IfcVector3& normal = ComputePolygonNormal(temp, false); + if (normal.SquareLength() < static_cast(1e-5)) { + continue; + } + TryAddOpenings_Quadrulate(openings, std::vector(1,IfcVector3(1,0,0)), temp); result.Append(temp);