Fixed ProtectedCuboidRegion::getPoints() returning points in wrong order

ProtectedPolygonRegion returns points in an order such that you could play "connect the dots" and end up with the correct polygon. ProtectedCuboidRegion returns them in an order such that playing connect the dots gives you a Z shape. This breaks the intersectsEdges() function in ProtectedRegion when comparing cuboids. This commit causes ProtectedCuboidRegion::getPoints() to return them in an order consistent with ProtectedPolygonRegion, which makes intersectsEdges() work correctly.
This commit is contained in:
Joshua M Hertlein 2014-02-25 13:51:57 -06:00
parent 0162910964
commit ec9712f30e

View File

@ -76,6 +76,7 @@ public void setMaximumPoint(BlockVector pt) {
setMinMaxPoints(min, pt);
}
@Override
public List<BlockVector2D> getPoints() {
List<BlockVector2D> pts = new ArrayList<BlockVector2D>();
int x1 = min.getBlockX();
@ -85,8 +86,8 @@ public List<BlockVector2D> getPoints() {
pts.add(new BlockVector2D(x1, z1));
pts.add(new BlockVector2D(x2, z1));
pts.add(new BlockVector2D(x1, z2));
pts.add(new BlockVector2D(x2, z2));
pts.add(new BlockVector2D(x1, z2));
return pts;
}