src/main/java/de/javagl/geom/AffineTransforms.java
/**
     * Creates a new rectangle that is transformed with the given transform,
     * which is assumed to only contain a scale (including flips) and 
     * translation
     * 
     * @param at The affine transform
     * @param r The rectangle
     * @return The transformed rectangle
     */
Creates a new rectangle that is transformed with the given transform,
which is assumed to only contain a scale (including flips) and
translation

@param at The affine transform
@param r The rectangle
@return The transformed rectangle
Creates a new rectangle that is transformed with the given transform which is assumed to only contain a scale ( including flips ) and translation @param at The affine transform @param r The rectangle @return The transformed rectangle
private static Rectangle2D createScaledAndTranslated(
        AffineTransform at, Rectangle2D r)
    {
        double x0 = r.getX() * at.getScaleX() + at.getTranslateX();
        double y0 = r.getY() * at.getScaleY() + at.getTranslateY();
        double x1 = x0 + r.getWidth() * at.getScaleX();
        double y1 = y0 + r.getHeight() * at.getScaleY();
        double minX = Math.min(x0, x1);
        double minY = Math.min(y0, y1);
        double maxX = Math.max(x0, x1);
        double maxY = Math.max(y0, y1);
        Rectangle2D result =
            new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY);
        return result;
    }
private static Rectangle2D createScaledAndTranslated ( AffineTransform at , Rectangle2D r ) { double x0 = r . getX ( ) * at . getScaleX ( ) + at . getTranslateX ( ) ; double y0 = r . getY ( ) * at . getScaleY ( ) + at . getTranslateY ( ) ; double x1 = x0 + r . getWidth ( ) * at . getScaleX ( ) ; double y1 = y0 + r . getHeight ( ) * at . getScaleY ( ) ; double minX = Math . min ( x0 , x1 ) ; double minY = Math . min ( y0 , y1 ) ; double maxX = Math . max ( x0 , x1 ) ; double maxY = Math . max ( y0 , y1 ) ; Rectangle2D result = new Rectangle2D . Double ( minX , minY , maxX - minX , maxY - minY ) ; return result ; }
Creates a new rectangle that is transformed with the given transform,
 which is assumed to only contain a scale (including flips) and
 translation
Creates a new rectangle that is transformed with the given transform which is assumed to only contain a scale ( including flips ) and translation