java中圆的圆周坐标

java中圆的圆周坐标,java,Java,我正在尝试Android中一些基本级别的自定义绘图。当我试图画一个行星绕着它的轴旋转时,我需要知道圆周的坐标。我发现有一个定律可以得到圆周的坐标: x = r * cos(degree) + j, y = r * sin(degree) + k where j,k is the center of the axis and r is the radius. 问题是,我没有得到我预期的分数。当我使用计算器并执行类似操作时: 100 * cos(1) + 50 我得到149.9847695。

我正在尝试Android中一些基本级别的自定义绘图。当我试图画一个行星绕着它的轴旋转时,我需要知道圆周的坐标。我发现有一个定律可以得到圆周的坐标:

x = r * cos(degree) + j, 
y = r * sin(degree) + k
where j,k is the center of the axis and r is the radius.
问题是,我没有得到我预期的分数。当我使用计算器并执行类似操作时:

100 * cos(1) + 50 
我得到149.9847695。但是当我用java做同样的事情时

100 * Math.cos(1) + 50,
我得到104.03023

我不知道是否有其他方法可以得到准确的结果。请建议。

根据:

参数:

a-角度,以弧度为单位

计算器以度为单位计算角度,而方法以弧度为单位计算角度

因此,您应该将度数转换为弧度:

double degree = 1;
double result = 100 * Math.cos(degree * PI / 180) + 50;
System.out.println(result);

这将按预期打印出149.98476951563913。

您可以使用Math.toRadiansdegree将您的学位转换为弧度。

@如果OP需要处理大数字,他应该像您所说的那样使用and not或BigInt。