I have a Boost Polygon made like this :
Polygon2D create_polygon(Point2D const& p1, Point2D const& p2, Point2D const& p3, Point2D const& p4) {
return {{p1, p2, p3, p4, p1}};
}
int main() {
auto const& polygon = create_polygon({0., 0.}, {0., 4.}, {7., 4.}, {7., 0.});
return 0;
}
(not exactly my code but really similar and a lot more simple so i think it's better to understand).
And basically, i want to divide my polygon into regions and get a random coordinate (x & y) from each region (or just select specific regions). Something like this :
Of course i know it's not going to be square, because a polygon is not everytime simple like this.
Do boost c++ have a specific "algorithm" or tool used to divide a Polygon into areas without impacting the whole Polygon ?
I have read that voronoi can do something similar to that, but when i'm looking to the example (https://www.boost.org/doc/libs/1_59_0/libs/polygon/doc/voronoi_main.htm) it's not really looking good for my problem.
Or maybe another "famous" algorithm can do something similar without the use of boost c++ ?
The requirement about regions are :
If you only want to use the subdivision to get the random points in your polygon, you can avoid that by combining the idea of marching squares with Monte Carlo: