private void calculateShape() {
      float t = 360 / sides;
      float a = angle;
      a = a > 360 ? a - 360 : a;
      points = new Point2D[sides];
      path = new GeneralPath();
      for( int i = 0; i < sides; i++ ) {
         float ra = (float) Math.toRadians( a );
         float x = (float) Math.abs( radius * Math.cos( ra ) );
         float y = (float) Math.abs( radius * Math.sin( ra ) );
         if( a <= 90 ) {
            x = cx + x;
            y = cy - y;
         } else if( a <= 180 ) {
            x = cx - x;
            y = cy - y;
         } else if( a <= 270 ) {
            x = cx - x;
            y = cy + y;
         } else if( a <= 360 ) {
            x = cx + x;
            y = cy + y;
         }
         if( i == 0 ) {
            path.moveTo( x, y );
         } else {
            path.lineTo( x, y );
         }
         points[i] = new Point2D.Float( x, y );
         a += t;
         a = a > 360 ? a - 360 : a;
      }
      path.closePath();
   }