Point2D.Double center = new Point2D.Double((double) width / 2,
(double) height / 2);
double fixedAngle = 2.0 * Math.PI / barsCount;
double maxY = 0.0d;
for (double i = 0.0; i < barsCount; i++) {
Area primitive = buildPrimitive();
AffineTransform toCenter = AffineTransform.getTranslateInstance(
center.getX(), center.getY());
AffineTransform toBorder = AffineTransform.getTranslateInstance(
35.0, -6.0);
AffineTransform toCircle = AffineTransform.getRotateInstance(-i
* fixedAngle, center.getX(), center.getY());
AffineTransform toWheel = new AffineTransform();
toWheel.concatenate(toCenter);
toWheel.concatenate(toBorder);
primitive.transform(toWheel);
primitive.transform(toCircle);
areas[(int) i] = primitive;
Rectangle2D bounds = primitive.getBounds2D();
if (bounds.getMaxY() > maxY) {
maxY = bounds.getMaxY();
}
}