This is the mail archive of the
mailing list for the Mauve project.
- From: Sven de Marothy <sven at physto dot se>
- To: David Gilbert <david dot gilbert at object-refinery dot com>
- Cc: mauve-patches at sources dot redhat dot com, mark at klomp dot org
- Date: Wed, 01 Sep 2004 22:30:06 +0200
- Subject: Re: Area.java
- References: <firstname.lastname@example.org>
Nice! Thanks, that's great work.
Some of these are real bugs, and I'll try and fix them.
Now, some others I'm not so sure of. Firstly, I'm not certain
contains() should really return true on any edges. (For instance,
having recently done Ellipse2D, I know for an Ellipse2D(0,0,10,10)
contains() will return false on the edge points (5,0),(5,10),
So I'm thinking the first test case should really return false too.
(Sun's contains() methods aren't very consistent in these cases.. And
for some classes, like Arc2D they're often simply wrong.)
Second, since the other tests rely on contains() working like Sun's on
edges, it makes it difficult to know what causes the error. Wouldn't it
make sense to use intersects() instead, where the behavior is more
reliable and well-defined?
Some of the behavior here is also intentional. The method used for
contains() is the line-crossing algorithm, checking the number of
intersections along the positive x-axis, with the test-point at the
origin. The caveat here is if a vertex is exactly on the axis, the
count will be off, and all points with a smaller x than the vertex and a
smaller y will get false results. I've seen this happen with
the Sun JDK (but not for Area though).
I guess I'll have to re-think that workaround in this case.