独自の Point クラスの 2 点間の角度を度単位で計算する必要があります。点 a が中心点になります。
方法:
public float getAngle(Point target) {
return (float) Math.toDegrees(Math.atan2(target.x - x, target.y - y));
}
テスト 1: // 45 を返す
Point a = new Point(0, 0);
System.out.println(a.getAngle(new Point(1, 1)));
テスト 2: // -90 を返し、予想: 270
Point a = new Point(0, 0);
System.out.println(a.getAngle(new Point(-1, 0)));
返された結果を 0 ~ 359 の数値に変換するにはどうすればよいですか?