Pretty sure I have done this before, but the code and the concept is lost on me today.
I'm building a small game prototype, and couldn't be arsed to code the level generator yet. So I'm just 'scanning' a 3d mesh I made and mapping the highs and lows onto a 32x32 2d grid.
The final map is a multidimensional bool array, true = wall, false = floor - and now I just want to find the rooms. All rooms are rectangular, and are connected by corridors 1 cell wide.
Any takers? :)
EDIT: I'm not looking for code specifically, but any examples are welcome of course. So, if you just have an idea for solving the challenge, that's fine too.