From 3b30a39fe169143e7175ffd658514bd65d879bae Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Thu, 24 Jan 2013 12:44:53 +0100 Subject: [PATCH] - Ifc: add debug code for checking correctness of coordinate transforms. --- code/IFCGeometry.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 6fb92bc59..f27ce49a7 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -1884,6 +1884,21 @@ IfcMatrix4 ProjectOntoPlane(std::vector& out_contour, const TempMesh mult.c4 = -coord; m = mult * m; + // debug code to verify correctness +#ifdef _DEBUG + std::vector out_contour2; + BOOST_FOREACH(const IfcVector3& x, in_verts) { + const IfcVector3& vv = m * x; + + out_contour2.push_back(IfcVector2(vv.x,vv.y)); + ai_assert(fabs(vv.z) < 1e-5); + } + + for(size_t i = 0; i < out_contour.size(); ++i) { + ai_assert((out_contour[i]-out_contour2[i]).SquareLength() < 1e-6); + } +#endif + return m; } @@ -2016,7 +2031,7 @@ bool GenerateOpenings(std::vector& openings, // TODO: This epsilon may be too large const IfcFloat epsilon = fabs(dmax-dmin) * 0.001; - if (check_intersection && (base_d < dmin-epsilon || base_d > dmax+epsilon)) { + if (check_intersection && (0 < dmin-epsilon || 0 > dmax+epsilon)) { continue; }