Added CuboidRegion.makeCuboid(Region).

This commit is contained in:
sk89q 2014-02-28 16:15:14 -08:00
parent 6bfcaca6d3
commit 9627d830d7

View File

@ -42,6 +42,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
* Store the second point. * Store the second point.
*/ */
private Vector pos2; private Vector pos2;
/** /**
* Construct a new instance of this cuboid region. * Construct a new instance of this cuboid region.
* *
@ -396,4 +397,16 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
public CuboidRegion clone() { public CuboidRegion clone() {
return (CuboidRegion) super.clone(); return (CuboidRegion) super.clone();
} }
/**
* Make a cuboid region out of the given region using the minimum and maximum
* bounds of the provided region.
*
* @param region the region
* @return a new cuboid region
*/
public static CuboidRegion makeCuboid(Region region) {
return new CuboidRegion(region.getMinimumPoint(), region.getMaximumPoint());
}
} }