开发者

How do I get the x or y angle of two vectors?

I know I can get the total angle of two vectors by the dot product of them both, but what 开发者_高级运维if I just want to break down the angle into components of angle by X and angle by Y?


You didn't state 2D vs 3D....but...

For 3D vectors: angle = acos(v1•v2)...normalize v1 and v2 before getting the dot product.

Answers for your other questions can be found here: Maths - Angle between vectors


Use the vectors A and B, for instance. A . B = |A||B| cos (angle) for 3d vectors or 2d vectors.


It depends on what you mean by by X and by Y. If you mean get the angle on an axis of a vector, you will want to use inverse trigonometry, most likely atan2.

This reference is for C++, but the function should work the same way for most languages.


Angles are scalars, not vectors. They don't have components like vectors do.

Are you asking for the components of the vector that represents the sum of the two vectors? That has components in the x- and y-directions.

This question makes no sense as written. Please revise so we can help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜