normalized_x = normalize(x - corrections[0], mins[0], maxes[0])
normalized_y = normalize(y - corrections[1], mins[1], maxes[1])
compass_heading = int(math.atan2(normalized_y, normalized_x) * 180.0 / math.pi)
# compass_heading is between -180 and +180 since atan2 returns -pi to +pi
# this translates it to be between 0 and 360
compass_heading += 180
direction_index = ((compass_heading + 15) % 360) // 30