From 612f67da0a53eb1aafa336002b21f6102900578b Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Thu, 1 Nov 2012 21:36:39 +0000 Subject: [PATCH] - Ifc: avoid duplicate points in opening contour lines, this sometimes screws up the clipping algorithm. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1325 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/IFCGeometry.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index 47a45c33e..7e35999d8 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -1461,7 +1461,17 @@ bool TryAddOpenings_Quadrulate(std::vector& openings, vpmin = std::min(vpmin,vv); vpmax = std::max(vpmax,vv); - contour.push_back(vv); + // usually there won't be too many elements so the linear time check is ok + bool found = false; + for (std::vector::const_iterator it = contour.begin(); it != contour.end(); ++it) { + if (((*it)-vv).SquareLength() < 1e-5f) { + found = true; + break; + } + } + if(!found) { + contour.push_back(vv); + } } }