From 88e1b3d2f9bdeb6625bd8b1c35621280ef68b4c8 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 26 Mar 2024 11:00:16 +0100 Subject: [PATCH] Fix is_manifold(), sorry :( --- src/ifcgeom_schema_agnostic/IfcGeomTree.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ifcgeom_schema_agnostic/IfcGeomTree.h b/src/ifcgeom_schema_agnostic/IfcGeomTree.h index 60ce524d07..f7f4155af6 100644 --- a/src/ifcgeom_schema_agnostic/IfcGeomTree.h +++ b/src/ifcgeom_schema_agnostic/IfcGeomTree.h @@ -1738,15 +1738,16 @@ namespace IfcGeom { } static bool is_manifold(const std::vector& fs) { + // @nb this assumes geometry is processed with the WELD_VERTICES setting std::unordered_set, boost::hash>> dict; for (size_t i = 0; i < fs.size(); i += 3) { for (size_t j = 0; j < 3; ++j) { auto k = (j + 1) % 3; - auto it = dict.find({ i + j, i + k }); + auto it = dict.find({ fs[i + j], fs[i + k] }); if (it != dict.end()) { dict.erase(it); } else { - dict.insert({ i + k, i + j }); + dict.insert({ fs[i + k], fs[i + j] }); } } }