WireframeCuboid extends WireframeShape { public void normalize() { if (lowerCorner.getX() <= upperCorner.getX() && lowerCorner.getY() <= upperCorner.getY() && lowerCorner.getZ() <= upperCorner.getZ()) { return; } double lo = Math.min(lowerCorner.getX(), upperCorner.getX()); double hi = Math.max(lowerCorner.getX(), upperCorner.getX()); lowerCorner.setX(lo); upperCorner.setX(hi); lo = Math.min(lowerCorner.getY(), upperCorner.getY()); hi = Math.max(lowerCorner.getY(), upperCorner.getY()); lowerCorner.setY(lo); upperCorner.setY(hi); lo = Math.min(lowerCorner.getZ(), upperCorner.getZ()); hi = Math.max(lowerCorner.getZ(), upperCorner.getZ()); lowerCorner.setZ(lo); upperCorner.setZ(hi); } WireframeCuboid(Vector3 lowerCorner, Vector3 upperCorner);  WireframeCuboid(double x0, double y0, double z0, double x1, double y1, double z1); Vector3 getLowerCorner(); WireframeCuboid setLowerCorner(Vector3 lowerCorner); Vector3 getUpperCorner(); WireframeCuboid setUpperCorner(Vector3 upperCorner); void normalize(); @Override ReadonlyVector3 getOriginReadonly();  }
@Test public void testNormalize() { WireframeCuboid shape; shape = new WireframeCuboid(1.0,-2.0,3.0, -4.0,5.0,-6.0); assertEquals("(-4.0,-2.0,-6.0)(1.0,5.0,3.0)", shape.getLowerCorner().toString() + shape.getUpperCorner().toString()); shape = new WireframeCuboid(1.0,2.0,3.0, 4.0,5.0,6.0); shape.setUpperCorner(new Vector3(3.0, -1.5, 5.5)); assertEquals("(1.0,-1.5,3.0)(3.0,2.0,5.5)", shape.getLowerCorner().toString() + shape.getUpperCorner().toString()); shape = new WireframeCuboid(1.0,2.0,3.0, 4.0,5.0,6.0); shape.setLowerCorner(new Vector3(3.0, -1.5, 5.5)); assertEquals("(3.0,-1.5,5.5)(4.0,5.0,6.0)", shape.getLowerCorner().toString() + shape.getUpperCorner().toString()); shape = new WireframeCuboid(1.0,2.0,3.0, 4.0,5.0,6.0); shape.getLowerCorner().setX(55.5); shape.getUpperCorner().setZ(-99.0); assertEquals("(55.5,2.0,3.0)(4.0,5.0,-99.0)", shape.getLowerCorner().toString() + shape.getUpperCorner().toString()); shape.normalize(); assertEquals("(4.0,2.0,-99.0)(55.5,5.0,3.0)", shape.getLowerCorner().toString() + shape.getUpperCorner().toString()); shape = new WireframeCuboid(1.0,2.0,3.0, 4.0,5.0,6.0); shape.getLowerCorner().setX(55.5); shape.getUpperCorner().setZ(-99.0); assertEquals("(55.5,2.0,3.0)(4.0,5.0,-99.0)", shape.getLowerCorner().toString() + shape.getUpperCorner().toString()); shape.render(new MockMinecraftAccess()); assertEquals("(4.0,2.0,-99.0)(55.5,5.0,3.0)", shape.getLowerCorner().toString() + shape.getUpperCorner().toString()); }