List of utility methods to do Angle
double | angleToDefaultAngle(double angle) For a given angle in radians, return the equivalent angle in the range [-PI, PI]. return (angle + Math.PI) % (-TWOPI) + Math.PI;
|
int | angleToFacing(float angle) angle To Facing float facingDegrees = (float) Math.toDegrees(angle); return (int) (facingDegrees / FACING_TO_DEGREE); |
boolean | angleYawinRange(float start, float end, float angle) Return whether a -180~180 wrapped yaw angle is in the range denoted by [start, end]. if (end < start) return false; if (end - start >= 360f) return true; float ss = wrapYawAngle(start), se = wrapYawAngle(end), sa = wrapYawAngle(angle); if (ss > se) { return ss <= sa || sa <= se; return ss <= sa && sa <= se; |