Java 二维分解饼图段

Java 2d exploded pie chart segments

我试图在饼图的一个段(弧)和它的中心之间添加一些距离(例如 10px)但没有成功,这是我到目前为止尝试过的方法:

int value = 20; // example
double arcAngle = (value * 360 / 100);
double angle = 360 - (arcAngle / 2); // direction to add the distance to (center of arc)
double newX = pieCenterX + Math.cos(angle * Math.PI / 180.0) * 10;
double newY = pieCenterY + Math.sin(angle * Math.PI / 180.0) * 10;

// then drawing the arc with new x and y
g.fill(new Arc2D.Double(newX, newY, bounds.getWidth(), bounds.getHeight(), startAngle, arcAngle, Arc2D.PIE));

理想情况下我应该得到这样的结果:

我不太了解如何处理这个问题,所以我的代码是从我在其他地方找到的示例中提取的。

通常零角度是OX方向(右)。所以你要修正90度(如果你的坐标系是逆时针的)

double angle = 90 + 360 - (arcAngle / 2);