Mercurial > hg > match-vamp
diff src/Finder.cpp @ 59:fb6e4829c1af cheap_diagonals
Weight of sqrt(2) in both cases
author | Chris Cannam |
---|---|
date | Fri, 14 Nov 2014 12:35:36 +0000 |
parents | bbdcf79f3916 |
children | ad417dd05e0b |
line wrap: on
line diff
--- a/src/Finder.cpp Fri Nov 14 10:26:13 2014 +0000 +++ b/src/Finder.cpp Fri Nov 14 12:35:36 2014 +0000 @@ -210,6 +210,8 @@ void Finder::recalculatePathCostMatrix(int r1, int c1, int r2, int c2) { + float diagonalWeight = sqrtf(2.f); + if (!find(r1,c1)) { std::cerr << "recalculatePathCostMatrix(" << r1 << "," << c1 << "): out of bounds" << std::endl; throw "recalculatePathCostMatrix index out of bounds"; @@ -230,7 +232,7 @@ if ((c > prevRowStart) && (c <= prevRowStop)) { // diagonal from (r-1,c-1) min = pm1->m_bestPathCost[r-1][c-pm1->m_first[r-1]-1] + - newCost; + newCost * diagonalWeight; dir = Matcher::AdvanceBoth; } if ((c >= prevRowStart) && (c < prevRowStop)) {