0

我想要围绕 z 轴放置点。现在我只是使用以下代码片段将点放置在 xy 平面周围:

int points = 8;
double x = 5;
double y = 7;
double radius =100;

AbsolutePanel absolutePanel = new AbsolutePanel();

double slice = 2 * Math.PI / points;
for (int i = 0; i < points; i++)
{
    double angle = slice * i;
    int newX = (int)(x + radius * Math.cos(angle));
    int newY = (int)(y + radius * Math.sin(angle));
    Label label =new Label("test"+i);
    absolutePanel.add(label,newX,newY);
    System.out.println("newX="+newX + "newY="+newY);
}

但我希望这些点围绕 z 轴。你能帮助我吗?

4

0 回答 0