1. kevglass
  2. slick
  3. Pull requests

Pull requests

#14 Merged
Repository
kevglass
Branch
development

fix Shape.contains not using working

Author
  1. Matthew Walker
Reviewers
Description

fix Shape.contains not using intersects properly

  • Learn about pull requests

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.

    Thoughts?

  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.