public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path) { double cot = cos(theta); double sit = sin(theta); double cost, sint; if (direct) { // Counter-clockwise circle for (double t = .1; t < PI * 2; t += .1) { cost = cos(t); sint = sin(t); path.lineTo( (float) (xc + r * cost * cot - r * sint * sit), (float) (yc + r * cost * sit + r * sint * cot)); } } else { // Clockwise circle for (double t = .1; t < PI * 2; t += .1) { cost = cos(t); sint = sin(t); path.lineTo( (float) (xc + r * cost * cot + r * sint * sit), (float) (yc + r * cost * sit - r * sint * cot)); } } // line to first point path.lineTo((float) (xc + r * cot), (float) (yc + r * sit)); return path; }