新手问题 如何在 Ruby 中實現 inverse tangent?

redsunschan · July 08, 2014 · Last by WolfLee replied at July 08, 2014 · 1730 hits

現在小弟在寫個遊戲的影子系統,但是發現 RUBY 的 TANGENT 得出的結果是 ARC 而不是度...

我就是差那一行...希望各位高手能夠幫一幫我...

我曾試了 tan-1(inverse tangent) 的得出公式

Complex((Complex::I/2)(Math.ln(1-(Complex::I)(x)) - Math.ln(1+(Complex::I)*(x))));

, 但還是不行...

好苦惱...就是差那一行而已啊...

希望大家幫幫忙 Orz

Math 有 Math.atan,然后有了弧度算角度不是变换一下就好了么?比如 Math.atan(x) / Math::PI * 180

You need to Sign in before reply, if you don't have an account, please Sign up first.