New answers tagged

0

The idea of measuring the distance between quaternions is indeed a useful similarity measure. In essence, what you can measure the dot product between two quaternions qA and qB just as you compute the dot product of two vectors (see this). Moreover, since you have unit quaternions (they do represent rotations!), the dot product should be between [-1,1]. ...


2

Alright so I figured out an even more ideal solution. The way I was trying to solve the problem was going to lead to more issues than I needed to deal with, so instead I slept on the problem and thought up a different approach. Instead of trying to min-max my orientation, I now calculate how far from the target orientation the camera is, If it lays above a ...


0

If I understand your question, you want to limit the rotational velocity of a turn? Get the delta. From your rotation delta, you can find out how many radians of turn it represents from the S element (or sometimes called W element). The S element is cos(rotationAmt / 2), so can be extracted as rotationAmt = acos(deltaQuaternion.s) * 2. From there you ...


2

I bit on the mathematical side, but here's a Q & A on MSE on computing quanternion distance. Using that you could do something like: quat targetQuat = target->getOrientation(); quat currentQuat = getOrientation(); quat lerpQuat = glm::lerp(currentQuat, targetQuat, 0.05f); quat maximumQuat = targetQuat*quat(0.707, 0, -0.3535, 0); float d1 = ...


1

Converting between a Quaternion (transform.rotation) and an Euler angle triplet is not possible the way you wrote it. See the API http://docs.unity3d.com/ScriptReference/Transform-rotation.html for the meaning of the transform.rotation property. If you want to double check or verify that your Euler angles are correct, you can convert them to a quaternion ...


1

I can think of two reasons: if your quats represent infinitesimal rotations, adding them together actually yields the composite rotation, provided the result is infinitesimal too (i.e. an element of that algebraic group). Quaternion addition, as opposed to multiplication, is commutative and, well, numerically fast. One situation where this might be "a ...


1

Ok, i didn't read carefully enough the documentations, it states that: q.x = sin(theta/2) * axis.x q.y = sin(theta/2) * axis.y q.z = sin(theta/2) * axis.z q.w = cos(theta/2) so in my case i had to write: D3DXQUATERNION tempRot1(0.0f, sin(XM_PIDIV2 / 2), 0.0f, cos(XM_PIDIV2 / 2));



Top 50 recent answers are included