From 089e50cc986730f05c64ae814e21529fcdd44f91 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 7 Jun 2024 22:54:51 +0200 Subject: update rtree with upstream changes --- src/RTree.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/RTree.hpp b/src/RTree.hpp index 3ac1bde1..143925c2 100644 --- a/src/RTree.hpp +++ b/src/RTree.hpp @@ -937,7 +937,8 @@ void RTREE_QUAL::ChoosePartition(PartitionVars* a_parVars, int a_minFill) { fm_assert(a_parVars); - ELEMTYPEREAL biggestDiff; + bool firstTime; + ELEMTYPEREAL biggestDiff = 0; int group, chosen = 0, betterGroup = 0; InitParVars(a_parVars, a_parVars->m_branchCount, a_minFill); @@ -947,7 +948,7 @@ void RTREE_QUAL::ChoosePartition(PartitionVars* a_parVars, int a_minFill) && (a_parVars->m_count[0] < (a_parVars->m_total - a_parVars->m_minFill)) && (a_parVars->m_count[1] < (a_parVars->m_total - a_parVars->m_minFill))) { - biggestDiff = (ELEMTYPEREAL) -1; + firstTime = true; for(int index=0; indexm_total; ++index) { if(PartitionVars::NOT_TAKEN == a_parVars->m_partition[index]) @@ -968,8 +969,9 @@ void RTREE_QUAL::ChoosePartition(PartitionVars* a_parVars, int a_minFill) diff = -diff; } - if(diff > biggestDiff) + if(firstTime || diff > biggestDiff) { + firstTime = false; biggestDiff = diff; chosen = index; betterGroup = group; @@ -1052,8 +1054,9 @@ void RTREE_QUAL::InitParVars(PartitionVars* a_parVars, int a_maxRects, int a_min RTREE_TEMPLATE void RTREE_QUAL::PickSeeds(PartitionVars* a_parVars) { + bool firstTime; int seed0 = 0, seed1 = 0; - ELEMTYPEREAL worst, waste; + ELEMTYPEREAL worst = 0, waste; ELEMTYPEREAL area[MAXNODES+1]; for(int index=0; indexm_total; ++index) @@ -1061,15 +1064,16 @@ void RTREE_QUAL::PickSeeds(PartitionVars* a_parVars) area[index] = CalcRectVolume(&a_parVars->m_branchBuf[index].m_rect); } - worst = -a_parVars->m_coverSplitArea - 1; + firstTime = true; for(int indexA=0; indexA < a_parVars->m_total-1; ++indexA) { for(int indexB = indexA+1; indexB < a_parVars->m_total; ++indexB) { Rect oneRect = CombineRect(&a_parVars->m_branchBuf[indexA].m_rect, &a_parVars->m_branchBuf[indexB].m_rect); waste = CalcRectVolume(&oneRect) - area[indexA] - area[indexB]; - if(waste > worst) + if(firstTime || waste > worst) { + firstTime = false; worst = waste; seed0 = indexA; seed1 = indexB; -- cgit v1.2.3