   3d vector to angles
  Hi!Can someone tell me, if i have a vector in the 3d world, how can i calculate the 3 rotation angles around x,y,z, what angles describes my vector?Thanks!   
  Normalize your vector, and get the arccosine of the dot product of the normalized vector and the world axises.  Dot Productpsuedo-code:Vector3D UnitVect = MyVect.Normalized();Vector3D XAxis(1.0f, 0.0f, 0.0f);Vector3D YAxis(0.0f, 1.0f, 0.0f);Vector3D ZAxis(0.0f, 0.0f, 1.0f);float XAngle = acosf(DotProduct(UnitVect, XAxis));float YAngle = acosf(DotProduct(UnitVect, YAxis));float ZAngle = acosf(DotProduct(UnitVect, ZAxis));;  thanks.now i'll try to describe my problem, because i wasnt very informative.i have an accelerometer, which gives me the static acceleration in x, y, and z (z points upwards) direction.the task is to compute the unit's roll and pitch (rotation around the x and y axle) from these values. my problem is, that asin or acos gives me only [-90,90] degrees of rotation. so i want to use the reading from z, what tells, in which half-sphere we are. but i cant find the solution.   ;Quote:Original post by greenmachinethanks.now i'll try to describe my problem, because i wasnt very informative.i have an accelerometer, which gives me the static acceleration in x, y, and z (z points upwards) direction.the task is to compute the unit's roll and pitch (rotation around the x and y axle) from these values. my problem is, that asin or acos gives me only [-90,90] degrees of rotation. so i want to use the reading from z, what tells, in which half-sphere we are. but i cant find the solution.Didn't read the whole thing, but based on the last bit I'm going to go ahead and say: atan2()!   