Fix off by one error when calculating Poly2D region dimensions.

This commit is contained in:
Wizjany 2012-12-05 18:31:08 -05:00
parent ab693a7521
commit 3f1a2bfc39

View File

@ -250,7 +250,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
* @return width * @return width
*/ */
public int getWidth() { public int getWidth() {
return max.getBlockX() - min.getBlockX(); return max.getBlockX() - min.getBlockX() + 1;
} }
/** /**
@ -259,7 +259,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
* @return height * @return height
*/ */
public int getHeight() { public int getHeight() {
return maxY - minY; return maxY - minY + 1;
} }
/** /**
@ -268,7 +268,7 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion {
* @return length * @return length
*/ */
public int getLength() { public int getLength() {
return max.getBlockZ() - min.getBlockZ(); return max.getBlockZ() - min.getBlockZ() + 1;
} }
/** /**