Trigonometry question about the angle between a vector and the x-axis of a plane?


I have kind of a meta question about trigonometry!
Am I right in assuming that the following calculation/formula gives me the angle alpha between a two-dimensional vector and the x-axis of a plane (i.e. xy-plane)?

For the y-coordinate of the vector being bigger than 0:

  • alpha = acos(vector x / vector length)

For the y-coordinate being smaller or equal to 0:

  • alpha = 2 x Pi - acos(vector x / vector length)

Furthermore, how would I go about introducing 3D space into this? I mean calculating the angle for three-dimensional vectors? This would only be possible in the local plane of the vector and the x-axis, wouldn’t it?

As always, thanks.

you can calculate the angle between two vectors using the dot product. rhino also provides some nice reading on these topics. =)

Thanks, but is my above assumption true or false?

Hello matie!
It’s always useful to remember the unit circle from high-school:
each 2d vector is analyzed into x and y axes.
for any given angle α,
the sin(α) =y

reversing this gives us:
asin(y) = α
acos(x) = α
atan(y/x) = α
without needing to worry about negative or positive values

as for the 3D space, it depends what you want to calculate and to what ends.
You can get the 3 components of your 3d vector or consider a plane it resides in as your axes and treat it as a 2d vector.
If you want to have some freedom in 3d space though, as @fertig said, you should be able to use dot product and cross product with ease.

1 Like

the first equation is right because vector x/ vector length = cos(α)
the second equation is also right but just coincidentally: explementary angles have same x values
(if you were to analyze the sine it would be:
α = 2*π - asin(-vector y/ vector length)


Get a meta answer then (the last C#) and some others (the others) (125.2 KB)

BTW: Added a more simple thinky: (115.1 KB)

1 Like

You don’t need vector x; Y/(line length) always is the Sin and X/(line length) is Cos
Don’t forget to use absolute when y < 0

1 Like