Atan2 table lookup algorithm