将点放在z轴周围

时间:2013-05-15 06:09:18

标签: java math

我想在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轴。你能救我吗?

0 个答案:

没有答案