Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero size areas/volumes do not overlap and are not contained #14

Closed
io7m opened this issue May 8, 2017 · 3 comments
Closed

Zero size areas/volumes do not overlap and are not contained #14

io7m opened this issue May 8, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@io7m
Copy link
Member

io7m commented May 8, 2017

This is a serious issue:

  @Test
  public void testBugOverlapsL()
  {
    final AreaL area0 =
      AreaL.of(0L, 10L, 0L, 10L);
    final AreaL area1 =
      AreasL.create(0L, 0L, 0L, 0L);
    Assert.assertTrue(AreasL.overlaps(area1, area0));
  }

... fails!

@io7m io7m added the bug label May 8, 2017
@io7m io7m added this to the 1.1.0 milestone May 8, 2017
@io7m io7m self-assigned this May 8, 2017
@io7m
Copy link
Member Author

io7m commented May 8, 2017

Actually containment seems to work correctly:

  @Test
  public void testBugContainsL()
  {
    final AreaL area0 =
      AreaL.of(0L, 10L, 0L, 10L);
    final AreaL area1 =
      AreasL.create(0L, 0L, 0L, 0L);
    Assert.assertTrue(AreasL.contains(area0, area1));
  }

@io7m
Copy link
Member Author

io7m commented May 8, 2017

This is a little philosophical. Can an area of zero height and/or width be said to overlap anything? By definition, it has zero size...

If the assumption is that an area of zero size cannot overlap, however, then ∀a. overlaps(a, a) doesn't necessarily hold. Might it make sense to treat an area of zero size as a point?

@io7m
Copy link
Member Author

io7m commented May 9, 2017

It seems like the easiest way to handle this is to make the width and height of the boxes at least 1 when performing the overlap checks. I can't see anything obviously wrong with doing this, it makes the mathematics work, and it doesn't seem to violate any of the existing theorems.

@io7m io7m closed this as completed in e0d8275 May 9, 2017
io7m added a commit that referenced this issue May 9, 2017
Release: com.io7m.jregions 1.1.0
Code new: Add splitAlongXY method for dividing areas into quadrants.
Code new: Stop using terms such as "horizontally", "vertically", "width", "height", etc. Deprecate methods and add replacements. (tickets: #11)
Code new: Add volume types. (tickets: #9)
Code fix: Fix overlaps() for areas and volumes. (tickets: #12, #14)
Code fix: Fix contains() for areas and volumes. (tickets: #13)
io7m added a commit that referenced this issue May 9, 2017
Release: com.io7m.jregions 1.1.0

Code new: Add splitAlongXY method for dividing areas into quadrants.
Code new: Stop using terms such as "horizontally", "vertically", "width", "height", etc. Deprecate methods and add replacements. (tickets: #11)
Code new: Add volume types. (tickets: #9)
Code fix: Fix overlaps() for areas and volumes. (tickets: #12, #14)
Code fix: Fix contains() for areas and volumes. (tickets: #13)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant