/** Returns a normalized angle (bound between 0 and 360 degrees). */ protected float normAngle (float angle) { return angle - FloatMath.floor(angle / 360f) * 360f; }
/** Returns a normalized angle (bound between 0 and 360 degrees). */ protected float normAngle (float angle) { return angle - FloatMath.floor(angle / 360f) * 360f; }
/** * Rounds a value to the nearest multiple of a target. */ public static float roundNearest (float v, float target) { target = Math.abs(target); if (v >= 0) { return target * FloatMath.floor((v + 0.5f * target) / target); } else { return target * FloatMath.ceil((v - 0.5f * target) / target); } }
/** * Rounds a value to the nearest multiple of a target. */ public static float roundNearest (float v, float target) { target = Math.abs(target); if (v >= 0) { return target * FloatMath.floor((v + 0.5f * target) / target); } else { return target * FloatMath.ceil((v - 0.5f * target) / target); } }