I need to create a set of rectangles of a predetermined size that form a grid inside of an irregular (probably not convex) polygon. (I realize there will be bits on the edges that won't fit in a rectangle. Those can just be dropped.) Everything is in 2-dimensions and my point type is a double. I'm working with UTM data so my polygons are nowhere near origin. I have to work with c++. I have two questions:
Can this be done with boost? I looked into the Voronoi diagram builder, but I'm having trouble generating a rectangular lattice of points within my polygon.
Is there another geometry library I can use that's better suited to generating a set of rectangles inside a polygon?
I wrote my own function that does this. It may not be pretty, but it works. I first determined the highest and lowest x and y values. Then I pass those to this function and define the boundaries of my cells based on the constant values.
const1 and const2 define the size of my cells. Finally, I wrote a function to remove cells not within the boundaries of my polygon.
This is certainly not the neatest solution, but I would welcome ways to improve the efficiency of my code.