Boost logo

Geometry :

Subject: [ggl] Re: Help needed with Intersection operation
From: Barend Gehrels (barend)
Date: 2011-08-31 03:07:49

On 30-8-2011 18:47, Simonson, Lucanus J wrote:
> Christoph,
> As it happens the Boost.Polygon library provide polygon intersection
> operations that use 32 bit long instead of double and are 100%
> numerically robust. The library uses snap rounding and bounds the
> maximum error to 1 integer unit square (you can move sqrt(2) distance
> diagonally at maximum due to integer snapping error). To get high
> precision you can scale your data. You might consider giving it a try.
> Regards,
> Luke
> ------------------------------------------------------------------------
> *From:* ggl-bounces_at_[hidden]
> [mailto:ggl-bounces_at_[hidden]] *On Behalf Of *Christoph Keller
> *Sent:* Monday, August 29, 2011 8:51 PM
> *To:* Generic Geometry Library Discussion
> *Subject:* Re: [ggl] Re: Help needed with Intersection operation
> Hello Barend,
> Maybe i could use integers (32 bit long) instead of double?
> I have to cut out streets (rectangles) out of a 2d mesh. The result is
> fed into a nav mesh generator, so it does not matter if the results
> are not absolutely precise, but they should not be off by a very wide
> margin.
> Thanks,
> Christoph

Hi Christoph,

If integer is an option, I don't exactly understand why ttmath is not.
Anyway, if you want to use integers, Boost.Polygon, as Luke suggests, is
a good alternative and tested extensively with integer coordinates.

Besides that, I looked further to the problem and in the end it is (of
course) very simple and fixed, at least temporary helped (I want to work
further on it but don't know if I've the time coming month). It was a
robustness issue and also influenced the testcase of Enrico and that if
Brandon (submitted long ago). I should have been more defensive at that

So thanks for the report, this again helped to make the library better,
and it is possible that you encounter more problems, if so the reports
are welcome.

Regards, Barend

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

Geometry list run by mateusz at