Is it possible to create a Quarterion Twist Solution that allows 360 degree rotation?

I recently read about quaternions and wondered if it is possible to create a system that allows you to create a curl system that does not flip +/- 180 and does not allow for 360 degrees?

Every test I've done keeps going back to calculating the angle between the two vectors, which always gives you the angle between 0 and 180.

If you're not sure what exactly I'm looking for, then this video from Jorn-Harald Paulsen should make it clear I would like to do it with quaternions, but I'm not sure which method he uses.

I read an article by Felix Jolean on his website about rollover prevention, he has a section on twist setting but it's more like aim / lookAt limitation and this setting won't work for distributing twist across multiple joints. It also depends on using some Euler angle tricks / hacks that I would rather avoid in favor of quaternions.

+3


source to share


4 answers


Quaternions

q = cos(t/2) + (u_x i + u_y j + u_z k) sin(t/2)

      



give a smooth mapping of the angles of rotation. For 360 degrees, you have q = -1, but that doesn't matter when you map a quaternion to a rotation; rotation is just identity, exactly what you want. There is no "flip" in the corner. So I don't understand what the problem is ...

+1


source


Quaternions represent the "Orientation" position, angular in space. But it cannot represent a 360 degree rotation, because the orientation changes over time.

If you want to represent angular movement (rotation) about a fixed axis, you can use the "Axis Angle" view https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation

or "exponential map" https://en.wikipedia.org/wiki/Rotation_group_SO(3)#Exponential_map



If your axis of rotation matches the axis of the frame than you can use "Euler's angels"

All of these representations can be converted to quaternions or rotation matrices.

0


source


I recently developed a twist extraction algorithm in our project. I'll just describe it, and you decide that you need it.

Suppose we have a hand, its two ends are called E1

and E2

, the orientations of which are described in quaternions. When E2

pivoting around the direction of the arm for a corner r

, we expect to E1

rotate f*r

.

Let's see why the switch is happening (let's say f = 0.5

in this example). At one point, E2

it could be rotated 170 degrees, which means it E1

rotates 85 degrees.

We then continue to rotate E2

20 degrees since it f

equals 0.5, we expect to E1

rotate 10 degrees, resulting in a rotation of 95 degrees. But the quaternion cannot represent a 190 degree rotation E2

, it tells us it E2

actually rotates -170 degrees, so it E1

ends up with a -85 degree rotation. Compared to its previous 85-degree rotation, it flips over.

Obviously, the click only happens when you have a "pivot angle". In our example, the "reference angle" is 85 degrees. We have no way to prevent quaternions from producing a -170 degree result, but using the reference angle information can fix flipping.

Before we multiply -170 by 0.5, we must check the current rotation angle E1

, which is the reference angle, 85 degrees. Divided by 0.5, we will know in the last frame, E2

has a 170 degree rotation. Then add the n*360

exponent to -170 to get it as close as possible to 170. This procedure can be done using remquo

C ++.

float FindClosestEquavilentAngle (float angle, float reference)
{
    int cycle = 0;
    remquo(reference - angle, 360, &cycle);
    return angle + 360 * cycle;
}

      

This function converts -170 degrees to 190 degrees. Now we can multiply 190 by 0.5 and apply the result to E1

.

This works in my case.

0


source


If you want to represent your rotations using quaternions rather than angles, then there will always be the problem you are facing. Here's a simple example: suppose you start working on your program when the clock says 10 and you finish when the clock says 12. When are you halfway there? Most people say 11, but if you start at 10 p.m. and finish at 12 p.m. you will be halfway when the clock says 5 (7 hours through a 14 hour marathon session).

The bottom line is that there is no way to tell which one is the correct answer. Likewise, there is no universal way to correctly interpolate half a rotation or a third of a rotation or whatever.

If you only want to solve the quaternion, I suggest "extrapolation" instead of interpolation angles. That is, set the control to be the element that rotates or moves the least, and then let all others be multiples of the quaternion representing the least rotation. Therefore, if q

- the smallest turn closest to the arm socket q^2

rotates twice as much, q^3

rotates three times as long, etc.

0


source







All Articles