views:

72

answers:

1

Please see attached picture to better understand my question

i have a matrix of cells of [JXI] , cell is square in shape with length "a"

my question is .. is there a way to use FOR loop to assign MIN,MAX coordinate to each cell taking origin (0,0) at one corner

Thanks

image

i was trying following code but no success

int a ; 
a = 1;
for (int J=1; J<=5; J++)
{
  for (int I = 1; I <= 5; I++)
  {
    double Xmin = ((I - 1)*a );
    double Ymin = ((J - 1) * a);
    double Xmax = (I * a );
    double Ymax = (J * a);
  }
}
+1  A: 

Your code is ok. Just decide what you should do with max and min values.

Hun1Ahpu