Grid generation for an complex polygon

Hi ,

I have got a polygon with n sides where all the edges are parallel to the coordinate axis(XZ)
this polygon form a floor with these edges and , i need to genrate the grid/Mesh for the polygon. I will try to illustrate the polygon clearly with my key board art.

   |-----|    |-----------------|
   |     |    |                 |
   |     |----|                 |
   |                      |-----|
   |                      |      
   |         |-----|      |      
   |         |     |      |-----|
   |         |     |            |
   ----------|     |------------|

The above fig describes a polygon, I need to fill the polygon with the grid cell size P X q.The cells need to be present only with in the surface.

Can any one help me to design the algorihm.

Thanks
kumar.k

sorry my polygon art became worst after submittion. Think of the room and how the room can be and tht is my polygon with n sides. need to genrate the gird for the floor of the room

kumar.k