Boost logo

Geometry :

Subject: [geometry] Fwd: Some updates
From: Andrew Hundt (athundt_at_[hidden])
Date: 2014-08-04 10:14:43

A coworker is running into an issue while attempting to run union_(), and I
was hoping you may be able to provide some feedback on what the problem may
be. I've included an abridged version of the emails below. Any help or
ideas would be very much appreciated.

Andrew Hundt

terminate called after throwing an instance of
  what(): Boost.Geometry Overlay invalid input exception

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.

On Aug 1, 2014, at 7:16 PM, Andrew Hundt <ahundt_at_[hidden]> wrote:

On Fri, Aug 1, 2014 at 6:15 PM, Carl Wellington <carlw_at_[hidden]> wrote:

> overlay_invalid_input_exception

Here is some info on it:

Basically it means there is some self intersection. May need to do
something like call simplify in between union operations.

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?


Geometry list run by mateusz at