comparison Finder.cpp @ 33:333832a6ee5e

Some (commented-out) debug
author Chris Cannam
date Thu, 13 Nov 2014 07:45:01 +0000
parents 1ff9ae1dcb50
children
comparison
equal deleted inserted replaced
32:37c0b59fd514 33:333832a6ee5e
255 pathx.clear(); 255 pathx.clear();
256 pathy.clear(); 256 pathy.clear();
257 257
258 while (find(y, x) && ((x > 0) || (y > 0))) { 258 while (find(y, x) && ((x > 0) || (y > 0))) {
259 259
260 // cerr << "x = " << x << ", y = " << y;
261
260 pathx.push_back(x); 262 pathx.push_back(x);
261 pathy.push_back(y); 263 pathy.push_back(y);
262 264
263 switch (getDistance() & ADVANCE_BOTH) { 265 switch (getDistance() & ADVANCE_BOTH) {
264 case ADVANCE_THIS: y--; break; 266 case ADVANCE_THIS:
265 case ADVANCE_OTHER: x--; break; 267 // cerr << ", going down (dist = " << (int)getDistance() << ")" << endl;
266 case ADVANCE_BOTH: x--; y--; break; 268 y--;
269 break;
270 case ADVANCE_OTHER:
271 // cerr << ", going left (dist = " << (int)getDistance() << ")" << endl;
272 x--;
273 break;
274 case ADVANCE_BOTH:
275 // cerr << ", going diag (dist = " << (int)getDistance() << ")" << endl;
276 x--;
277 y--;
278 break;
267 default: // this would indicate a bug, but we wouldn't want to hang 279 default: // this would indicate a bug, but we wouldn't want to hang
268 cerr << "WARNING: Neither matcher advanced in path backtrack at (" << x << "," << y << ")" << endl; 280 // cerr << "WARNING: Neither matcher advanced in path backtrack at (" << x << "," << y << ")" << endl;
269 if (x > y) x--; else y--; break; 281 if (x > y) {
282 x--;
283 } else {
284 y--;
285 }
286 break;
270 } 287 }
271 } 288 }
272 289
273 std::reverse(pathx.begin(), pathx.end()); 290 std::reverse(pathx.begin(), pathx.end());
274 std::reverse(pathy.begin(), pathy.end()); 291 std::reverse(pathy.begin(), pathy.end());