Use of Math.atan #2

BorisKozo opened this Issue Mar 29, 2013 · 1 comment


None yet

2 participants



You are using Math.atan incorrectly here.

I think you meant to use Math.atan2 (which is a more standard function although it has that 2 at the end).
It has two major benefits

  1. you don't need to check dx === 0 (although in your code you don't check anyway, there might be a division by 0 exception)
  2. it will automatically return the value in the correct range and all the subsequent code can probably be deleted.


@ozelentok ozelentok added a commit that referenced this issue Mar 29, 2013
@ozelentok fixed issues #1 and #2 b918975

Hi Boris,

I have replaced atan with atan2, code looks much more clear now.

Thanks for reviewing my code,

@BorisKozo BorisKozo closed this Mar 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment