src/main/java/de/javagl/geom/AffineTransforms.java
/**
     * An implementation of the 
     * <code>AffineTransform#createTransformedShape</code> method
     * that is optimized for certain simple shapes (like 
     * <code>Rectangle2D</code> and <code>Line2D</code>): If the given 
     * transform only consists of translation (or translation and 
     * scaling) then a new shape will be constructed directly, 
     * avoiding the general (but inefficient) method of creating
     * a <code>Path2D</code>.
     * Otherwise, <code>AffineTransform#createTransformedShape</code>
     * will be called
     * 
     * @param at The affine transform
     * @param shape The shape
     * @return The transformed shape
     */
An implementation of the
AffineTransform#createTransformedShape method
that is optimized for certain simple shapes (like
Rectangle2D and Line2D): If the given
transform only consists of translation (or translation and
scaling) then a new shape will be constructed directly,
avoiding the general (but inefficient) method of creating
a Path2D.

@param at The affine transform
@param shape The shape
@return The transformed shape
An implementation of the AffineTransform#createTransformedShape method that is optimized for certain simple shapes ( like Rectangle2D and Line2D ) : If the given transform only consists of translation ( or translation and scaling ) then a new shape will be constructed directly avoiding the general ( but inefficient ) method of creating a Path2D . @param at The affine transform @param shape The shape @return The transformed shape
public static Shape createTransformedShape(AffineTransform at, Shape shape)
    {
        if (shape instanceof Rectangle2D)
        {
            Rectangle2D r = (Rectangle2D)shape;
            if (!hasRotation(at))
            {
                if (!hasScale(at))
                {
                    return createTranslated(at, r);
                }
                return createScaledAndTranslated(at, r);
            }
        }
        else if (shape instanceof Line2D)
        {
            Line2D l = (Line2D)shape;
            if (!hasRotation(at))
            {
                if (!hasScale(at))
                {
                    return createTranslated(at, l);
                }
                return createScaledAndTranslated(at, l);
            }
        }
        return at.createTransformedShape(shape);
    }
public static Shape createTransformedShape ( AffineTransform at , Shape shape ) { if ( shape instanceof Rectangle2D ) { Rectangle2D r = ( Rectangle2D ) shape ; if ( ! hasRotation ( at ) ) { if ( ! hasScale ( at ) ) { return createTranslated ( at , r ) ; } return createScaledAndTranslated ( at , r ) ; } } else if ( shape instanceof Line2D ) { Line2D l = ( Line2D ) shape ; if ( ! hasRotation ( at ) ) { if ( ! hasScale ( at ) ) { return createTranslated ( at , l ) ; } return createScaledAndTranslated ( at , l ) ; } } return at . createTransformedShape ( shape ) ; }
An implementation of the
 <code>AffineTransform#createTransformedShape</code> method
 that is optimized for certain simple shapes (like
 <code>Rectangle2D</code> and <code>Line2D</code>): If the given
 transform only consists of translation (or translation and
 scaling) then a new shape will be constructed directly,
 avoiding the general (but inefficient) method of creating
 a <code>Path2D</code>.
An implementation of the <code > AffineTransform#createTransformedShape< / code > method that is optimized for certain simple shapes ( like <code > Rectangle2D< / code > and <code > Line2D< / code > ) : If the given transform only consists of translation ( or translation and scaling ) then a new shape will be constructed directly avoiding the general ( but inefficient ) method of creating a <code > Path2D< / code > .