From b42f279110dba7e7a2b3c54cc39100ef09a84649 Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Thu, 24 Jan 2013 01:09:48 +0100 Subject: [PATCH] - Ifc: improve intersection check for openings. --- code/IFCGeometry.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 0e464e1e2..6fb92bc59 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -1970,15 +1970,14 @@ bool GenerateOpenings(std::vector& openings, for (unsigned int vi = 0, vend = profile_vertcnts[f]; vi < vend; ++vi, ++vi_total) { const IfcVector3& x = profile_verts[vi_total]; - if(check_intersection) { - const IfcFloat vert_d = -(x * nor); - dmin = std::min(dmin, vert_d); - dmax = std::max(dmax, vert_d); - } - const IfcVector3& v = m * x; IfcVector2 vv(v.x, v.y); + if(check_intersection) { + dmin = std::min(dmin, v.z); + dmax = std::max(dmax, v.z); + } + // sanity rounding vv = std::max(vv,IfcVector2()); vv = std::min(vv,one_vec); @@ -2245,7 +2244,7 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul out.push_back(in[next]); if(openings) { - if(GenerateOpenings(*conv.apply_openings,nors,temp, i >= size/2)) { + if(GenerateOpenings(*conv.apply_openings,nors,temp,true, true)) { ++sides_with_openings; } @@ -2264,7 +2263,7 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul curmesh.vertcnt.push_back(size); if(openings && size > 2) { - if(GenerateOpenings(*conv.apply_openings,nors,temp, true)) { + if(GenerateOpenings(*conv.apply_openings,nors,temp,true, true)) { ++sides_with_v_openings; }