[josm-dev] JOSM BBoxes in and out

Rolf Bode-Meyer robome at gmail.com
Mon Apr 26 13:37:41 BST 2010


2010/4/26 Sebastian Klein <bastikln at googlemail.com>:
> Rolf Bode-Meyer wrote:
>> I think that slowly but surely I've gone mad. I'm trying to understand
>> org.openstreetmap.josm.data.osm.BBox.inside(BBox b) for over an hour
>> now, but I just don't get it.
>> In both of the following cases inside called from the larger with the
>> smaller as argument it returns true.
>> +---------+   +-------+
>> | +-----+ |   |  +----+-+
>> | |     | |   |  |    | |
>> | |     | |   |  |    | |
>> | +-----+ |   |  +----+-+
>> +---------+   +-------+
>
> It's a classical rectangle "intersects" test, so the function should
> better be renamed...
> This did not cause any misbehaviour because it is used just once and in
> that context it works correctly.

I don't know about the classic tests and for me at least "lies fully
within" is no intersection. But if it's an intersection test, it
should really be renamed - though there already is an intersects
method which makes use of inside() ...
It's unfortune that stuff isn't commented.

Am I correct that for a point value where min==max, intersects is
always a contains?

Rolf




More information about the josm-dev mailing list