T
Tyrolean Dairy Co.
Guest
I have a ds_grid that I sometimes need to update in a diagonal fashion and I wondered if anyone could suggest a method.
The attached image shows what I'm trying to do (the actual grid is larger). First the red diagonal (1 cell) is updated, then the yellow (2 cells), then the green (3 cells) and so on. In the pic I'm working from the North-West to the South-East but I'd like to be able to adapt the code for the three other diagonal directions too.
I'm using versions of the following code to update the ds_grid horizontally and vertically:
for (zwc = 0; zwc < w; zwc++) { // cycle through width of grid
for (zhc = 0; zhc < h; zhc++) { // cycle through height of grid
///MAGIC HERE// }}
..but can't work out how to adapt it for diagonals.
All suggestions much appreciated. Thanks.
(the numbers in the grid cells are to show order only. The actual values will vary)
[
The attached image shows what I'm trying to do (the actual grid is larger). First the red diagonal (1 cell) is updated, then the yellow (2 cells), then the green (3 cells) and so on. In the pic I'm working from the North-West to the South-East but I'd like to be able to adapt the code for the three other diagonal directions too.
I'm using versions of the following code to update the ds_grid horizontally and vertically:
for (zwc = 0; zwc < w; zwc++) { // cycle through width of grid
for (zhc = 0; zhc < h; zhc++) { // cycle through height of grid
///MAGIC HERE// }}
..but can't work out how to adapt it for diagonals.
All suggestions much appreciated. Thanks.
(the numbers in the grid cells are to show order only. The actual values will vary)
[
Last edited by a moderator: