[OpenJDK 2D-Dev] java.awt.geom.Area produces extraneous short segments (original) (raw)

Jim Graham james.graham at oracle.com
Tue Mar 6 23:53:08 UTC 2012


Hi Alex,

Are you interested in working on Area? I'd love to see some improvements made to this, but it can get to be a bit like whack-a-bug at times with a fix here causing problems over there. Some areas where it could use some "love" would be:

My original test case for working on this code was a basher that combined dozens or hundreds of displaced circles orbiting a central point (sort of like spirograph except it was many circles rather than a spiral) and you could see the performance bog down as the number of circles increased. Test cases with a number of "circle minus arc-of-same-circle" tests would also be useful since that is a common operation that people try and eventually give up on because we don't always notice that the curves are essentially the same with IEEE rounding errors...

        ...jim

On 3/5/2012 6:06 AM, Alex Lam S.L. wrote:

I have been using java.awt.geom.Area extensively in my project and have been hit hard by the problems due to rounding:

http://bugs.sun.com/bugdatabase/viewbug.do?bugid=4818309 http://bugs.sun.com/bugdatabase/viewbug.do?bugid=4724141 There may be a few other reported issues as well which I missed. I have since found a workaround which at least works well for me - by modifying AreaIterator (see attached). Obvious place for improvement would be to isClose(), as it is hard-coded to handle a fixed precision for now.

Regards, Alex.



More information about the 2d-dev mailing list