views:

60

answers:

3

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?

A: 

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.

31eee384
yes, thanks I want to get the angle on an axis of a vector.
mm1
A: 

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.

duffymo
Yes, I mean angle components in the x and y directions. Sorry for the confusion!
mm1
Components of what vector? The two vectors in the dot product? Each one still has its own components. The sum or difference of the two? The cross product? Your question STILL makes no sense at all.
duffymo
Say I have two vectors (0,0,1) and (0,1,0). In this case the angle is 90 degrees. The angle on the y axis is 90 degrees and the angle on the x axis is zero degrees. I want to be able to figure that out for any arbitrary angle.
mm1
Total confusion on your part. What angle are you talking about? The dot product of these two vectors is zero, because they're orthogonal to each other. Your statement about "The angle on the y axis..." is utterly wrong.
duffymo
The angle between the two vectors is acos(V1 DOT V2). With the above case I come out with 90 degrees. If they were points on the earth one would be on the north pole and the other at the equator. If I start at the equator I rotate 90 degrees (with the axis of rotation being the xaxis - sorry I said y axis before) to get to the other vector. I should be able to break down any two points on the earth with a rotation of X degrees and Y degrees with the respective axis of rotation. Sorry if this is now more confusing!
mm1
You don't understand vectors - no wonder this is giving you problems. The confusion is all yours, not mine. I do understand how vectors work.
duffymo
+1  A: 

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

Rusty