从矢量角度 [英] Angle from vector

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

问题描述

说我有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屋!

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