From 703053300d95ca75bfefe23ffa5b90c9c41bd27b Mon Sep 17 00:00:00 2001 From: Alexander Mock Date: Thu, 15 Aug 2024 22:46:49 +0200 Subject: [PATCH] finalized border computation algorithm --- include/lvr2/algorithm/GeometryAlgorithms.hpp | 2 +- include/lvr2/algorithm/GeometryAlgorithms.tcc | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/lvr2/algorithm/GeometryAlgorithms.hpp b/include/lvr2/algorithm/GeometryAlgorithms.hpp index 3e6beb51..9b37f0f4 100644 --- a/include/lvr2/algorithm/GeometryAlgorithms.hpp +++ b/include/lvr2/algorithm/GeometryAlgorithms.hpp @@ -204,7 +204,7 @@ DenseEdgeMap calcVertexDistances(const BaseMesh& mesh); * @brief Computes / set costs for each border vertex to predefined value * * @param mesh The mesh containing the vertices and edges of interest - * @param border_cost Predfined value to set the border vertices to. Defaults to 1.0 + * @param border_cost Predefined value to set the border vertices to. Defaults to 1.0 * @return The dense edge map with the border cost values */ template diff --git a/include/lvr2/algorithm/GeometryAlgorithms.tcc b/include/lvr2/algorithm/GeometryAlgorithms.tcc index 29d89fba..610c128e 100644 --- a/include/lvr2/algorithm/GeometryAlgorithms.tcc +++ b/include/lvr2/algorithm/GeometryAlgorithms.tcc @@ -506,25 +506,24 @@ DenseVertexMap calcBorderCosts( ++progress; // Calculate height difference for each vertex - // for(auto vH : mesh.vertices()) #pragma omp parallel for for (size_t i = 0; i < mesh.nextVertexIndex(); i++) { auto vH = VertexHandle(i); if (!mesh.containsVertex(vH)) { - continue; + continue; } - // new! give border vertex a high high bool is_border_vertex = false; for(auto edge : mesh.getEdgesOfVertex(vH)) { - if(mesh.isBorderEdge(edge)) - { - is_border_vertex = true; - break; // early finish - } + if(mesh.isBorderEdge(edge)) + { + is_border_vertex = true; + // it's a border vertex. stop searching. early finish + break; + } } // Calculate the final border weight