MCPcopy Create free account
hub / github.com/WallBreaker2/op / next

Method next

libop/image/ImageSearchAlgorithms.cpp:363–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361 }
362
363 bool next(int &x) {
364 while ((left >= x1 && left < x2) || (right >= x1 && right < x2)) {
365 const bool has_left = left >= x1 && left < x2;
366 const bool has_right = right >= x1 && right < x2;
367 if (has_left && has_right) {
368 const long long left_dx = static_cast<long long>(left) * 2 - center2x;
369 const long long right_dx = static_cast<long long>(right) * 2 - center2x;
370 if (left_dx * left_dx <= right_dx * right_dx) {
371 x = left--;
372 return true;
373 }
374 x = right++;
375 return true;
376 }
377 if (has_left) {
378 x = left--;
379 return true;
380 }
381 x = right++;
382 return true;
383 }
384 return false;
385 }
386
387 int y;
388 int x1;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected