두 점의 각도 구하는 방법
public static double angleOf(PointF p1, PointF p2) {
// NOTE: Remember that most math has the Y axis as positive above the X.
// However, for screens we have Y as positive below. For this reason,
// the Y values are inverted to get the expected results.
final double deltaY = (p1.y - p2.y);
final double deltaX = (p2.x - p1.x);
final double result = Math.toDegrees(Math.atan2(deltaY, deltaX));
return (result < 0) ? (360d + result) : result;
}
320x100
'프로그래밍 > Android-Java' 카테고리의 다른 글
[ANDROID] Dialog 밖의 어두운 배경 없애기 (0) | 2020.12.14 |
---|---|
[ANDROID] java.lang.IllegalArgumentException: Comparison method violates its general contract! (0) | 2020.12.04 |
[ANDROID] base64 string 변환 (0) | 2020.10.29 |
[ANDROID] drawable 파일 bitmap 변환 (0) | 2020.10.29 |
[ANDROID] dp 값 px 변환 (0) | 2020.10.29 |
댓글