EgtNumKernel :
- in ShortestPath reintrodotto MAXDIST.
This commit is contained in:
@@ -15,6 +15,9 @@
|
||||
|
||||
#include "/EgtDev/Include/ENkShortestPath.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
#define MAXDIST 1073741823U // 2^30 - 1 per evitare overflow
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
struct SpPoint {
|
||||
double dXi ;
|
||||
|
||||
+5
-5
@@ -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 ;
|
||||
|
||||
Reference in New Issue
Block a user