Matrix: direction aware varient of neighbours method
cbrown1234 opened this issue · 1 comments
cbrown1234 commented
Would it make sense to add to a direction aware version of Matrix::neighbours to this crate?
Along the lines of:
pub fn neighbours_enumerated_by_direction(
&self,
(r,c): (usize, usize),
diagonals: bool,
) -> impl Iterator<Item = ((isize, isize), (usize, usize))>
Potentially it could be better if the directions were an enum.
My context for this is that I'm working on some flow field pathfinding algorithms in which it's required to keep track of the direction of minimum values of neighbours.
samueltardieu commented
I'm not convinced this is general enough to make it a method. You can easily use the matrix::directions
module to make such a function. However, if you find that you cannot do this efficiently unless this is a specialized method, I could reconsider this position.