I'm an android programmer and I have a problem that it's base is in about Mathematics.So excuse me if it is very easy ,abstract or bad formatted.But I need a simple solution for my problem to convert it to an algorithm:
I have a right hand Cartesian coordinate system and a 3D vector in it,for example k that is (0,0,1).This system rotates several times,for example:

rotateX(roll with r0 degree);
rotateY(pitch with p0 degree);
rotateZ(yaw with y0 degree);
rotateX(roll with r1 degree);
rotateY(pitch with p1 degree);
rotateZ(yaw with y1 degree);

I have to find the angle between that vector and it's rotated result after above rotations.It was easy,if coordinate system was fixed,and this is my problem.When system rotate for r0 degrees around x-axis,it changes from xyz to XYZ and second rotation done around Y-axis(instead of y-axis) and so on for latest rotations.How I can get the angle between vector and the same vector in latest coordinate system?

  • $\begingroup$ Do you store the final vector's components with respect to a fixed (i.e. unrotated) frame? $\endgroup$
    – Muphrid
    Jan 13, 2013 at 16:16
  • $\begingroup$ @Muphrid Do you explain what you mean,please? $\endgroup$ Jan 13, 2013 at 18:52
  • $\begingroup$ You have two vectors: the original $k$ and a new vector $k'$ that represents the new orientation. These vectors have components, and their components are with respect to some coordinate system. Are the coordinate systems that these vectors are referenced to the same? $\endgroup$
    – Muphrid
    Jan 13, 2013 at 21:17
  • $\begingroup$ @Muphrid First of all,thank you for your attention.After rotations,I only know the order and degree of rotations and that final vector is again k,but it is (0,0,1) in it's current system.If I have it's components with respect to the first coordinate system,then I do inner product between k and k' to get the angle. $\endgroup$ Jan 14, 2013 at 4:32
  • $\begingroup$ Right, so really you have no information at all about current direction of the vector with respect to any fixed coordinate system. I wonder, how do you store the attitude of the object at all then? There is some object being rotated, is there not? How do you know where it's pointing at any given moment? $\endgroup$
    – Muphrid
    Jan 14, 2013 at 4:51


You must log in to answer this question.

Browse other questions tagged .