A function that takes an index and horizontal step size (in terms of a number of pixels) as arguments, and outputs the COLUMN index of the new location after the step has been taken.
A function that takes an index and vertical step size (in terms of a number of pixels) as arguments, and outputs the ROW index of the new location after the step has been taken.
A function that takes a start index and a 2D step (as a morph::vec<int, 2>, in terms of numbers of pixels) as arguments and outputs the index after the move has been made.
The functions work with all GridOrders and all GridWraps.
Comprehensive unit tests are included and are passing.
I wondered whether it would be best if only (3) were a public function and have (1) and (2) as private ones? But I'll leave that up to you.
I've written three functions into Grid.
The functions work with all GridOrders and all GridWraps. Comprehensive unit tests are included and are passing.
I wondered whether it would be best if only (3) were a public function and have (1) and (2) as private ones? But I'll leave that up to you.