c - An algorithm to group cells into rectangles -


example diagram

imagine picture above represents 6*6 array of ints 0 black. there quick algorithm split non 0 cells rectangles? ideally check contained within loop, without creating other arrays.

for(x = 0; x < 6; x++)     for(y = 0; y < 6; y++)         if(cellisbottomrightofrect(x,y)) {             left = getleft(x,y);             top = gettop(x,y);             printf("rect: %d,%d %d,%d \n", left, top, x, y);         } 

how using recursive method calls everytime encounters color different 1 trying group @ moment?


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -