From 48db47c19402ea6c3d2a018dfa149ed8e2706a1a Mon Sep 17 00:00:00 2001 From: Jan Schnathmeier <jschnathmeier@veil.informatik.rwth-aachen.de> Date: Thu, 12 Mar 2020 15:45:38 +0100 Subject: [PATCH] Remove MarkPath (Implicit Dijkstra method) #38 --- Embedding.cc | 65 ---------------------------------------------------- Embedding.hh | 10 -------- 2 files changed, 75 deletions(-) diff --git a/Embedding.cc b/Embedding.cc index 7f5e91a..d358780 100644 --- a/Embedding.cc +++ b/Embedding.cc @@ -1948,12 +1948,9 @@ void Embedding::NaiveVoronoi(std::queue<OpenMesh::VertexHandle> queue, OpenMesh::VPropHandleT<OpenMesh::HalfedgeHandle> to_heh) { while (!queue.empty()) { auto vh = queue.front(); - //qDebug() << "Vertex ID: " << vh.idx(); - //qDebug() << "Voronoi ID: " << base_mesh_->property(voronoiID, vh).idx(); for (auto vvh : base_mesh_->vv_range(vh)){ if (!meta_mesh_->is_valid_handle(base_mesh_->property(voronoiID_, vvh))) { base_mesh_->property(voronoiID_, vvh) = base_mesh_->property(voronoiID_, vh); - //qDebug() << "Voronoi ID: " << base_mesh_->property(voronoiID, vh).idx(); base_mesh_->property(voronoidistance, vvh) = base_mesh_->property(voronoidistance, vh) + base_mesh_->calc_edge_length(base_mesh_->find_halfedge(vh,vvh)); base_mesh_->property(to_heh, vvh) = base_mesh_->find_halfedge(vh,vvh); @@ -1964,7 +1961,6 @@ void Embedding::NaiveVoronoi(std::queue<OpenMesh::VertexHandle> queue, if (newdist < base_mesh_->property(voronoidistance, vvh)) { base_mesh_->property(voronoidistance, vvh) = newdist; base_mesh_->property(voronoiID_, vvh) = base_mesh_->property(voronoiID_, vh); - //qDebug() << "Voronoi ID: " << base_mesh_->property(voronoiID, vh).idx(); base_mesh_->property(to_heh, vvh) = base_mesh_->find_halfedge(vh,vvh); queue.push(vvh); if (base_mesh_->property(voronoiID_, vvh) != base_mesh_->property(voronoiID_, vh)) { @@ -1979,67 +1975,6 @@ void Embedding::NaiveVoronoi(std::queue<OpenMesh::VertexHandle> queue, ColorizeVoronoiRegions(); } - -void Embedding::MarkPath(OpenMesh::HalfedgeHandle heh, OpenMesh::HalfedgeHandle metaeh, - OpenMesh::VPropHandleT<OpenMesh::HalfedgeHandle> to_heh, - OpenMesh::VPropHandleT<double> voronoidistance, - OpenMesh::HPropHandleT<int> multiplicity_heh) { - - //qDebug() << "Entering MarkPathrecursive:"; - MarkPathRecursive(base_mesh_->from_vertex_handle(heh) - , base_mesh_->opposite_halfedge_handle(heh), metaeh, to_heh, - voronoidistance, multiplicity_heh); - - // middle halfedges are marked twice, avoid this - base_mesh_->property(multiplicity_heh, heh) -= 1; - base_mesh_->property(multiplicity_heh, base_mesh_->opposite_halfedge_handle(heh)) -= 1; - - //qDebug() << "Entering MarkPathrecursive:"; - MarkPathRecursive(base_mesh_->to_vertex_handle(heh), heh, - meta_mesh_->opposite_halfedge_handle(metaeh), to_heh, - voronoidistance, multiplicity_heh); -} - -void Embedding::MarkPathRecursive(OpenMesh::VertexHandle vh, OpenMesh::HalfedgeHandle toheh, - OpenMesh::HalfedgeHandle metaheh, - OpenMesh::VPropHandleT<OpenMesh::HalfedgeHandle> to_heh, - OpenMesh::VPropHandleT<double> voronoidistance, - OpenMesh::HPropHandleT<int> multiplicity_heh) { - if (debug_hard_stop_) - return; - - if (NeedReadjusting(vh, to_heh)) { - ReadjustPath(vh, toheh, metaheh, to_heh, voronoidistance); - } - auto fromhehnext = base_mesh_->opposite_halfedge_handle(toheh); - - base_mesh_->property(multiplicity_heh, toheh) += 1; - base_mesh_->property(multiplicity_heh, fromhehnext) += 1; - - base_mesh_->property(bhe_connection_, toheh) = meta_mesh_->opposite_halfedge_handle(metaheh); - base_mesh_->property(bhe_connection_, fromhehnext) = metaheh; - if (base_mesh_->is_valid_handle((base_mesh_->property(bv_connection_, vh)))) { - //qDebug() << "Entering MarkPathrecursive if-statement:"; - base_mesh_->property(next_heh_, toheh) = OpenMesh::PolyConnectivity::InvalidHalfedgeHandle; - meta_mesh_->property(mhe_connection_, metaheh) = fromhehnext; - } else { - //qDebug() << "Entering MarkPathrecursive else-statement:"; - // - // vh-1 -- fromheh --> vh -- fromhehnext --> vh1 - // vh-1 <-- tohehnext -- vh <-- toheh -- vh1 - // - // This covers everything except the last / first vertex and corresponding hes, - // those are covered in the if statement - // - auto fromheh = base_mesh_->property(to_heh, vh); - auto tohehnext = base_mesh_->opposite_halfedge_handle(fromheh); - base_mesh_->property(next_heh_, toheh) = tohehnext; - base_mesh_->property(next_heh_, fromheh) = fromhehnext; - auto nextvh = base_mesh_->to_vertex_handle(tohehnext); - MarkPathRecursive(nextvh, tohehnext, metaheh, to_heh, voronoidistance, multiplicity_heh); - } -} - bool Embedding::NeedReadjusting(OpenMesh::VertexHandle bvh, OpenMesh::VPropHandleT<OpenMesh::HalfedgeHandle> to_heh) { //qDebug() << "1"; diff --git a/Embedding.hh b/Embedding.hh index f59ba6a..921b87b 100644 --- a/Embedding.hh +++ b/Embedding.hh @@ -134,16 +134,6 @@ private: void NaiveVoronoi(std::queue<OpenMesh::VertexHandle> queue, OpenMesh::VPropHandleT<double> voronoidistance, OpenMesh::VPropHandleT<OpenMesh::HalfedgeHandle> to_heh); - - void MarkPath(OpenMesh::HalfedgeHandle heh, OpenMesh::HalfedgeHandle metaheh, - OpenMesh::VPropHandleT<OpenMesh::HalfedgeHandle> to_heh, - OpenMesh::VPropHandleT<double> voronoidistance, - OpenMesh::HPropHandleT<int> multiplicity_heh); - void MarkPathRecursive(OpenMesh::VertexHandle vh, OpenMesh::HalfedgeHandle toheh, - OpenMesh::HalfedgeHandle metaheh, - OpenMesh::VPropHandleT<OpenMesh::HalfedgeHandle> to_heh, - OpenMesh::VPropHandleT<double> voronoidistance, - OpenMesh::HPropHandleT<int> multiplicity_heh); bool NeedReadjusting(OpenMesh::VertexHandle bvh, OpenMesh::VPropHandleT<OpenMesh::HalfedgeHandle> to_heh); void ReadjustPath(OpenMesh::VertexHandle bvh, -- GitLab