From b98261e29fd6e35f73f467010dfc3f1a52ee3298 Mon Sep 17 00:00:00 2001 From: gabryon99 Date: Thu, 16 Sep 2021 18:58:41 +0200 Subject: [PATCH] fix meshtree params --- vcg/complex/algorithms/align_global.h | 15 ++++++++++----- vcg/complex/algorithms/meshtree.h | 9 ++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/vcg/complex/algorithms/align_global.h b/vcg/complex/algorithms/align_global.h index fbd049df..c695a623 100644 --- a/vcg/complex/algorithms/align_global.h +++ b/vcg/complex/algorithms/align_global.h @@ -472,7 +472,7 @@ namespace vcg { AlignGlobal::LOG(elfp,"\nDormant Num: %i\n", DormantNum()); curr = ChooseDormantWithMostDormantLink(); - if (curr == 0) { + if (curr == nullptr) { AlignGlobal::LOG(elfp,"\nFailed ChooseDormantWithMostDormantLink, chosen id:%i\n" ,0); break; // non ci sono piu' componenti connesse composte da piu' di una singola mesh. } @@ -483,7 +483,7 @@ namespace vcg { curr->Active = true; cursid = curr->sid; curr = ChooseDormantWithMostActiveLink (); - if (curr == 0) { + if (curr == nullptr) { AlignGlobal::LOG(elfp, "\nFailed ChooseDormantWithMostActiveLink, chosen id:%i\n", 0); } else { @@ -545,7 +545,7 @@ namespace vcg { AlignGlobal::Node* ChooseDormantWithMostDormantLink() { int MaxAdjNum = 0; - AlignGlobal::Node *BestNode = 0; + AlignGlobal::Node *BestNode = nullptr; for (auto li = std::begin(N); li != std::end(N); ++li) { if (!(*li).Active) { @@ -557,6 +557,11 @@ namespace vcg { } } + if (!BestNode){ + std::printf("Warning! Unable to find a Node with at least a dormant link!!\n"); + return nullptr; + } + assert(BestNode); assert(!BestNode->Queued); assert(!BestNode->Active); @@ -567,7 +572,7 @@ namespace vcg { AlignGlobal::Node* ChooseDormantWithMostActiveLink() { int MaxAdjNum = 0; - AlignGlobal::Node* BestNode = 0; + AlignGlobal::Node* BestNode = nullptr; for (auto li = std::begin(N); li != std::end(N); ++li) { if (!(*li).Active) { @@ -582,7 +587,7 @@ namespace vcg { if (!BestNode){ // Abbiamo finito di sistemare questa componente connessa. std::printf("Warning! Unable to find a Node with at least an active link!!\n"); - return 0; + return nullptr; } assert(BestNode); diff --git a/vcg/complex/algorithms/meshtree.h b/vcg/complex/algorithms/meshtree.h index f5221f08..13d0d3a9 100644 --- a/vcg/complex/algorithms/meshtree.h +++ b/vcg/complex/algorithms/meshtree.h @@ -39,7 +39,7 @@ namespace vcg { class Param { public: - int OGSize = 5000; + int OGSize = 50000; float arcThreshold = 0.3f; float recalcThreshold = 0.1f; }; @@ -50,12 +50,14 @@ namespace vcg { vcg::OccupancyGrid OG{}; vcg::CallBackPos* cb = vcg::DummyCallBackPos; + MeshTree() = default; + + ~MeshTree() { clear(); } + MeshType *MM(unsigned int i) { return nodeMap[i]->m; } - MeshTree() = default; - void clear() { for (auto& ni : nodeMap) { @@ -381,6 +383,7 @@ namespace vcg { } }; + } #endif //VCGLIB_MESHTREE_H