0

Hey all,

I have a conceptual question. I have a 2-dimensional grid with on/off (0/1) values for every cell it.

What I would like to do is to calculate the distance covered over cells with a value 0 and the distance covered over cells with a value of 1 when moving (or tracing a line) between point A (with coordinates x1,y1) and B (with coordinates x2,y2).

Now, I know, that the calculation of the distance mathematically is the sqrt ((x1-x2)^2 + (y1-y2)^2 ) but I don't really know how to differentiate between the 1 and 0 values.

Anyone having an idea on how to do this?

Thanks a lot everyone!