src/main/java/de/javagl/geom/Rectangles.java
/**
     * Compute the bounding rectangle of the given rectangle after it
     * has been transformed with the given transform, and stores it
     * in the given destination. If the given destination is <code>null</code>
     * then a new rectangle will be created and returned
     * 
     * @param at The transform
     * @param rSrc The source rectangle
     * @param rDst The destination rectangle
     * @return The destination rectangle
     */
Compute the bounding rectangle of the given rectangle after it
has been transformed with the given transform, and stores it
in the given destination. If the given destination is null
then a new rectangle will be created and returned

@param at The transform
@param rSrc The source rectangle
@param rDst The destination rectangle
@return The destination rectangle
Compute the bounding rectangle of the given rectangle after it has been transformed with the given transform and stores it in the given destination . If the given destination is null then a new rectangle will be created and returned @param at The transform @param rSrc The source rectangle @param rDst The destination rectangle @return The destination rectangle
public static Rectangle2D computeBounds(
        AffineTransform at, Rectangle2D rSrc, Rectangle2D rDst)
    {
        double xMin = rSrc.getMinX();
        double yMin = rSrc.getMinY();
        double xMax = rSrc.getMaxX();
        double yMax = rSrc.getMaxY();
        double x0 = AffineTransforms.computeX(at, xMin, yMin);
        double y0 = AffineTransforms.computeY(at, xMin, yMin);
        double x1 = AffineTransforms.computeX(at, xMax, yMin);
        double y1 = AffineTransforms.computeY(at, xMax, yMin);
        double x2 = AffineTransforms.computeX(at, xMax, yMax);
        double y2 = AffineTransforms.computeY(at, xMax, yMax);
        double x3 = AffineTransforms.computeX(at, xMin, yMax);
        double y3 = AffineTransforms.computeY(at, xMin, yMax);
        double minX = min(x0, x1, x2, x3);
        double minY = min(y0, y1, y2, y3);
        double maxX = max(x0, x1, x2, x3);
        double maxY = max(y0, y1, y2, y3);
        if (rDst == null)
        {
            return new Rectangle2D.Double(minX, minY, maxX-minX, maxY-minY);
        }
        rDst.setRect(minX, minY, maxX-minX, maxY-minY);
        return rDst;
    }
public static Rectangle2D computeBounds ( AffineTransform at , Rectangle2D rSrc , Rectangle2D rDst ) { double xMin = rSrc . getMinX ( ) ; double yMin = rSrc . getMinY ( ) ; double xMax = rSrc . getMaxX ( ) ; double yMax = rSrc . getMaxY ( ) ; double x0 = AffineTransforms . computeX ( at , xMin , yMin ) ; double y0 = AffineTransforms . computeY ( at , xMin , yMin ) ; double x1 = AffineTransforms . computeX ( at , xMax , yMin ) ; double y1 = AffineTransforms . computeY ( at , xMax , yMin ) ; double x2 = AffineTransforms . computeX ( at , xMax , yMax ) ; double y2 = AffineTransforms . computeY ( at , xMax , yMax ) ; double x3 = AffineTransforms . computeX ( at , xMin , yMax ) ; double y3 = AffineTransforms . computeY ( at , xMin , yMax ) ; double minX = min ( x0 , x1 , x2 , x3 ) ; double minY = min ( y0 , y1 , y2 , y3 ) ; double maxX = max ( x0 , x1 , x2 , x3 ) ; double maxY = max ( y0 , y1 , y2 , y3 ) ; if ( rDst == null ) { return new Rectangle2D . Double ( minX , minY , maxX - minX , maxY - minY ) ; } rDst . setRect ( minX , minY , maxX - minX , maxY - minY ) ; return rDst ; }
Compute the bounding rectangle of the given rectangle after it
 has been transformed with the given transform, and stores it
 in the given destination.
Compute the bounding rectangle of the given rectangle after it has been transformed with the given transform and stores it in the given destination .