A vector is not an angle, an angle would be formed by two vectors, or an angle could be made between a vector and an axis. As it is, your question makes no sense.
I've got this problem where I want to convert a vector (X,Y,Z) to an angle (Pitch, Yaw, Roll) in degrees (radians is also fine).
I've searched the internet but all examples I find are either in 2D or they just return one angle (the angle between two vectors or similar).
The vector is representing the direction of an object (the forward vector).
Things I have to go with: forward vector, right vector, up vector, rotation matrix, the rotation in quaternions.
Can't use the quaternions since I actually need the degrees (or radians).
Have also tried to find a way to convert quaternions to radians but I never found a working example.
This is applied for a computer game I am working on for school, basically I need some theory.
Any help would be much appreciated!
there will actually be 3 angles, hmm? the problem with answering your question (which is perfectly decideable) is that there are competing conventions with notating and describing angular motion in 3 dimensions:
Tait-Bryan angles (this may be what you are wanting)
Aircraft principal axes (this also may be what you are wanting)
Euler angles are often computed using quaternions, as implementing Euler angles in programming can result in "gimbal lock" where one degree of freedom becomes permanently lost. quaternions avoid this problem.
You may find what you are looking for here.
Oops yes, that is perfectly right. Reading my question again that seems a bit odd.
I just need some way to figure out the angles pitch, yaw and roll with the information I have.
Thought it would be possible to convert a single vector into an angle since I've seen it been done in programming before I've just not be able to see the source code.
One interesting thing about that programming function might be that the
roll of the returned angle will always be zero. This is because the roll describes the rotation around the axis - the vector is just an axis. Maybe there is a trick to it.
For example would it be possible to calculate pitch, yaw and roll if I calculated the angle between the forward vector and (1,0,0), forward and (0,1,0), forward and (0,0,1)?