
Mathias Gaunard wrote:
Simonson, Lucanus J wrote:
I almost forgot, there is actually a better answer to your question. The operators in the operators namespace are an optional feature of the library. You can instead use the polygon_set_data objects to perform explicit conversions and use the member operators of the polygon_set_data classes.
polygon_set_data<int>(some_polygon) | polygon_set_data<int>(some_rectangle);
Since operator| is in this case a member function it is found first though ADL.
Except this is going to copy some_polygon and some_rectangle to initialize the polygon_set_data, right?
Yes, however, polygon_set_data encapsulates the data structure that is the input to my sweep line algorithm. It needs to be copied to that format anyway so that I can sort and scan it. The generic operators are implemented by performing the conversion and using the member operator of the polygon_data_data classes. There is no way to run a sweepline algorithm on a polygon without sorting its edges into the order they are to be scanned, and there's no way to sort a polygon's edges without converting it. Luke