从矢量角度 [英] Angle from vector
问题描述
说我有A点(20,20)和B点(60,60)。
Say I have point A (20,20) and point B (60,60).
所得的载体将是40,40,我怎么能得到这个矢量的角度?
The resulting vector would be 40, 40. How could I get the angle of this vector?
我的意思是,想象一下有关于原点的假想圆。
By this I mean, imagine there is an imaginary circle around the origin.
我觉得那种东西ATAN2做,但没有ATAN2。
I guess sort of what atan2 does but without atan2.
感谢
推荐答案
我不知道你所说的角度是说,因为你只给你的例子一个向量。但是,鉴于两个向量,你可以找到他们之间的角度,像这样:
I'm not sure what you mean by angle, since you only give one vector in your example. But, given two vectors, you can find the angle between them like so:
由于载体的 A 和 B ,规范他们两个。然后,点( B )= COS(θ),其中θ是两个向量的夹角。使用ARCCOS找到θ
Given vectors a and b, normalize both of them. Then, dot(a, b) = cos(θ), where θ is the angle between the two vectors. Use arccos to find θ.
这篇关于从矢量角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!