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

Closed
opened this Issue May 8, 2017 · 3 comments

Projects
None yet
1 participant
Owner

### io7m commented May 8, 2017 • edited

 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!

Owner

### 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)); } ``````
Owner

### 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?
Owner

### 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 added a commit that referenced this issue May 9, 2017

``` Merge branch 'release/1.1.0' ```
```Release: com.io7m.jregions 1.1.0
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)```
``` dd8029a ```

### io7m added a commit that referenced this issue May 9, 2017

``` Merge tag 'com.io7m.jregions-1.1.0' into develop ```
```Release: com.io7m.jregions 1.1.0

``` 6cfc0f7 ```