   How do I define the position of a quat?
  [x y z w]If I choose z to have some value, the mesh rotates around the z axis.I think w is the real part, and x y z are the complex parts.. is it right?I still don't know how to define a vector position for a quat....Anyone?ThanksJack    
  Ignoring the fact that "position of a quat" makes no sense...The typical way to set up the values of a quaternion are to convert from axis-angle format. Given the orientation as a rotation of θ around the axis A, then the equivalent quaternion q is:qx = Ax sin θ/2    qy = Ay sin θ/2    qz = Az sin θ/2    qw = cos θ/2 ;Quote:Original post by JohnBoltonIgnoring the fact that "position of a quat" makes no sense...The typical way to set up the values of a quaternion are to convert from axis-angle format. Given the orientation as a rotation of θ around the axis A, then the equivalent quaternion q is:qx = Ax sin θ/2    qy = Ay sin θ/2    qz = Az sin θ/2    qw = cos θ/2 A is a matrix or a vector?How do you define theta?Sorry, I am a newbie...Another question:How do you make the arm rotate about the joint? Do u need to do an inverse transformation to make all rotations happen at the origin of the mesh? then translate back to the right positions?Thank you for your timeJack[Edited by - lucky6969b on September 1, 2007 10:21:02 AM];  Read previous sentence of JohnBolton:Quote:Given the orientation as a rotation of θ around the axis A, then the equivalent quaternion q is:;Quote:Original post by lucky6969b[x y z w]If I choose z to have some value, the mesh rotates around the z axis...Don't try to give the values of a quaternion some geometric meaning; it will not work generally (why? see the definition John has posted above). Think of a quaternion as a tool, not more.To your question: Rotating with a specific point in rest requires you to make the point become temporarily 0, since 0 is the only point that is invariant against rotation. Do this by wrapping the rotation by a translation and its inverse. E.g. if the point P should be in rest, thenT * R * T-1 [if using column vectors]defines the total transformation, where T is the translation build from P and R is your rotation.   ;Original post by haegarrQuote:Original post by lucky6969bTo your question: Rotating with a specific point in rest requires you to make the point become temporarily 0, since 0 is the only point that is invariant against rotation. Do this by wrapping the rotation by a translation and its inverse. E.g. if the point P should be in rest, thenT * R * T-1 [if using column vectors]defines the total transformation, where T is the translation build from P and R is your rotation.How do you define/create R?R must be the quaternion.How do you define the [x y z w] values?Let's say I have a matrix transformation    1 2 3 0 (Just make it up)   3 1 1 0  12 2 1 0   0 2 4 1How do you convert this to a quaternion?Without a matrix in the first place, how would you define the values insidequaternion? still confused :)ThanksJack;  A formula likeT * R * T-1denotes a concatenation of 3 distinct transformations, here 2 translations and a rotation. There is no way to express a translation in a quaternion (as almost all posts above have mentioned already). All these 3 transformations above are matrices. So there is no need to convert R to a quaternion for performing the rotation. In general, one uses a quaternion to _store_ an orientation or rotation and/or to _interpolate_ a rotation; it is also possible to concatenate 2 rotations by multiplying quaternions. One _can_ also apply it directly to a vector for the purpose of rotation. However, most often your desire is to apply an entire group of  affine transformations (e.g. the formula above), and therefore it is the best choice to use matrices at that moment.So, in the cited case, you may have given a quaternion Q that you want to convert into a rotation matrix R, not vice-versa! Google will tell you how to do so. A short google using "convert quaternion matrix" should give you enough solutions. If, on the other, you already have a matrix then you're already fine.I recommend you to look up and understand how transformation concatenation works and how transformations relate to co-ordinate frames.   ;  Do you have to use quaternions? I recommend that you gain a solid understanding of linear algebra before tackling quaternions.;  Hello guys,After I've done a little bit of reading, Quaternions started to make sense to me.Now I would say,if I always presume a mesh rotate around the cardinal axis, all I have to worry are the degrees in radian measures....Let's say I'd like to rotate a bone for 45 degrees, I first turn this into a radian equivalence, then work out the [w,x,y,z] accordingly... then I am on the fly..But at first blush, I forgot how to work out radians from degrees...Anyone backs me up please?ThanksJack