From 415b0e19d955b78e9b584d7e4a1cca6c7ff054b9 Mon Sep 17 00:00:00 2001 From: Ben Sewell Date: Mon, 17 Jan 2022 16:39:50 +0000 Subject: [PATCH] Changes for gcc compatibility --- code/AssetLib/IFC/IFCOpenings.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/code/AssetLib/IFC/IFCOpenings.cpp b/code/AssetLib/IFC/IFCOpenings.cpp index 16d0bcdc3..c261a24b0 100644 --- a/code/AssetLib/IFC/IFCOpenings.cpp +++ b/code/AssetLib/IFC/IFCOpenings.cpp @@ -1480,7 +1480,7 @@ const float close { 1e-6f }; static bool isClose(IfcVector2 first,IfcVector2 second) { auto diff = (second - first); - return (std::fabsf(diff.x) < close && std::fabsf(diff.y) < close); + return (std::fabs(diff.x) < close && std::fabs(diff.y) < close); } static void logSegment(std::pair segment) { @@ -1529,20 +1529,13 @@ std::vector> GetContoursInPlane3D(std::shared_ptrmVerts[vI0]; - auto v1 = planeSpace * mesh->mVerts[vI0 + 1]; - auto v2 = planeSpace * mesh->mVerts[vI0 + 2]; - - auto faceNor = ((v1 - v0) ^ (v2 - v0)).Normalize(); - auto intersectionDir = faceNor ^ IfcVector3(0.f,0.f,1.f); // as we're in plane space, plane normal is (0,0,1) // now calculate intersections between face and plane IfcVector2 firstPoint; bool gotFirstPoint(false); - if(std::fabsf(v0.z - planeOffset) < close) { + if(std::fabs(v0.z - planeOffset) < close) { // first point is on the plane firstPoint.x = v0.x; firstPoint.y = v0.y; @@ -1555,7 +1548,7 @@ std::vector> GetContoursInPlane3D(std::shared_ptrmVerts[vI]; IfcVector3 intersection; - if(std::fabsf(vn.z - planeOffset) < close) { + if(std::fabs(vn.z - planeOffset) < close) { // on the plane intersection = vn; } @@ -1572,7 +1565,7 @@ std::vector> GetContoursInPlane3D(std::shared_ptr> GetContoursInPlane3D(std::shared_ptrfirst) && isClose(contour.back(),nextSeg->second) || - isClose(contour.back(),nextSeg->first) && isClose(contour.front(),nextSeg->second) + if((isClose(contour.front(),nextSeg->first) && isClose(contour.back(),nextSeg->second)) || + (isClose(contour.back(),nextSeg->first) && isClose(contour.front(),nextSeg->second)) ) { lineSegments.erase(nextSeg); closedContour = true;