diff --git a/benchmark.md b/benchmark.md index 4afa667d..980e6658 100644 --- a/benchmark.md +++ b/benchmark.md @@ -1,33 +1,33 @@ # System informations - {"cpuName":"Apple M1","freeRam":109.578125,"totalRam":8192} + {"cpuName":"Apple M1","freeRam":76.6875,"totalRam":8192} _________ | filename | Size (mb) | Time to open model (ms) | Time to execute all (ms) | Total ifc entities | Total meshes | Total geometries | total errors | |-------|-------|-------|-------|-------|-------|-------|-------| -| tests/ifcfiles/public/AC20-FZK-Haus.ifc | 2.45 | 55 | 238 | 44249 | 83 | 103 | undefined | - tests/ifcfiles/public/C20-Institute-Var-2.ifc | 10.43 | 99 | 616 | 147712 | 702 | 821 | undefined | - tests/ifcfiles/public/Element3D.ifc | 2.02 | 15 | 845 | 32875 | 1 | 5 | undefined | - tests/ifcfiles/public/FM_ARC_DigitalHub.ifc | 13.66 | 109 | 1453 | 266483 | 705 | 725 | undefined | - tests/ifcfiles/public/ISSUE_005_haus.ifc | 2.41 | 56 | 256 | 44249 | 83 | 103 | undefined | - tests/ifcfiles/public/ISSUE_021_Mini Project.ifc | 3.2 | 32 | 996 | 49044 | 2636 | 3697 | undefined | - tests/ifcfiles/public/ISSUE_034_HouseZ.ifc | 4.92 | 55 | 300 | 81806 | 228 | 239 | undefined | - tests/ifcfiles/public/ISSUE_044_test_IFCCOMPOSITEPROFILEDEF.ifc | 0.03 | 1 | 1 | 435 | 7 | 11 | undefined | - tests/ifcfiles/public/ISSUE_053_20181220Holter_Tower_10.ifczip | 29.38 | 1475 | 12407 | 2807815 | 60285 | 60847 | undefined | - tests/ifcfiles/public/ISSUE_068_ARK_NUS_skolebygg.ifc | 54.65 | 704 | 4515 | 945194 | 4459 | 4542 | undefined | - tests/ifcfiles/public/ISSUE_102_M3D-CON-CD.ifc | 26.11 | 207 | 3257 | 503608 | 1616 | 1635 | undefined | - tests/ifcfiles/public/ISSUE_102_M3D-CON.ifc | 6.1 | 49 | 274 | 123282 | 138 | 143 | undefined | - tests/ifcfiles/public/ISSUE_126_model.ifc | 4.32 | 35 | 120 | 88876 | 257 | 288 | undefined | - tests/ifcfiles/public/ISSUE_129_N1540_17_EXE_MOD_448200_02_09_11SMC_IGC_V17.ifc | 11.67 | 86 | 730 | 202661 | 959 | 981 | undefined | - tests/ifcfiles/public/ISSUE_159_kleine_Wohnung_R22.ifc | 9.73 | 73 | 851 | 189788 | 425 | 457 | undefined | - tests/ifcfiles/public/ISSUE_171_IfcSurfaceCurveSweptAreaSolid.ifc | 0.24 | 3 | 20 | 4327 | 60 | 141 | undefined | - tests/ifcfiles/public/IfcOpenHouse_IFC4.ifc | 0.11 | 1 | 8 | 2885 | 35 | 43 | undefined | - tests/ifcfiles/public/KIT-Simple-Road-Test-Web-IFC4x3_RC2.ifc | 0.38 | 491 | 155 | 6500 | 66 | 119 | undefined | - tests/ifcfiles/public/Office_A_20110811.ifc | 3.91 | 74 | 237 | 62930 | 803 | 810 | undefined | - tests/ifcfiles/public/S_Office_Integrated Design Archi.ifc | 29.62 | 291 | 5820 | 551442 | 3418 | 3873 | undefined | - tests/ifcfiles/public/Sample_entities.ifc | 0.03 | 0 | 1 | 466 | 2 | 10 | undefined | - tests/ifcfiles/public/advanced_model.ifc | 33.67 | 473 | 2425 | 594374 | 6401 | 14120 | undefined | - tests/ifcfiles/public/dental_clinic.ifc | 12.4 | 94 | 836 | 209259 | 2586 | 2626 | undefined | - tests/ifcfiles/public/duplex.ifc | 2.27 | 18 | 66 | 38898 | 216 | 224 | undefined | +| tests/ifcfiles/public/AC20-FZK-Haus.ifc | 2.45 | 48 | 294 | 44249 | 83 | 103 | undefined | + tests/ifcfiles/public/C20-Institute-Var-2.ifc | 10.43 | 93 | 597 | 147712 | 702 | 821 | undefined | + tests/ifcfiles/public/Element3D.ifc | 2.02 | 16 | 844 | 32875 | 1 | 5 | undefined | + tests/ifcfiles/public/FM_ARC_DigitalHub.ifc | 13.66 | 102 | 1113 | 266483 | 705 | 725 | undefined | + tests/ifcfiles/public/ISSUE_005_haus.ifc | 2.41 | 22 | 156 | 44249 | 83 | 103 | undefined | + tests/ifcfiles/public/ISSUE_021_Mini Project.ifc | 3.2 | 24 | 632 | 49044 | 2636 | 3697 | undefined | + tests/ifcfiles/public/ISSUE_034_HouseZ.ifc | 4.92 | 36 | 189 | 81806 | 228 | 239 | undefined | + tests/ifcfiles/public/ISSUE_044_test_IFCCOMPOSITEPROFILEDEF.ifc | 0.03 | 0 | 0 | 435 | 7 | 11 | undefined | + tests/ifcfiles/public/ISSUE_053_20181220Holter_Tower_10.ifczip | 29.38 | 1452 | 11189 | 2807815 | 60285 | 60847 | undefined | + tests/ifcfiles/public/ISSUE_068_ARK_NUS_skolebygg.ifc | 54.65 | 460 | 4372 | 945194 | 4459 | 4542 | undefined | + tests/ifcfiles/public/ISSUE_102_M3D-CON-CD.ifc | 26.11 | 211 | 3052 | 503608 | 1616 | 1635 | undefined | + tests/ifcfiles/public/ISSUE_102_M3D-CON.ifc | 6.1 | 102 | 300 | 123282 | 138 | 143 | undefined | + tests/ifcfiles/public/ISSUE_126_model.ifc | 4.32 | 35 | 112 | 88876 | 257 | 288 | undefined | + tests/ifcfiles/public/ISSUE_129_N1540_17_EXE_MOD_448200_02_09_11SMC_IGC_V17.ifc | 11.67 | 88 | 711 | 202661 | 959 | 981 | undefined | + tests/ifcfiles/public/ISSUE_159_kleine_Wohnung_R22.ifc | 9.73 | 76 | 667 | 189788 | 425 | 457 | undefined | + tests/ifcfiles/public/ISSUE_171_IfcSurfaceCurveSweptAreaSolid.ifc | 0.24 | 3 | 17 | 4327 | 60 | 141 | undefined | + tests/ifcfiles/public/IfcOpenHouse_IFC4.ifc | 0.11 | 1 | 6 | 2885 | 35 | 43 | undefined | + tests/ifcfiles/public/KIT-Simple-Road-Test-Web-IFC4x3_RC2.ifc | 0.38 | 390 | 163 | 6500 | 66 | 119 | undefined | + tests/ifcfiles/public/Office_A_20110811.ifc | 3.91 | 48 | 275 | 62930 | 803 | 810 | undefined | + tests/ifcfiles/public/S_Office_Integrated Design Archi.ifc | 29.62 | 274 | 5349 | 551442 | 3418 | 3873 | undefined | + tests/ifcfiles/public/Sample_entities.ifc | 0.03 | 0 | 0 | 466 | 2 | 10 | undefined | + tests/ifcfiles/public/advanced_model.ifc | 33.67 | 310 | 2348 | 594374 | 6401 | 14120 | undefined | + tests/ifcfiles/public/dental_clinic.ifc | 12.4 | 91 | 855 | 209259 | 2586 | 2626 | undefined | + tests/ifcfiles/public/duplex.ifc | 2.27 | 18 | 67 | 38898 | 216 | 224 | undefined | tests/ifcfiles/public/example.ifc | 0.39 | 3 | 8 | 6488 | 115 | 119 | undefined | - tests/ifcfiles/public/ifcbridge-model01.ifc | 14.47 | 124 | 273 | 296968 | 165 | 168 | undefined | - tests/ifcfiles/public/schependomlaan.ifc | 47 | 395 | 825 | 714485 | 3569 | 3643 | undefined | - tests/ifcfiles/public/tested_sample_project.ifc | 0.68 | 6 | 118 | 14119 | 93 | 98 | undefined | + tests/ifcfiles/public/ifcbridge-model01.ifc | 14.47 | 180 | 281 | 296968 | 165 | 168 | undefined | + tests/ifcfiles/public/schependomlaan.ifc | 47 | 435 | 760 | 714485 | 3569 | 3643 | undefined | + tests/ifcfiles/public/tested_sample_project.ifc | 0.68 | 6 | 117 | 14119 | 93 | 98 | undefined | diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 4afce27e..bef821d9 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -31,20 +31,6 @@ file(GLOB WebIfcUtility utility/*.cpp) file(GLOB WebIfcTestSourceFiles test/*.cpp) file(GLOB WebIfcTestingMain web-ifc-test.cpp) -# Print the contents of WebIfcGeometry -message("Contents of WebIfcGeometry:") - -foreach(file ${WebIfcGeometry}) - message("${file}") -endforeach() - -# Print the contents of WebIfcGeometryH -message("Contents of WebIfcGeometryH:") - -foreach(file ${WebIfcGeometryH}) - message("${file}") -endforeach() - # download the external projects and save their paths Message("Downloading FastFloat") FetchContent_Declare(fastfloat GIT_REPOSITORY "https://github.com/fastfloat/fast_float" GIT_TAG "2b2395f9ac836ffca6404424bcc252bff7aa80e4" SOURCE_SUBDIR "../") diff --git a/src/cpp/geometry/IfcGeometryLoader.cpp b/src/cpp/geometry/IfcGeometryLoader.cpp index 4bb2e8f7..bd15141a 100644 --- a/src/cpp/geometry/IfcGeometryLoader.cpp +++ b/src/cpp/geometry/IfcGeometryLoader.cpp @@ -20,7 +20,12 @@ namespace webifc::geometry ReadLinearScalingFactor(); } - IfcCrossSections IfcGeometryLoader::GetCrossSections2D(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const + void IfcGeometryLoader::Clear() const{ + _expressIDToPlacement.clear(); + std::unordered_map().swap(_expressIDToPlacement); + } + + IfcCrossSections IfcGeometryLoader::GetCrossSections2D(uint32_t expressID) const { spdlog::debug("[GetCrossSections2D({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -40,7 +45,7 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 2); auto linearPositions = _loader.GetSetArgument(); - IfcCurve curve = GetCurve(curveId, _expressIDToPlacement, 3); + IfcCurve curve = GetCurve(curveId, 3); std::vector profiles; std::vector curves; @@ -50,7 +55,7 @@ namespace webifc::geometry for (auto &face : faces) { auto expressID = _loader.GetRefArgument(face); - IfcProfile profile = GetProfile(expressID, _expressIDToPlacement); + IfcProfile profile = GetProfile(expressID); profiles.push_back(profile); curves.push_back(profile.curve); expressIds.push_back(expressID); @@ -77,7 +82,7 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 2); auto linearPositions = _loader.GetSetArgument(); - IfcCurve curve = GetCurve(curveId, _expressIDToPlacement, 3); + IfcCurve curve = GetCurve(curveId, 3); std::vector profiles; std::vector curves; @@ -87,7 +92,7 @@ namespace webifc::geometry for (auto &face : faces) { auto expressID = _loader.GetRefArgument(face); - IfcProfile profile = GetProfile(expressID, _expressIDToPlacement); + IfcProfile profile = GetProfile(expressID); profiles.push_back(profile); curves.push_back(profile.curve); expressIds.push_back(expressID); @@ -119,7 +124,7 @@ namespace webifc::geometry for (auto &face : faces) { auto expressID = _loader.GetRefArgument(face); - IfcProfile profile = GetProfile(expressID, _expressIDToPlacement); + IfcProfile profile = GetProfile(expressID); profiles.push_back(profile); curves.push_back(profile.curve); expressIds.push_back(expressID); @@ -133,7 +138,7 @@ namespace webifc::geometry } } - IfcCrossSections IfcGeometryLoader::GetCrossSections3D(uint32_t expressID, std::unordered_map &_expressIDToPlacement, bool scaled, glm::dmat4 coordination) const + IfcCrossSections IfcGeometryLoader::GetCrossSections3D(uint32_t expressID, bool scaled, glm::dmat4 coordination) const { spdlog::debug("[GetCrossSections3D({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -164,7 +169,7 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 2); auto linearPositions = _loader.GetSetArgument(); - IfcCurve curve = GetCurve(curveId, _expressIDToPlacement, 3); + IfcCurve curve = GetCurve(curveId, 3); std::vector profiles; std::vector curves; @@ -174,7 +179,7 @@ namespace webifc::geometry for (auto &linearPosition : linearPositions) { auto expressID = _loader.GetRefArgument(linearPosition); - glm::dmat4 linearPlacement = GetLocalPlacement(expressID, _expressIDToPlacement) * scale; + glm::dmat4 linearPlacement = GetLocalPlacement(expressID) * scale; transform.push_back(linearPlacement); } @@ -182,7 +187,7 @@ namespace webifc::geometry for (auto &face : faces) { auto expressID = _loader.GetRefArgument(face); - IfcProfile profile = GetProfile(expressID, _expressIDToPlacement); + IfcProfile profile = GetProfile(expressID); for (uint32_t i = 0; i < profile.curve.points.size(); i++) { glm::dvec3 pTemp = transform[id] * glm::dvec4(profile.curve.points[i], 1); @@ -214,7 +219,7 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 2); auto linearPositions = _loader.GetSetArgument(); - IfcCurve curve = GetCurve(curveId, _expressIDToPlacement, 3); + IfcCurve curve = GetCurve(curveId, 3); std::vector profiles; std::vector curves; @@ -224,7 +229,7 @@ namespace webifc::geometry for (auto &linearPosition : linearPositions) { auto expressID = _loader.GetRefArgument(linearPosition); - glm::dmat4 linearPlacement = GetLocalPlacement(expressID, _expressIDToPlacement) * scale; + glm::dmat4 linearPlacement = GetLocalPlacement(expressID) * scale; transform.push_back(linearPlacement); } @@ -232,7 +237,7 @@ namespace webifc::geometry for (auto &face : faces) { auto expressID = _loader.GetRefArgument(face); - IfcProfile profile = GetProfile(expressID, _expressIDToPlacement); + IfcProfile profile = GetProfile(expressID); for (uint32_t i = 0; i < profile.curve.points.size(); i++) { glm::dvec3 pTemp = transform[id] * glm::dvec4(profile.curve.points[i], 1); @@ -264,7 +269,7 @@ namespace webifc::geometry for (auto &linearPosition : linearPositions) { auto expressID = _loader.GetRefArgument(linearPosition); - glm::dmat4 linearPlacement = GetLocalPlacement(expressID, _expressIDToPlacement) * scale; + glm::dmat4 linearPlacement = GetLocalPlacement(expressID) * scale; transform.push_back(linearPlacement); } @@ -276,7 +281,7 @@ namespace webifc::geometry for (auto &face : faces) { auto expressID = _loader.GetRefArgument(face); - IfcProfile profile = GetProfile(expressID, _expressIDToPlacement); + IfcProfile profile = GetProfile(expressID); for (uint32_t i = 0; i < profile.curve.points.size(); i++) { glm::dvec3 pTemp = transform[id] * glm::dvec4(profile.curve.points[i], 1); @@ -295,7 +300,7 @@ namespace webifc::geometry } } - IfcAlignment IfcGeometryLoader::GetAlignment(uint32_t expressID, std::unordered_map &_expressIDToPlacement, IfcAlignment alignment, glm::dmat4 transform, uint32_t sourceExpressID) const + IfcAlignment IfcGeometryLoader::GetAlignment(uint32_t expressID, IfcAlignment alignment, glm::dmat4 transform, uint32_t sourceExpressID) const { spdlog::debug("[GetAlignment({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -317,7 +322,7 @@ namespace webifc::geometry glm::dmat4 transform_t = glm::dmat4(1); if (localPlacement != 0 && _loader.IsValidExpressID(localPlacement)) { - transform_t = GetLocalPlacement(localPlacement, _expressIDToPlacement); + transform_t = GetLocalPlacement(localPlacement); } auto &relAggVector = GetRelAggregates(); @@ -326,7 +331,7 @@ namespace webifc::geometry auto &relAgg = relAggVector.at(expressID); for (auto expressID : relAgg) { - alignment = GetAlignment(expressID, _expressIDToPlacement, alignment, transform * transform_t, expressID); + alignment = GetAlignment(expressID, alignment, transform * transform_t, expressID); } } @@ -336,7 +341,7 @@ namespace webifc::geometry auto &relNest = relNestsVector.at(expressID); for (auto expressID : relNest) { - alignment = GetAlignment(expressID, _expressIDToPlacement, alignment, transform * transform_t, expressID); + alignment = GetAlignment(expressID, alignment, transform * transform_t, expressID); } } @@ -355,7 +360,7 @@ namespace webifc::geometry glm::dmat4 transform_t = glm::dmat4(1); if (localPlacement != 0 && _loader.IsValidExpressID(localPlacement)) { - transform_t = GetLocalPlacement(localPlacement, _expressIDToPlacement); + transform_t = GetLocalPlacement(localPlacement); } auto &relAggVector = GetRelAggregates(); @@ -364,7 +369,7 @@ namespace webifc::geometry auto &relAgg = relAggVector.at(expressID); for (auto expressID : relAgg) { - alignment.Horizontal.curves.push_back(GetAlignmentCurve(expressID, _expressIDToPlacement, sourceExpressID)); + alignment.Horizontal.curves.push_back(GetAlignmentCurve(expressID, sourceExpressID)); } for (size_t i = 0; i < alignment.Horizontal.curves.size(); i++) @@ -383,7 +388,7 @@ namespace webifc::geometry auto &relNest = relNestVector.at(expressID); for (auto expressID : relNest) { - alignment.Horizontal.curves.push_back(GetAlignmentCurve(expressID, _expressIDToPlacement, sourceExpressID)); + alignment.Horizontal.curves.push_back(GetAlignmentCurve(expressID, sourceExpressID)); } for (size_t i = 0; i < alignment.Horizontal.curves.size(); i++) @@ -411,7 +416,7 @@ namespace webifc::geometry glm::dmat4 transform_t = glm::dmat4(1); if (localPlacement != 0 && _loader.IsValidExpressID(localPlacement)) { - transform_t = GetLocalPlacement(localPlacement, _expressIDToPlacement); + transform_t = GetLocalPlacement(localPlacement); } auto &relAggVector = GetRelAggregates(); @@ -420,7 +425,7 @@ namespace webifc::geometry auto &relAgg = relAggVector.at(expressID); for (auto expressID : relAgg) { - alignment.Vertical.curves.push_back(GetAlignmentCurve(expressID, _expressIDToPlacement, sourceExpressID)); + alignment.Vertical.curves.push_back(GetAlignmentCurve(expressID, sourceExpressID)); } for (size_t i = 0; i < alignment.Vertical.curves.size(); i++) @@ -439,7 +444,7 @@ namespace webifc::geometry auto &relNest = relNestVector.at(expressID); for (auto expressID : relNest) { - alignment.Vertical.curves.push_back(GetAlignmentCurve(expressID, _expressIDToPlacement, sourceExpressID)); + alignment.Vertical.curves.push_back(GetAlignmentCurve(expressID, sourceExpressID)); } for (size_t i = 0; i < alignment.Vertical.curves.size(); i++) @@ -462,7 +467,7 @@ namespace webifc::geometry return alignment; } - IfcCurve IfcGeometryLoader::GetAlignmentCurve(uint32_t expressID, std::unordered_map &_expressIDToPlacement, uint32_t parentExpressID) const + IfcCurve IfcGeometryLoader::GetAlignmentCurve(uint32_t expressID, uint32_t parentExpressID) const { spdlog::debug("[GetAlignmentCurve({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -485,7 +490,7 @@ namespace webifc::geometry glm::dmat4 transform_t = glm::dmat4(1); if (localPlacement != 0 && _loader.IsValidExpressID(localPlacement)) { - transform_t = GetLocalPlacement(localPlacement, _expressIDToPlacement); + transform_t = GetLocalPlacement(localPlacement); } _loader.MoveToArgumentOffset(expressID, 7); @@ -497,7 +502,7 @@ namespace webifc::geometry } if (curveID != 0 && _loader.IsValidExpressID(curveID)) { - IfcCurve temp = GetAlignmentCurve(curveID, _expressIDToPlacement, parentExpressID); + IfcCurve temp = GetAlignmentCurve(curveID, parentExpressID); alignmentCurve = temp; } @@ -1127,7 +1132,7 @@ namespace webifc::geometry return {}; } - IfcBound3D IfcGeometryLoader::GetBound(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const + IfcBound3D IfcGeometryLoader::GetBound(uint32_t expressID) const { spdlog::debug("[GetBound({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -1143,7 +1148,7 @@ namespace webifc::geometry bool orient = orientValue == "T"; IfcBound3D bound; - bound.curve = GetLoop(loop, _expressIDToPlacement); + bound.curve = GetLoop(loop); bound.orientation = orient; bound.type = IfcBoundType::OUTERBOUND; @@ -1163,7 +1168,7 @@ namespace webifc::geometry bool orient = orientValue == "T"; IfcBound3D bound; - bound.curve = GetLoop(loop, _expressIDToPlacement); + bound.curve = GetLoop(loop); bound.orientation = orient; bound.type = IfcBoundType::BOUND; @@ -1182,7 +1187,7 @@ namespace webifc::geometry return IfcBound3D(); } - IfcCurve IfcGeometryLoader::GetLoop(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const + IfcCurve IfcGeometryLoader::GetLoop(uint32_t expressID) const { spdlog::debug("[GetLoop({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -1225,7 +1230,7 @@ namespace webifc::geometry for (auto &token : edges) { uint32_t edgeId = _loader.GetRefArgument(token); - IfcCurve edgeCurve = GetOrientedEdge(edgeId, _expressIDToPlacement); + IfcCurve edgeCurve = GetOrientedEdge(edgeId); // Important not to repeat the last point otherwise triangulation fails // if the list has zero points this is initial, no repetition is possible, otherwise we must check @@ -1262,7 +1267,7 @@ namespace webifc::geometry return curve; } - IfcCurve IfcGeometryLoader::GetOrientedEdge(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const + IfcCurve IfcGeometryLoader::GetOrientedEdge(uint32_t expressID) const { spdlog::debug("[GetOrientedEdge({})]",expressID); _loader.MoveToArgumentOffset(expressID, 3); @@ -1270,7 +1275,7 @@ namespace webifc::geometry bool orient = orientValue == "T"; _loader.MoveToArgumentOffset(expressID, 2); uint32_t edgeCurveRef = _loader.GetRefArgument(); - IfcCurve curveEdge = GetEdge(edgeCurveRef, _expressIDToPlacement); + IfcCurve curveEdge = GetEdge(edgeCurveRef); // Read edgeCurve @@ -1299,7 +1304,7 @@ namespace webifc::geometry } } - IfcCurve IfcGeometryLoader::GetEdge(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const + IfcCurve IfcGeometryLoader::GetEdge(uint32_t expressID) const { spdlog::debug("[GetEdge({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -1322,7 +1327,7 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 2); uint32_t CurveRef = _loader.GetRefArgument(); IfcCurve curve; - ComputeCurve(CurveRef, _expressIDToPlacement, curve, 3, true, -1, -1, ts); + ComputeCurve(CurveRef, curve, 3, true, -1, -1, ts); return curve; } @@ -1463,15 +1468,15 @@ namespace webifc::geometry return result; } - IfcCurve IfcGeometryLoader::GetCurve(uint32_t expressID, std::unordered_map &_expressIDToPlacement, uint8_t dimensions,bool edge) const + IfcCurve IfcGeometryLoader::GetCurve(uint32_t expressID, uint8_t dimensions,bool edge) const { spdlog::debug("[GetCurve({})]",expressID); IfcCurve curve; - ComputeCurve(expressID, _expressIDToPlacement, curve, dimensions, edge); + ComputeCurve(expressID, curve, dimensions, edge); return curve; } - void IfcGeometryLoader::ComputeCurve(uint32_t expressID, std::unordered_map &_expressIDToPlacement, IfcCurve &curve, uint8_t dimensions, bool edge, int sameSense, int trimSense , IfcTrimmingArguments trim) const + void IfcGeometryLoader::ComputeCurve(uint32_t expressID, IfcCurve &curve, uint8_t dimensions, bool edge, int sameSense, int trimSense , IfcTrimmingArguments trim) const { spdlog::debug("[ComputeCurve({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -1521,7 +1526,7 @@ namespace webifc::geometry uint32_t segmentId = _loader.GetRefArgument(token); - ComputeCurve(segmentId, _expressIDToPlacement, curve, dimensions, edge, sameSense, trimSense); + ComputeCurve(segmentId, curve, dimensions, edge, sameSense, trimSense); } break; @@ -1535,7 +1540,7 @@ namespace webifc::geometry bool sameSense = sameSenseS == "T"; - ComputeCurve(parentID, _expressIDToPlacement, curve, dimensions, edge, sameSense, trimSense); + ComputeCurve(parentID, curve, dimensions, edge, sameSense, trimSense); break; } @@ -1665,7 +1670,7 @@ namespace webifc::geometry senseAgreement = !senseAgreement; } - ComputeCurve(basisCurveID, _expressIDToPlacement, curve, dimensions, edge, sameSense, senseAgreement, trim); + ComputeCurve(basisCurveID, curve, dimensions, edge, sameSense, senseAgreement, trim); break; } @@ -1828,7 +1833,7 @@ namespace webifc::geometry } else if (dimensions == 3) { - glm::dmat4 placement = GetLocalPlacement(positionID, _expressIDToPlacement); + glm::dmat4 placement = GetLocalPlacement(positionID); glm::dvec4 vecX = placement[0]; glm::dvec4 vecY = placement[1]; glm::dvec4 vecZ = placement[2]; @@ -1943,7 +1948,7 @@ namespace webifc::geometry glm::dvec3 vec(0); vec[0] = radius1 * std::cos(angle); vec[1] = -radius2 * std::sin(angle); // negative or not??? - glm::dvec3 pos = GetLocalPlacement(positionID, _expressIDToPlacement) * glm::dvec4(glm::dvec3(vec), 1); + glm::dvec3 pos = GetLocalPlacement(positionID) * glm::dvec4(glm::dvec3(vec), 1); curve.Add(pos); } } @@ -1962,13 +1967,13 @@ namespace webifc::geometry auto tokens = _loader.GetSetArgument(); auto u = _loader.GetStringArgument(); auto masterCurveID = _loader.GetRefArgument(); - curve = GetCurve(masterCurveID, _expressIDToPlacement, 3, false); + curve = GetCurve(masterCurveID, 3, false); std::vector curveList; for (auto token : tokens) { auto curveID = _loader.GetRefArgument(token); - IfcCurve gradientCurve = GetCurve(curveID, _expressIDToPlacement, 3, false); + IfcCurve gradientCurve = GetCurve(curveID, 3, false); curveList.push_back(gradientCurve); } // #ifdef DEBUG_DUMP_SVG @@ -1994,7 +1999,7 @@ namespace webifc::geometry trim.end.param = SegmentEnd; trim.start.hasParam = true; trim.end.hasParam = true; - ComputeCurve(curveID, _expressIDToPlacement, curve, 3, false, -1, -1, trim); + ComputeCurve(curveID, curve, 3, false, -1, -1, trim); glm::dmat3 placement = GetAxis2Placement2D(placementID); @@ -2273,10 +2278,10 @@ void IfcGeometryLoader::convertAngleUnits(double &Degrees, double &Rad) const } } -IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const +IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID) const { spdlog::debug("[GetProfile({})]",expressID); - auto profile = GetProfileByLine(expressID, _expressIDToPlacement); + auto profile = GetProfileByLine(expressID); if (!profile.isComposite) { @@ -2313,7 +2318,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< return profile; } - IfcProfile IfcGeometryLoader::GetProfileByLine(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const + IfcProfile IfcGeometryLoader::GetProfileByLine(uint32_t expressID) const { spdlog::debug("[GetProfileByLine({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -2328,7 +2333,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< profile.type = _loader.GetStringArgument(); _loader.MoveToArgumentOffset(expressID, 2); // ISSUE 765 requires dimension 3, not sure how to solve it without a stopgap - profile.curve = GetCurve(_loader.GetRefArgument(), _expressIDToPlacement, 2); + profile.curve = GetCurve(_loader.GetRefArgument(), 2); profile.isConvex = IsCurveConvex(profile.curve); return profile; @@ -2340,7 +2345,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< _loader.MoveToArgumentOffset(expressID, 0); profile.type = _loader.GetStringArgument(); _loader.MoveToArgumentOffset(expressID, 2); - profile.curve = GetCurve(_loader.GetRefArgument(), _expressIDToPlacement, 2); + profile.curve = GetCurve(_loader.GetRefArgument(), 2); profile.isConvex = IsCurveConvex(profile.curve); _loader.MoveToArgumentOffset(expressID, 3); @@ -2348,7 +2353,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< for (auto &hole : holes) { - IfcCurve holeCurve = GetCurve(_loader.GetRefArgument(hole), _expressIDToPlacement, 2); + IfcCurve holeCurve = GetCurve(_loader.GetRefArgument(hole), 2); profile.holes.push_back(holeCurve); } @@ -2726,7 +2731,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< { _loader.MoveToArgumentOffset(expressID, 2); uint32_t profileID = _loader.GetRefArgument(); - IfcProfile profile = GetProfileByLine(profileID, _expressIDToPlacement); + IfcProfile profile = GetProfileByLine(profileID); _loader.MoveToArgumentOffset(expressID, 3); uint32_t transformID = _loader.GetRefArgument(); @@ -2774,7 +2779,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< for (uint32_t i = 0; i < lst.size(); i++) { - IfcProfile profile_t = GetProfileByLine(lst[i], _expressIDToPlacement); + IfcProfile profile_t = GetProfileByLine(lst[i]); profile.profiles.push_back(profile_t); } @@ -2888,7 +2893,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< return IfcProfile(); } - IfcProfile IfcGeometryLoader::GetProfile3D(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const + IfcProfile IfcGeometryLoader::GetProfile3D(uint32_t expressID) const { spdlog::debug("[GetProfile3D({})]",expressID); auto lineType = _loader.GetLineType(expressID); @@ -2901,7 +2906,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< _loader.MoveToArgumentOffset(expressID, 0); profile.type = _loader.GetStringArgument(); _loader.MoveToArgumentOffset(expressID, 2); - profile.curve = GetCurve(_loader.GetRefArgument(), _expressIDToPlacement, 3); + profile.curve = GetCurve(_loader.GetRefArgument(), 3); return profile; } @@ -3022,7 +3027,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< return glm::dmat3(); } - IfcCurve IfcGeometryLoader::GetLocalCurve(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const + IfcCurve IfcGeometryLoader::GetLocalCurve(uint32_t expressID) const { spdlog::debug("[GetLocalCurve({})]",expressID); for (uint32_t i = 0; i < LocalcurvesIndices.size(); i++) @@ -3032,13 +3037,13 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< return LocalCurvesList[i]; } } - IfcCurve curve = GetCurve(expressID, _expressIDToPlacement, 3, false); + IfcCurve curve = GetCurve(expressID, 3, false); LocalcurvesIndices.push_back(expressID); LocalCurvesList.push_back(curve); return curve; } - glm::dmat4 IfcGeometryLoader::GetLocalPlacement(uint32_t expressID, std::unordered_map &_expressIDToPlacement, glm::dvec3 vector) const + glm::dmat4 IfcGeometryLoader::GetLocalPlacement(uint32_t expressID, glm::dvec3 vector) const { if(_expressIDToPlacement.contains(expressID)) { return _expressIDToPlacement[expressID]; @@ -3067,7 +3072,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< { _loader.StepBack(); auto curveId = _loader.GetRefArgument(); - curve = GetLocalCurve(curveId, _expressIDToPlacement); + curve = GetLocalCurve(curveId); glm::dmat4 result = curve.getPlacementAtDistance(lnSegment); _expressIDToPlacement[expressID] = result; return result; @@ -3189,13 +3194,13 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< if (relPlacementToken == parsing::IfcTokenType::REF) { _loader.StepBack(); - relPlacement = GetLocalPlacement(_loader.GetRefArgument(), _expressIDToPlacement); + relPlacement = GetLocalPlacement(_loader.GetRefArgument()); } _loader.MoveToArgumentOffset(expressID, 1); uint32_t axis2PlacementID = _loader.GetRefArgument(); - glm::dmat4 axis2Placement = GetLocalPlacement(axis2PlacementID, _expressIDToPlacement); + glm::dmat4 axis2Placement = GetLocalPlacement(axis2PlacementID); auto result = relPlacement * axis2Placement; @@ -3286,7 +3291,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< _loader.StepBack(); glm::dvec3 vector = GetCartesianPoint3D(_loader.GetRefArgument()); } - glm::dmat4 result = GetLocalPlacement(posID, _expressIDToPlacement, vector); + glm::dmat4 result = GetLocalPlacement(posID, vector); _expressIDToPlacement[expressID] = result; return result; @@ -3295,7 +3300,7 @@ IfcProfile IfcGeometryLoader::GetProfile(uint32_t expressID, std::unordered_map< { _loader.MoveToArgumentOffset(expressID, 1); uint32_t posID = _loader.GetRefArgument(); - glm::dmat4 result = GetLocalPlacement(posID, _expressIDToPlacement); + glm::dmat4 result = GetLocalPlacement(posID); _expressIDToPlacement[expressID] = result; return result; diff --git a/src/cpp/geometry/IfcGeometryLoader.h b/src/cpp/geometry/IfcGeometryLoader.h index b5a0154b..52199678 100644 --- a/src/cpp/geometry/IfcGeometryLoader.h +++ b/src/cpp/geometry/IfcGeometryLoader.h @@ -28,25 +28,25 @@ namespace webifc::geometry IfcGeometryLoader(const webifc::parsing::IfcLoader &loader,const webifc::schema::IfcSchemaManager &schemaManager,uint16_t circleSegments); std::array GetAxis1Placement(const uint32_t expressID) const; glm::dmat3 GetAxis2Placement2D(const uint32_t expressID) const; - glm::dmat4 GetLocalPlacement(const uint32_t expressID, std::unordered_map &_expressIDToPlacement, glm::dvec3 vector = glm::dvec3(1)) const; + glm::dmat4 GetLocalPlacement(const uint32_t expressID, glm::dvec3 vector = glm::dvec3(1)) const; glm::dvec3 GetCartesianPoint3D(const uint32_t expressID) const; glm::dvec2 GetCartesianPoint2D(const uint32_t expressID) const; glm::dvec3 GetVector(const uint32_t expressID) const; - IfcProfile GetProfile(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const; - IfcProfile GetProfile3D(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const; - IfcCurve GetLocalCurve(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const; - IfcCurve GetCurve(uint32_t expressID, std::unordered_map &_expressIDToPlacement,uint8_t dimensions, bool edge=false) const; + IfcProfile GetProfile(uint32_t expressID) const; + IfcProfile GetProfile3D(uint32_t expressID) const; + IfcCurve GetLocalCurve(uint32_t expressID) const; + IfcCurve GetCurve(uint32_t expressID,uint8_t dimensions, bool edge=false) const; bool ReadIfcCartesianPointList(const uint32_t expressID) const; std::vector ReadIfcCartesianPointList3D(const uint32_t expressID) const; std::vector ReadIfcCartesianPointList2D(const uint32_t expressID) const; - IfcCurve GetOrientedEdge(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const; - IfcCurve GetEdge(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const; - IfcBound3D GetBound(const uint32_t expressID, std::unordered_map &_expressIDToPlacement) const; - IfcCurve GetLoop(const uint32_t expressID, std::unordered_map &_expressIDToPlacement) const; + IfcCurve GetOrientedEdge(uint32_t expressID) const; + IfcCurve GetEdge(uint32_t expressID) const; + IfcBound3D GetBound(const uint32_t expressID) const; + IfcCurve GetLoop(const uint32_t expressID) const; std::optional GetColor(uint32_t expressID) const; - IfcCrossSections GetCrossSections2D(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const; - IfcCrossSections GetCrossSections3D(uint32_t expressID, std::unordered_map &_expressIDToPlacement, bool scaled = false, glm::dmat4 coordination = glm::dmat4(1)) const; - IfcAlignment GetAlignment(uint32_t expressID, std::unordered_map &_expressIDToPlacement, IfcAlignment alignment = IfcAlignment(), glm::dmat4 transform = glm::dmat4(1), uint32_t sourceExpressID = -1) const; + IfcCrossSections GetCrossSections2D(uint32_t expressID) const; + IfcCrossSections GetCrossSections3D(uint32_t expressID, bool scaled = false, glm::dmat4 coordination = glm::dmat4(1)) const; + IfcAlignment GetAlignment(uint32_t expressID, IfcAlignment alignment = IfcAlignment(), glm::dmat4 transform = glm::dmat4(1), uint32_t sourceExpressID = -1) const; bool GetColor(const uint32_t expressID, const glm::dvec4 &outputColor) const; const std::unordered_map> &GetRelVoids() const; const std::unordered_map> &GetRelVoidRels() const; @@ -58,12 +58,13 @@ namespace webifc::geometry const std::unordered_map>> &GetMaterialDefinitions() const; double GetLinearScalingFactor() const; std::string GetAngleUnits() const; + void Clear() const; private: - IfcCurve GetAlignmentCurve(uint32_t expressID, std::unordered_map &_expressIDToPlacement, uint32_t parentExpressID = -1) const; - IfcProfile GetProfileByLine(uint32_t expressID, std::unordered_map &_expressIDToPlacement) const; + IfcCurve GetAlignmentCurve(uint32_t expressID, uint32_t parentExpressID = -1) const; + IfcProfile GetProfileByLine(uint32_t expressID) const; glm::dvec3 GetVertexPoint(uint32_t expressID) const; IfcTrimmingSelect GetTrimSelect(uint32_t DIM, std::vector &tapeOffsets) const; - void ComputeCurve(uint32_t expressID, std::unordered_map &_expressIDToPlacement, IfcCurve &curve, uint8_t dimensions, bool edge, int sameSense = -1, int trimSense = -1, IfcTrimmingArguments trim = {}) const; + void ComputeCurve(uint32_t expressID, IfcCurve &curve, uint8_t dimensions, bool edge, int sameSense = -1, int trimSense = -1, IfcTrimmingArguments trim = {}) const; void convertAngleUnits(double &Degrees, double &Rad) const; double ReadLenghtMeasure() const; std::vector ReadCurveIndices() const; @@ -95,6 +96,7 @@ namespace webifc::geometry std::unordered_map>> PopulateMaterialDefinitionsMap(); void ReadLinearScalingFactor(); double ConvertPrefix(const std::string_view &prefix); + mutable std::unordered_map _expressIDToPlacement; }; } \ No newline at end of file diff --git a/src/cpp/geometry/IfcGeometryProcessor.cpp b/src/cpp/geometry/IfcGeometryProcessor.cpp index ded7b609..917e8b72 100644 --- a/src/cpp/geometry/IfcGeometryProcessor.cpp +++ b/src/cpp/geometry/IfcGeometryProcessor.cpp @@ -52,6 +52,7 @@ namespace webifc::geometry { _expressIDToGeometry.clear(); std::unordered_map().swap(_expressIDToGeometry); + _geometryLoader.Clear(); } std::array IfcGeometryProcessor::GetFlatCoordinationMatrix() const @@ -153,7 +154,7 @@ namespace webifc::geometry if (localPlacement != 0 && _loader.IsValidExpressID(localPlacement)) { - mesh.transformation = _geometryLoader.GetLocalPlacement(localPlacement, _expressIDToPlacement); + mesh.transformation = _geometryLoader.GetLocalPlacement(localPlacement); } if (ifcPresentation != 0 && _loader.IsValidExpressID(ifcPresentation)) @@ -249,7 +250,7 @@ namespace webifc::geometry case schema::IFCSECTIONEDSOLID: case schema::IFCSECTIONEDSURFACE: { - auto geom = SectionedSurface(_geometryLoader.GetCrossSections3D(expressID, _expressIDToPlacement)); + auto geom = SectionedSurface(_geometryLoader.GetCrossSections3D(expressID)); mesh.transformation = glm::dmat4(1); // TODO: this is getting problematic..... _expressIDToGeometry[expressID] = geom; @@ -270,7 +271,7 @@ namespace webifc::geometry uint32_t ifcPresentation = _loader.GetRefArgument(); uint32_t localPlacement = _loader.GetRefArgument(); - mesh.transformation = _geometryLoader.GetLocalPlacement(localPlacement, _expressIDToPlacement); + mesh.transformation = _geometryLoader.GetLocalPlacement(localPlacement); mesh.children.push_back(GetMesh(ifcPresentation)); return mesh; @@ -410,8 +411,8 @@ namespace webifc::geometry uint32_t boundaryID = _loader.GetRefArgument(); IfcSurface surface = GetSurface(surfaceID); - glm::dmat4 position = _geometryLoader.GetLocalPlacement(positionID, _expressIDToPlacement); - IfcCurve curve = _geometryLoader.GetCurve(boundaryID, _expressIDToPlacement, 2); + glm::dmat4 position = _geometryLoader.GetLocalPlacement(positionID); + IfcCurve curve = _geometryLoader.GetCurve(boundaryID, 2); if (!curve.IsCCW()) { @@ -476,7 +477,7 @@ namespace webifc::geometry uint32_t axis2Placement = _loader.GetRefArgument(); uint32_t ifcPresentation = _loader.GetRefArgument(); - mesh.transformation = _geometryLoader.GetLocalPlacement(axis2Placement, _expressIDToPlacement); + mesh.transformation = _geometryLoader.GetLocalPlacement(axis2Placement); mesh.children.push_back(GetMesh(ifcPresentation)); return mesh; @@ -667,7 +668,7 @@ namespace webifc::geometry if (profileID) { - profile = _geometryLoader.GetProfile(profileID, _expressIDToPlacement); + profile = _geometryLoader.GetProfile(profileID); } else { @@ -676,12 +677,12 @@ namespace webifc::geometry if (placementID) { - placement = _geometryLoader.GetLocalPlacement(placementID, _expressIDToPlacement); + placement = _geometryLoader.GetLocalPlacement(placementID); } if (directrixRef) { - directrix = _geometryLoader.GetCurve(directrixRef, _expressIDToPlacement, 3); + directrix = _geometryLoader.GetCurve(directrixRef, 3); } else { @@ -748,7 +749,7 @@ namespace webifc::geometry _loader.GetDoubleArgument(); } - IfcCurve directrix = _geometryLoader.GetCurve(directrixRef, _expressIDToPlacement, 3); + IfcCurve directrix = _geometryLoader.GetCurve(directrixRef, 3); IfcProfile profile; profile.curve = GetCircleCurve(radius, _circleSegments); @@ -771,8 +772,8 @@ namespace webifc::geometry uint32_t axis1PlacementID = _loader.GetRefArgument(); double angle = angleConversion(_loader.GetDoubleArgument(), _geometryLoader.GetAngleUnits()); - IfcProfile profile = _geometryLoader.GetProfile(profileID, _expressIDToPlacement); - glm::dmat4 placement = _geometryLoader.GetLocalPlacement(placementID, _expressIDToPlacement); + IfcProfile profile = _geometryLoader.GetProfile(profileID); + glm::dmat4 placement = _geometryLoader.GetLocalPlacement(placementID); glm::dvec3 axis = _geometryLoader.GetAxis1Placement(axis1PlacementID)[0]; bool closed = false; @@ -820,7 +821,7 @@ namespace webifc::geometry double depth = _loader.GetDoubleArgument(); auto lineProfileType = _loader.GetLineType(profileID); - IfcProfile profile = _geometryLoader.GetProfile(profileID, _expressIDToPlacement); + IfcProfile profile = _geometryLoader.GetProfile(profileID); if (!profile.isComposite) { if (profile.curve.points.empty()) @@ -841,7 +842,7 @@ namespace webifc::geometry if (placementID) { - mesh.transformation = _geometryLoader.GetLocalPlacement(placementID, _expressIDToPlacement); + mesh.transformation = _geometryLoader.GetLocalPlacement(placementID); } glm::dvec3 dir = _geometryLoader.GetCartesianPoint3D(directionID); @@ -942,7 +943,7 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 0); uint32_t locationID = _loader.GetRefArgument(); - surface.transformation = _geometryLoader.GetLocalPlacement(locationID, _expressIDToPlacement); + surface.transformation = _geometryLoader.GetLocalPlacement(locationID); return surface; } @@ -1236,7 +1237,7 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 0); uint32_t locationID = _loader.GetRefArgument(); - surface.transformation = _geometryLoader.GetLocalPlacement(locationID, _expressIDToPlacement); + surface.transformation = _geometryLoader.GetLocalPlacement(locationID); _loader.MoveToArgumentOffset(expressID, 1); double radius = _loader.GetDoubleArgument(); @@ -1254,21 +1255,21 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 0); uint32_t profileID = _loader.GetRefArgument(); - IfcProfile profile = _geometryLoader.GetProfile3D(profileID, _expressIDToPlacement); + IfcProfile profile = _geometryLoader.GetProfile3D(profileID); _loader.MoveToArgumentOffset(expressID, 1); if (_loader.GetTokenType() == parsing::IfcTokenType::REF) { _loader.StepBack(); uint32_t placementID = _loader.GetRefArgument(); - surface.transformation = _geometryLoader.GetLocalPlacement(placementID, _expressIDToPlacement); + surface.transformation = _geometryLoader.GetLocalPlacement(placementID); } _loader.MoveToArgumentOffset(expressID, 2); uint32_t locationID = _loader.GetRefArgument(); surface.RevolutionSurface.Active = true; - surface.RevolutionSurface.Direction = _geometryLoader.GetLocalPlacement(locationID, _expressIDToPlacement); + surface.RevolutionSurface.Direction = _geometryLoader.GetLocalPlacement(locationID); surface.RevolutionSurface.Profile = profile; return surface; @@ -1281,7 +1282,7 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 0); uint32_t profileID = _loader.GetRefArgument(); - IfcProfile profile = _geometryLoader.GetProfile(profileID, _expressIDToPlacement); + IfcProfile profile = _geometryLoader.GetProfile(profileID); _loader.MoveToArgumentOffset(expressID, 2); uint32_t directionID = _loader.GetRefArgument(); @@ -1302,7 +1303,7 @@ namespace webifc::geometry _loader.MoveToArgumentOffset(expressID, 1); uint32_t locationID = _loader.GetRefArgument(); - surface.transformation = _geometryLoader.GetLocalPlacement(locationID, _expressIDToPlacement); + surface.transformation = _geometryLoader.GetLocalPlacement(locationID); return surface; @@ -1606,7 +1607,7 @@ namespace webifc::geometry for (size_t i = 0; i < bounds.size(); i++) { uint32_t boundID = _loader.GetRefArgument(bounds[i]); - bounds3D[i] = _geometryLoader.GetBound(boundID, _expressIDToPlacement); + bounds3D[i] = _geometryLoader.GetBound(boundID); } TriangulateBounds(geometry, bounds3D, expressID); @@ -1622,7 +1623,7 @@ namespace webifc::geometry for (size_t i = 0; i < bounds.size(); i++) { uint32_t boundID = _loader.GetRefArgument(bounds[i]); - bounds3D[i] = _geometryLoader.GetBound(boundID, _expressIDToPlacement); + bounds3D[i] = _geometryLoader.GetBound(boundID); } _loader.MoveToArgumentOffset(expressID, 1); diff --git a/src/cpp/geometry/IfcGeometryProcessor.h b/src/cpp/geometry/IfcGeometryProcessor.h index 64a74f00..9408920d 100644 --- a/src/cpp/geometry/IfcGeometryProcessor.h +++ b/src/cpp/geometry/IfcGeometryProcessor.h @@ -30,7 +30,6 @@ namespace webifc::geometry IfcGeometryLoader GetLoader() const; IfcFlatMesh GetFlatMesh(uint32_t expressID); IfcComposedMesh GetMesh(uint32_t expressID, uint32_t nestLevel = 0); - std::unordered_map _expressIDToPlacement; void SetTransformation(const std::array &val); std::array GetFlatCoordinationMatrix() const; glm::dmat4 GetCoordinationMatrix() const; diff --git a/src/cpp/web-ifc-wasm.cpp b/src/cpp/web-ifc-wasm.cpp index 8ca7bdbe..acfd54e2 100644 --- a/src/cpp/web-ifc-wasm.cpp +++ b/src/cpp/web-ifc-wasm.cpp @@ -215,8 +215,8 @@ std::vector GetAllCrossSections(uint32_t mod for (size_t i = 0; i < elements.size(); i++) { webifc::geometry::IfcCrossSections crossSection; - if (dimensions == 2) crossSection = geomLoader->GetLoader().GetCrossSections2D(elements[i], geomLoader->_expressIDToPlacement); - else crossSection = geomLoader->GetLoader().GetCrossSections3D(elements[i], geomLoader->_expressIDToPlacement); + if (dimensions == 2) crossSection = geomLoader->GetLoader().GetCrossSections2D(elements[i]); + else crossSection = geomLoader->GetLoader().GetCrossSections3D(elements[i]); crossSections.push_back(crossSection); } } @@ -236,7 +236,7 @@ std::vector GetAllAlignments(uint32_t modelID) for (size_t i = 0; i < elements.size(); i++) { - webifc::geometry::IfcAlignment alignment = geomLoader->GetLoader().GetAlignment(elements[i], geomLoader->_expressIDToPlacement); + webifc::geometry::IfcAlignment alignment = geomLoader->GetLoader().GetAlignment(elements[i]); alignment.transform(geomLoader->GetCoordinationMatrix()); alignments.push_back(alignment); }