[josm-dev] JOSM BBoxes in and out

Sebastian Klein bastikln at googlemail.com
Mon Apr 26 13:55:49 BST 2010


Rolf Bode-Meyer wrote:
> 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.

It is, if you view the bbox as an area and not as the surrounding line.

> 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.

Done: http://josm.openstreetmap.de/changeset/3209

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

Sure.

__

Sebastian




More information about the josm-dev mailing list