summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-06-07 22:54:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-06-07 23:22:53 +0200
commit089e50cc986730f05c64ae814e21529fcdd44f91 (patch)
treed8362aaa6d462a4b5d8f7d465faa6e955467abcc /src
parentae78c59389e65493e073bcfd127cdf33b267e042 (diff)
update rtree with upstream changes
Diffstat (limited to 'src')
-rw-r--r--src/RTree.hpp16
1 files changed, 10 insertions, 6 deletions
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; index<a_parVars->m_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; index<a_parVars->m_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;