Skip to content

Commit

Permalink
finalized border computation algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
amock committed Aug 15, 2024
1 parent 4376909 commit 7030533
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/lvr2/algorithm/GeometryAlgorithms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ DenseEdgeMap<float> calcVertexDistances(const BaseMesh<BaseVecT>& 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<typename BaseVecT>
Expand Down
15 changes: 7 additions & 8 deletions include/lvr2/algorithm/GeometryAlgorithms.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -506,25 +506,24 @@ DenseVertexMap<float> 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
Expand Down

0 comments on commit 7030533

Please sign in to comment.