EgtNumKernel :

- in ShortestPath reintrodotto MAXDIST.
This commit is contained in:
SaraP
2021-11-19 17:10:59 +01:00
parent ec9e4b4c76
commit 7f21cf0f43
2 changed files with 8 additions and 5 deletions
+3
View File
@@ -15,6 +15,9 @@
#include "/EgtDev/Include/ENkShortestPath.h"
//----------------------------------------------------------------------------
#define MAXDIST 1073741823U // 2^30 - 1 per evitare overflow
//----------------------------------------------------------------------------
struct SpPoint {
double dXi ;
+5 -5
View File
@@ -297,7 +297,7 @@ ShortestPath::CalcDistances( void)
nDist = 0 ;
break ;
}
m_Dists[ Index( m_nNumPnts - 1, i)] = nDist ;
m_Dists[ Index( m_nNumPnts - 1, i)] = min( nDist, MAXDIST) ;
// verifico se nuovo minimo di linea
if ( nDist < nRowMinDist)
nRowMinDist = nDist ;
@@ -333,10 +333,10 @@ ShortestPath::CalcDistances( void)
nDist = 0 ;
break ;
}
m_Dists[ Index( i, m_nNumPnts - 1)] = nDist ;
m_Dists[ Index( i, m_nNumPnts - 1)] = min( nDist, MAXDIST) ;
}
// punto su diagonale principale
m_Dists[ Index( m_nNumPnts - 1, m_nNumPnts - 1)] = UINT_MAX ;
m_Dists[ Index( m_nNumPnts - 1, m_nNumPnts - 1)] = MAXDIST ;
// devo ancora calcolare le righe/colonne precedenti
nLimit = m_nNumPnts - 1 ;
}
@@ -352,14 +352,14 @@ ShortestPath::CalcDistances( void)
float dDz = float( m_Points[i].dZf - m_Points[j].dZi) ;
float dDh = float( m_Points[i].dHf - m_Points[j].dHi) ;
float dDv = float( m_Points[i].dVf - m_Points[j].dVi) ;
unsigned nDist = GetDistance( dDx, dDy, dDz, dDh, dDv) ;
unsigned nDist = min( GetDistance( dDx, dDy, dDz, dDh, dDv), MAXDIST) ;
m_Dists[ Index( i, j)] = nDist ;
// verifico se nuovo minimo di linea
if ( nDist < nRowMinDist)
nRowMinDist = nDist ;
}
else
m_Dists[ Index( i, j)] = UINT_MAX ;
m_Dists[ Index( i, j)] = MAXDIST ;
}
// aggiorno il totale delle minime distanze
m_nTotMin += nRowMinDist ;