|
Geometry : |
Subject: [ggl] Re: Problems with the difference between two polygons
From: Barend Gehrels (barend)
Date: 2011-08-08 01:46:17
On 7-8-2011 2:47, Angus Johnson wrote:
> On 7/08/2011 10:29 AM, Simonson, Lucanus J wrote:
>> I'm not sure that one choice of rounding can be called more correct
>> than another.
>
> Hi Luke. I hope I didn't call my library "more correct" than the
> others, as that is evidently not the case. However, I was stating that
> Clipper was returning a simpler (while still correct) solution.
>
>> Ggl is most accurate because it uses only machine rounding.
>
> ISTM Ggl doesn't round, but otherwise - yes, fractions *may be* more
> accurate, though Is Ggl still vulnerable to floating point imprecision
> (see
> http://barendgehrels.blogspot.com/2011/01/precision-cause-of-spikes.html
> )?
Please read also the first part of that blog:
http://barendgehrels.blogspot.com/2011/01/sql-server-postgis-stdifference-and.html
These both blog-pages say, in essention, that adding ten times 0.1 might
result in 0.99999 or so, and repeatedly adding/subtracting FP-values
might give small difference. If you add and subtract in two dimensions,
you might get those artefacts, in most of the FP libraries that I tried
(not in ESRI). I called these spikes "the visualization of FP-imprecision".
Using ttmath they were not generated. I'm curious what GTL or Clipper
(it uses integer?) do in exactly this scenario, because it is
essentially caused by rounding to the FP-grid, so comparable to rounding
to an integer grid.
Note that it is the repeated process of adding/subtracting that might
give artefacts, not a simple intersection or union.
Now that I see that page again, I notice an unanswered question, will
work on that.
Regards, Barend
Geometry list run by mateusz at loskot.net