How to use atan2() in combination with other Radian angle systems

后端 未结 4 732
陌清茗
陌清茗 2021-02-04 18:46

I am struggling with this in JavaScript, but this problem applies to many other languages/environments as well.

I want to have one object rotating towards the position o

4条回答
  •  余生分开走
    2021-02-04 19:11

    If your result is between 0 and Pi, then the result is pretty straight-forward. If your result is between -Pi and 0, then add 2*Pi to your result, this way you will have your result in the interval of 0, 2*Pi.

    Of course, it would be nice if you would implement a separate function for this type of conversion, to not duplicate your code every now and then.

提交回复
热议问题