From 2d01b9bdc9c6147145113a6e6989b043c6f4c5bf Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Tue, 22 Jan 2013 16:39:43 +0100 Subject: [PATCH] - Ifc: pick average of all coordinates as projection plane. --- code/IFCGeometry.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index e12d5e0c6..73813bedd 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -1835,7 +1835,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector& out_contour, const TempMesh } - IfcFloat coord = -1; + IfcFloat coord = 0; out_contour.reserve(in_verts.size()); IfcVector2 vmin, vmax; @@ -1853,13 +1853,15 @@ IfcMatrix4 ProjectOntoPlane(std::vector& out_contour, const TempMesh // if(coord != -1.0f) { // assert(fabs(coord - vv.z) < 1e-3f); // } - coord = vv.z; + coord += vv.z; vmin = std::min(IfcVector2(vv.x, vv.y), vmin); vmax = std::max(IfcVector2(vv.x, vv.y), vmax); out_contour.push_back(IfcVector2(vv.x,vv.y)); } + coord /= in_verts.size(); + // Further improve the projection by mapping the entire working set into // [0,1] range. This gives us a consistent data range so all epsilons // used below can be constants.