Issue #9 new

someRect.contains(otherRect) always returns false

Jackson Williams
created an issue

There is no input you can give to Rectangle.contains(otherRectangle) so that it will return true. I think the below case should return true:

{{{

!java

Rectangle big = new Rectangle(0, 0, 10, 10); Rectangle small = new Rectangle(2, 2, 2, 2);

big.contains(small) // false }}}

If bigRect completely contains smallRect, does that mean they intersect? That's what Rect.intersects(Rect) says:

{{{

!java

Rectangle big = new Rectangle(0, 0, 10, 10); Rectangle small = new Rectangle(2, 2, 2, 2);

big.intersects(small) // true }}}

The bug arises because Rect.contains(rect) assumes Rect.intersect(rect) means something different. Contains thinks in the above case, intersect should return false.

See this thread: http://slick.javaunlimited.net/viewtopic.php?f=3&t=4862&p=30690#p30690

Comments (2)

  1. Log in to comment