Math.Asin问题 [英] Math.Asin problem

查看:64
本文介绍了Math.Asin问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在像这样计算一个值(应该反映方向矢量和XZ平面之间的角度的正弦)

I am calculating a value ( that should reflect the sin of an angle between a direction vector and the XZ plane ) like this

angle_between_direction_and_Xplane = (Math.Abs(enemyShip_.orientation.Forward.Y) /  Math.Sqrt(Math.Pow(enemyShip_.orientation.Forward.X, 2) + Math.Pow(enemyShip_.orientation.Forward.Y, 2) + Math.Pow(enemyShip_.orientation.Forward.Z, 2)));

似乎很好用.当物体垂直于地面时,angle_between_direction_and_Xplane接近1,当物体与XZ平面平行时,接近0.

and it seems to work just fine . When the object is perpendicular to the ground the angle_between_direction_and_Xplane is near to 1 and when it is paralel to XZ plane it is near to 0 .

当我应用Math.Asin时,我想得到一个角度(例如70或20度),但是我却得到大约1的值.我使用错了吗?

When i apply Math.Asin i would like to get a angle ( like 70 or 20 degrees ) but instead i get values around 1 . Am I using it wrong ?

推荐答案

Asin返回以弧度为单位的角度.乘以180/pi可获得角度(以度为单位).

Asin returns the angle in radians. Multiply with 180/pi to get the angle in degrees.

这篇关于Math.Asin问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆