From 981561fc5546464701d7ad32ac735fe0d2ed6e97 Mon Sep 17 00:00:00 2001 From: Martin Heistermann Date: Tue, 23 Aug 2022 15:37:19 +0200 Subject: [PATCH] Fix singularity alignment pair search: Only use pairs where all sides on the path consist of only a single subside, as described in the paper. --- .../quadretopology/includes/qr_ilp.cpp | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/libs/quadretopology/quadretopology/includes/qr_ilp.cpp b/libs/quadretopology/quadretopology/includes/qr_ilp.cpp index 62851f91..a520c39b 100644 --- a/libs/quadretopology/quadretopology/includes/qr_ilp.cpp +++ b/libs/quadretopology/quadretopology/includes/qr_ilp.cpp @@ -319,6 +319,13 @@ inline void solveILP( } const ChartSide& adjOppositeSide = currentChart.chartSides[adjOppositeSideId]; + if (adjOppositeSide.subsides.size() != 1) { + currentChartId = -1; + currentChartSideId = -1; + currentChartNSides = 0; + break; + } + const std::array& incidentCharts = chartData.subsides[adjOppositeSide.subsides[0]].incidentCharts; const std::array& incidentChartSides = chartData.subsides[adjOppositeSide.subsides[0]].incidentChartSideId; @@ -338,7 +345,12 @@ inline void solveILP( } while (currentChartId != static_cast(cId) && currentChartId > -1 && currentChartNSides == 4); - if (currentChartId != static_cast(cId) && currentChartId > -1 && (currentChartNSides == 3 || currentChartNSides == 5 || currentChartNSides == 6)) { + + if (currentChartId != static_cast(cId) + && currentChartId > -1 + && (currentChartNSides == 3 || currentChartNSides == 5 || currentChartNSides == 6) + && chartData.charts[currentChartId].chartSides[currentChartSideId].subsides.size() == 1) + { bool currentComputable = true; for (size_t i = 0; i < chartData.charts[currentChartId].chartSubsides.size(); i++) { const size_t subsideId = chartData.charts[currentChartId].chartSubsides[i]; @@ -638,7 +650,14 @@ inline void solveILP( if (currentChartId != static_cast(cId)) { adjOppositeSideId = (currentChartSideId + 2) % chartData.charts[currentChartId].chartSides.size(); } + const ChartSide& adjOppositeSide = currentChart.chartSides[adjOppositeSideId]; + if (adjOppositeSide.subsides.size() != 1) { + currentChartId = -1; + currentChartSideId = -1; + currentChartNSides = 0; + break; + } const std::array& incidentCharts = chartData.subsides[adjOppositeSide.subsides[0]].incidentCharts; const std::array& incidentChartSides = chartData.subsides[adjOppositeSide.subsides[0]].incidentChartSideId; @@ -659,7 +678,11 @@ inline void solveILP( } while (currentChartId != static_cast(cId) && currentChartId > -1 && currentChartNSides == 4); - if (currentChartId != static_cast(cId) && currentChartId > -1 && (currentChartNSides == 3 || currentChartNSides == 5 || currentChartNSides == 6)) { + if (currentChartId != static_cast(cId) + && currentChartId > -1 + && (currentChartNSides == 3 || currentChartNSides == 5 || currentChartNSides == 6) + && chartData.charts[currentChartId].chartSides[currentChartSideId].subsides.size() == 1) + { bool currentComputable = true; for (size_t i = 0; i < chartData.charts[currentChartId].chartSubsides.size(); i++) { const size_t subsideId = chartData.charts[currentChartId].chartSubsides[i];