GeometryUtils { public static Area grow(final Shape s, final double offset) { return grow(s, offset, BasicStroke.JOIN_MITER, 10f); } private  GeometryUtils(); static Line2D[] shapeToLines(Shape path, boolean swapped); static List<Point2D> intersection(final Shape s1, final Shape s2); static Point2D intersection(final Line2D l1, final Line2D l2); static Area grow(final Shape s, final double offset); static Area grow(final Shape s, final double offset, int join,
    		float miterlimit); static Area punch(Area shapeArea, double gap, boolean rounded,
    		Point2D pointPos, Shape pointShape); static List<PathSegment> getSegments(Shape shape); static Shape getShape(List<PathSegment> segments, boolean isDouble); static Shape reverse(Shape shape); static final double EPSILON; static final double EPSILON_SQ; }
@Test public void testGrow() { Shape normal = new Rectangle2D.Double(0.0, 0.0, 1.0, 1.0); Shape grown = GeometryUtils.grow(normal, 0.5); Rectangle2D normalBounds = normal.getBounds2D(); Rectangle2D grownBounds = grown.getBounds2D(); for (double coord=-0.25; coord<=1.25; coord+=0.25) { assertTrue(grown.contains(coord, coord)); } assertEquals(-0.5, grownBounds.getMinX(), DELTA); assertEquals(-0.5, grownBounds.getMinY(), DELTA); assertEquals( 1.5, grownBounds.getMaxX(), DELTA); assertEquals( 1.5, grownBounds.getMaxY(), DELTA); grown = GeometryUtils.grow(normal, 0.0); grownBounds = grown.getBounds2D(); assertEquals(normalBounds, grownBounds); grown = GeometryUtils.grow(normal, -0.25); grownBounds = grown.getBounds2D(); assertEquals(0.25, grownBounds.getMinX(), DELTA); assertEquals(0.25, grownBounds.getMinY(), DELTA); assertEquals(0.75, grownBounds.getMaxX(), DELTA); assertEquals(0.75, grownBounds.getMaxY(), DELTA); }