#14 Merged at 1d77a18

fix Shape.contains not using working

  1. Matthew Walker

fix Shape.contains not using intersects properly

Comments (4)

  1. nguillaumin

    The javadoc says "Check if the shape passed is entirely contained within this shape", so wouldn't the current logic be correct, since if 2 shapes intersect one can't be entirely contained within the other?

  2. nguillaumin

    Actually I think this test should be removed, because there are actually 2 cases:

    • Shape are only partially intersecting: contains() should return false
    • One shape is completely intersected (contained) within the other: contains() should return true

    But intersects() doesn't distinguish between partial or complete intersection, so it can't be use to take an early exit.


  3. Matthew Walker author

    I think that was what I realized at the time.

    I also think I thought it was a typo, and that I assumed that it was meant to be an early out because it is a faster (maybe?) condition to check.