The more I think about it, the more confused I get. What are the exact pre-conditions and post-conditions of your algorithms?
On http://www.boost.org/doc/libs/1_56_0/libs/geometry/doc/html/geometry/reference/algorithms/difference.html it says: “Check the Polygon Concept for the rules that polygon input for this algorithm should fulfill”.
On http://www.boost.org/doc/libs/1_56_0/libs/geometry/doc/html/geometry/reference/concepts/concept_polygon.html it says “There should be no cut lines, spikes or punctures”. It also says “If the input is invalid, the output might be invalid too”. Fair enough.
What it doesn’t say is that a polygon without area is invalid. Let’s take that at face value, though: It is trivial to imagine, e.g., the difference of two non-empty, valid polygons that results in empty polygon. Does this mean that, e.g., the difference algorithm can take valid input and return invalid output?
If I a have a computation that consists of multiple steps, I would like to make sure that the input is valid, and then run my computation as a sequence of calls to geometry algorithms. Given the above – do I have to verify every intermediate result, and make sure that if I find an invalid polygon, the algorithm returns half way? What is your recommended best practice to deal with this? I am sure that calling correct, unique, remove_spikes (in which order?) and is_valid all over the place cannot be the answer…