So this is what is happening:
The self intersection happens after you take a union of the above two rings.
I tried calling simplify on the multi_polygon, but that just made the multi_polygon of size zero. I then tried calling simplify on each polygon inside the multi_polygon, but that just made the size of each polygon inside zero. I’ve tried different size parameters for simplify, including 1, 2, 5, all with the same effect.
As usual, it is really too bad the documentation for boost is so terrible. I would probably like it a lot more if it had reasonable documentation. Just getting to the above point, figuring out things like how to even get the points out of a multi_polygon has taken me hours, and I have no idea why simplify just makes everything size zero.
A few more quick observations:
The multi-polygon after calling union on the red and blue rings in the figure has two polygons: one of size 17 (the size of the first ring to be added) and one of size 23. This multi-polygon self intersects so I guess something goes wrong with the union and that’s why there are two polygons when I expect there should only be one.
If I try convex_hull on each polygon inside the multi-polygon after the union, then as soon as I add a single ring to the multi-polygon using union and run convex_hull on the first polygon, the size goes from 17 to 28 and it self-intersects. This seems very odd and I’m probably doing something wrong since it’s just a single convex ring.
Any ideas for what to try next?
-Carl