catchyid Posted April 23, 2018 Share Posted April 23, 2018 Hi, using vex... a) First Question float angle = radians(90); vector axis = {just random vector} vector4 goalQuaternion = quaternion(angle,normalize(axis)); Question: IF angle == 0.0, then is this a valid quaternion? I don't want to spin, so I am setting angle to zero, however when I do that, I don't get any rotation? b ) Second question if I have two quaternions: vector4 Q_Init, Q_Dest; {they get initialized correctly} vector4 Q_Diff = qmultiply(Q_Init,qinvert(Q_Dest); //difference between two quaternions My question:If I want to interpolate from init to dest quaternions in 10 steps, how do I do that? meaning If I multiply Q_Init by Q_Diff I will jump at once, but I want to that in 10 steps instead, it's like dividing Q_Diff by "10" Thanks Quote Link to comment Share on other sites More sharing options...
anim Posted April 23, 2018 Share Posted April 23, 2018 a) if the angle is 0, you will get identity quaternion {0,0,0,1} so no rotation as the angle/axis notation defines quaternion as a rotation of angle degrees around the axis, if the angle is 0, then the rotation around given axis is 0 and hence no rotation b) vector4 Q_Init = eulertoquaternion(radians(chv("q0")), 0); vector4 Q_Dest = eulertoquaternion(radians(chv("q1")), 0); vector4 Q_Diff = qmultiply(Q_Dest,qinvert(Q_Init)); // quaternion difference from Q_Init to Q_Dest int nsteps = chi("nsteps"); Q_Diff = slerp({0,0,0,1},Q_Diff, 1.0/nsteps); // compute Q_Diff rotation for single step p@orient = Q_Init; for (int i=0;i<nsteps;i++){ p@orient = qmultiply(Q_Diff, p@orient); } // after adding Q_Diff nsteps times to Q_Init p@orient will result in Q_Dest 2 Quote Link to comment Share on other sites More sharing options...
catchyid Posted April 23, 2018 Author Share Posted April 23, 2018 Thanks a lot your help is really appreciated... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.