From bbd10cd74832a4f706bb14d0062b6ac27511587a Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Fri, 25 Jan 2013 03:48:06 +0100 Subject: [PATCH] - Ifc: fix normalization of base mesh normal for opening generation. --- code/IFCGeometry.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index f27ce49a7..7d055b8ec 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -1926,7 +1926,8 @@ bool GenerateOpenings(std::vector& openings, return false; } - const IfcVector3& nor = IfcVector3(m.c1, m.c2, m.c3); + IfcVector3 nor = IfcVector3(m.c1, m.c2, m.c3); + nor.Normalize(); // Obtain inverse transform for getting back to world space later on const IfcMatrix4& minv = IfcMatrix4(m).Inverse(); @@ -1975,7 +1976,7 @@ bool GenerateOpenings(std::vector& openings, (profile_verts[vi_total+1] - profile_verts[vi_total])).Normalize(); const IfcFloat abs_dot_face_nor = abs(nor * face_nor); - if (abs_dot_face_nor < 0.5) { + if (abs_dot_face_nor < 0.9) { vi_total += profile_vertcnts[f]; continue; } @@ -2030,7 +2031,7 @@ bool GenerateOpenings(std::vector& openings, // TODO: This epsilon may be too large - const IfcFloat epsilon = fabs(dmax-dmin) * 0.001; + const IfcFloat epsilon = fabs(dmax-dmin) * 0.0001; if (check_intersection && (0 < dmin-epsilon || 0 > dmax+epsilon)) { continue; }