Fixed atan2 bug.

Math.atan2 was broken by 36ae115. The parameters were reversed. Unittest was also fixed to expose bug.