Normalizes the given yaw angle to a value between +/-180 degrees. @param yaw the yaw in degrees @return the normalized yaw in degrees @see Location#getYaw()
(float yaw)
| 681 | * @see Location#getYaw() |
| 682 | */ |
| 683 | public static float normalizeYaw(float yaw) { |
| 684 | yaw %= 360.0f; |
| 685 | if (yaw >= 180.0f) { |
| 686 | yaw -= 360.0f; |
| 687 | } else if (yaw < -180.0f) { |
| 688 | yaw += 360.0f; |
| 689 | } |
| 690 | return yaw; |
| 691 | } |
| 692 | |
| 693 | /** |
| 694 | * Normalizes the given pitch angle to a value between <code>+/-90</code> |