question: public static void drawRect ( Graphics2D gc , double x , double y , double width , double height , double labelAngle ) { Dimension theSize = new Dimension ( ( int ) Math . round ( width ) , ( int ) Math . round ( height ) ) ; Point2D apt = new Point2D . Float ( ( float ) x , ( float ) y ) ; AffineTransform saveTransform = gc . getTransform ( ) ; if ( labelAngle >= 0.5 * Math . PI && labelAngle <= 1.5 * Math . PI ) { apt = Geometry . translateByAngle ( apt , labelAngle , theSize . getWidth ( ) ) ; gc . rotate ( Geometry . moduloTwoPI ( labelAngle - Math . PI ) , apt . getX ( ) , apt . getY ( ) ) ; } else { gc . rotate ( labelAngle , apt . getX ( ) , apt . getY ( ) ) ; } gc . drawRect ( ( int ) Math . round ( apt . getX ( ) ) , ( int ) Math . round ( apt . getY ( ) ) - theSize . height , theSize . width , theSize . height ) ; gc . setTransform ( saveTransform ) ; }
target:  draw a rectangle at the given anchor point at the given angle (in radiant)