我在我的Java程序中有这个方法:
public static float findAngle(float x1, float y1, float x2, float y2) {
float deltaX = Math.abs(x1 - x2);
float deltaY = Math.abs(y1 - y2);
return (float)(Math.atan2(deltaY, deltaX) * 180 / Math.PI);
}
Run Code Online (Sandbox Code Playgroud)
我是通过谷歌搜索这个问题得到的.然而,当它付诸实践时,它会分裂,所以我只得到1-180,而在180之后它又回到1.如何解决这个问题?