User talk:Vballhermie007

From Rosetta Code
Revision as of 21:00, 5 March 2015 by rosettacode>Ledrug (→‎Total circles area: new section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Total circles area

For a demonstration of the algorithm see http://stackoverflow.com/a/1667789/10562

The algorithm itself I described below the Haskell code on the task page, which would probably be easier to follow if you sketch a few circles on a piece of paper and try to verify it step by step. I understand that the Haskell code is kinda hard to follow, despite it having been cleaned up by someone else already, but believe me that it would be even harder to read had I written it in C++, because of, well, me and C++. But once you understand how the algorithm works, it's really nothing more than elementary geometry and bookkeeping, tedious as it may be, rocket science it is not.

That being said, I don't really recommend the algorithm if you need it for serious work. Depending on the circles you have, the algorithm can be error-prone if intersection points are very close to each other. The algorithm depends on the correct construction of an outline for the union of overlapping circles, which in turn depends on correctly intersecting and sorting arc segments, which can get messy when the intersections are dense. The scanline methods on the same task page are much more stable, not necessarily slower or less accurate, and a lot cleaner, so consider using that if at all possible. --Ledrug (talk) 21:00, 5 March 2015 (UTC)