Boost logo

Geometry :

Subject: [ggl] Difference / xor for multi polygons
From: Barend Gehrels (barend)
Date: 2011-03-08 13:40:16

On 8-3-2011 0:56, Simonson, Lucanus J wrote:
> What are the prospects for enhancing the polygon clipping algorithm
> itself to handle such cases correctly? I'll leave aside handling of
> self intersection/self overlap, but handling self abutment of polygons
> seems like a reasonable expectation from the user's perspective. If
> dissolve can be made guaranteed to work then it can be run on each
> input to handle these cases. Alternately the precondition can be
> checked and an exception thrown. Silently returning the wrong result
> for self abutting or self intersecting input polygons is not very
> desirable, from a user perspective. Perhaps you can throw self
> intersecting polygon or self abutting polygon exception and perhaps
> also the coordinates of the first detected instance of the
> precondition violation so that the user is not caught unaware. CGAL
> throws a generic precondition violation for any problem, but it isn't
> at all clear what all of the precondition requirements are, which one
> was violated or where the violation is in the input. I'd like to see
> better error handling than that, since I found CGAL very frustrating.
> Keep in mind that error handling is part of the interface. The user
> may wish to catch the exception and cleanup their data then retry.
I agree with it that there must be something. Self-intersection is one
thing but these are self-touching polygons and, even if not strictly
valid, this behaviour might be unexpected for most users.

The reasons for not doing this check is performance - the check takes
time. I'm still thinking that in some situations, where you know you're
data is valid, you should be able to avoid this.

But it might be convenient to have a check by default. I'll think about

Regards, Barend

Barend Gehrels
-------------- next part --------------
An HTML attachment was scrubbed...

Geometry list run by mateusz at