基本的数学旋转,错误的结果 [英] basic math rotation, wrong results

查看:57
本文介绍了基本的数学旋转,错误的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我太笨了,无法解决基本的代数,如果您能帮助我解决这个问题,那就太好了

I'm too dumb to solve basic algebra, would be cool if you could help me out with this

通常我旋转并尝试获得要将对象旋转到的位置

usually I got the rotation and try to get position I want to rotate the object to

var rads : Number = rotation / 180 * Math.PI;
position.x = Math.cos(rads);
position.y = Math.sin(rads);

这次我获得了职位,但我想轮换,但我尝试的所有内容都是错误的,在此先感谢您的帮助

this time I got the position but I want to get the rotation but everything I tried is false, thanks in advance for your help

对于那些遇到相同问题并使用Actionscript 3(或具有此功能的任何东西)进行Math.atan2()实验的人,可以为您节省很多麻烦-更快,更容易

for those who got the same problem and use actionscript 3 (or anything that also has this function) experiment with Math.atan2() it can save you a lot of trouble - faster and easier

推荐答案

大多数语言都提供了一个名为 atan2()的函数,它可以自动运行并为您提供所有繁重的工作,所有四个象限中的正确答案.

Most languages provide a function called atan2() which takes the rise and run and does all the heavy lifting for you, giving the correct answer in all four quadrants.

>>> math.atan2(-1, 1)
-0.7853981633974483
>>> math.atan2(-1, 1) * 180 / math.pi
-45.0

这篇关于基本的数学旋转,错误的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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