public static byte DirectionToByte(double x, double y) { return (byte)(Math.Floor(Math.Atan2(y, x) / 0.02454369260617026)); }