double half0 = oldEnvelope.getSpan(0) * 1/10;
double half1 = oldEnvelope.getSpan(1) * 1/10;
// overlapping square #1 - rotated by 45deg
CoordinateSequence cs1 = new CoordinateArraySequence(5);
cs1.setOrdinate(0, 0, mid0);
cs1.setOrdinate(0, 1, mid1 + qspan1);
cs1.setOrdinate(1, 0, mid0 + qspan0);
cs1.setOrdinate(1, 1, mid1);
cs1.setOrdinate(2, 0, mid0);
cs1.setOrdinate(2, 1, mid1 - qspan1);
cs1.setOrdinate(3, 0, mid0 - qspan0);
cs1.setOrdinate(3, 1, mid1);
cs1.setOrdinate(4, 0, mid0);
cs1.setOrdinate(4, 1, mid1 + qspan1);
LinearRing shape1 = geometryFactory.createLinearRing(cs1);
com.vividsolutions.jts.geom.Polygon poly1 = geometryFactory.createPolygon(shape1, null);
// overlapping square #2
CoordinateSequence cs2 = new CoordinateArraySequence(5);
cs2.setOrdinate(0, 0, mid0 + half0);
cs2.setOrdinate(0, 1, mid1 + half1);
cs2.setOrdinate(1, 0, mid0 + half0);
cs2.setOrdinate(1, 1, mid1 - half1);
cs2.setOrdinate(2, 0, mid0 - half0);
cs2.setOrdinate(2, 1, mid1 - half1);
cs2.setOrdinate(3, 0, mid0 - half0);
cs2.setOrdinate(3, 1, mid1 + half1);
cs2.setOrdinate(4, 0, mid0 + half0);
cs2.setOrdinate(4, 1, mid1 + half1);
LinearRing shape2 = geometryFactory.createLinearRing(cs2);
com.vividsolutions.jts.geom.Polygon poly2 = geometryFactory.createPolygon(shape2, null);
// Disjuncted square lower left -- will be included
CoordinateSequence cs3 = new CoordinateArraySequence(5);
cs3.setOrdinate(0, 0, oldEnvelope.getMinimum(0));
cs3.setOrdinate(0, 1, oldEnvelope.getMinimum(1));
cs3.setOrdinate(1, 0, oldEnvelope.getMinimum(0) + oldEnvelope.getSpan(0) / 8);
cs3.setOrdinate(1, 1, oldEnvelope.getMinimum(1));
cs3.setOrdinate(2, 0, oldEnvelope.getMinimum(0) + oldEnvelope.getSpan(0) / 8);
cs3.setOrdinate(2, 1, oldEnvelope.getMinimum(1) + oldEnvelope.getSpan(1) / 8);
cs3.setOrdinate(3, 0, oldEnvelope.getMinimum(0) );
cs3.setOrdinate(3, 1, oldEnvelope.getMinimum(1) + oldEnvelope.getSpan(1) / 8);
cs3.setOrdinate(4, 0, oldEnvelope.getMinimum(0));
cs3.setOrdinate(4, 1, oldEnvelope.getMinimum(1));
LinearRing shape3 = geometryFactory.createLinearRing(cs3);
com.vividsolutions.jts.geom.Polygon poly3 = geometryFactory.createPolygon(shape3, null);
// Disjuncted square lower right -- will be excluded by Envelope
CoordinateSequence cs4 = new CoordinateArraySequence(5);
cs4.setOrdinate(0, 0, oldEnvelope.getMaximum(0));
cs4.setOrdinate(0, 1, oldEnvelope.getMinimum(1));
cs4.setOrdinate(1, 0, oldEnvelope.getMaximum(0) - oldEnvelope.getSpan(0) / 8);
cs4.setOrdinate(1, 1, oldEnvelope.getMinimum(1));
cs4.setOrdinate(2, 0, oldEnvelope.getMaximum(0) - oldEnvelope.getSpan(0) / 8);
cs4.setOrdinate(2, 1, oldEnvelope.getMinimum(1) + oldEnvelope.getSpan(1) / 8);
cs4.setOrdinate(3, 0, oldEnvelope.getMaximum(0) );
cs4.setOrdinate(3, 1, oldEnvelope.getMinimum(1) + oldEnvelope.getSpan(1) / 8);
cs4.setOrdinate(4, 0, oldEnvelope.getMaximum(0));
cs4.setOrdinate(4, 1, oldEnvelope.getMinimum(1));
LinearRing shape4 = geometryFactory.createLinearRing(cs4);
com.vividsolutions.jts.geom.Polygon poly4 = geometryFactory.createPolygon(shape4, null);
Geometry mpoly = geometryFactory.createMultiPolygon(new com.vividsolutions.jts.geom.Polygon[]{poly1, poly2});