## Generic quaternion decompositiongreenspun.com : LUSENET : quaternions : One Thread |

Hello,I have been thinking about a quaternion problem for some times now, but I only use them from a computer graphics point of view so I lack the mathematical background to solve this.

Let us represent a quaternion by q = (w,v) (w being a scalar and v a 3d vector), and the quaternion product by *.

If qi=(wi,vi) for i in [1..3], with vi given and wi unknown, and if q is given, I would then like to solve the following equation (ie, find proper values for w1, w2 and w3) :

q = q1*q2*q3.

This has a simple geometrical counterpart : given a rotation, can you express it as the composition of a set of rotations along given axis ? In specific cases, such as Euler angles, this can be performed; but I'm looking for a more general solution, with arbitrary rotation axis...

Regards, Olivier Parisy.

-- Olivier Parisy (parisy@labri.fr), June 23, 2003

Hello Olivier:I like to think of quaternions as complex numbers where the 3-vector just has an i j k instead of an i. For ASCII, let q=(w, V), the capitalization showing the difference between scalar and 3-vector.

It does not appear to me like the question can be answered as stated because there are three unknowns, V1, V2, and V3, but only one equation. If V1 = V3 or V1 = -V3, that is two equations, three unknowns.

If V1 = V3, the thing to do is to rewrite the equation q = q1 q2 q3 as q = q1' q2. This should be doable, since one correct rotation can do the work of two, but the two rotations are more popular in the literature. Then q1' = q q2^-1.

-- Doug Sweetser (sweetser@alum.mit.edu), June 23, 2003.

Thanks, Doug ! I definitely did not expect such a quick answer.OK, so as I feared, I did not make me clear enough. You are definitely right: not constraining rotation axis leads to a not specified enough problem.

But the case I am interested in is more specific: V1, V2 and V3 are actually fixed, so I know them. the only unknown variables here are w1, w2 and w3. Because the q=q1*q2*q3 equation can be expressed as a set of four equations (x=..., y=..., etc) if I express q as (w,x,y,z), and because one of those equations is actually linked to the other (as an example, using the classical x^2+y^2+z^2+w^2=1 property), it seems to me like this is actually a 3 equations / 3 variables problem.

I actually tried to solve this, but it really gets out of hands (lenghty polynomial equations and the like...)

Regards.

-- Olivier Parisy (parisy@labri.fr), June 23, 2003.

Have you tried:Let q = (w,V) = q1*q2*q3 = (w1,V1)*(w2,V2)*(w3,V3)

to find w1: 1. transform V such that V'=A1*V where matrix A1 is chosen s.t. A1*V1=(1,0,0) 2. convert q' = (w,V') to Euler angles (a1, a2, a3) 3. then w1 = a1

to find w2: 1. transform V such that V'=A2*V where matrix A2 is chosen s.t. A2*V2=(1,0,0) 2. convert q' = (w,V') to Euler angles (a1, a2, a3) 3. then w2 = a1

to find w3: 1. transform V such that V'=A3*V where matrix A3 is chosen s.t. A3*V3=(1,0,0) 2. convert q' = (w,V') to Euler angles (a1, a2, a3) 3. then w3 = a1

I'm sorry its just an intuitive solution and I haven't provided a proof. I don't have time to do that right now but I thought it would be better than nothing...

Essentially, the process above successively aligns the first Euler axis with V1, V2, and V3, each time converting the resulting realigned quaternion to Euler angles. Its really just angular projection.

Which means! Aha! This won't give the right solution unless V1, V2, V3 are a complete basis, which I assume they are not. So in that case you can follow the Gram-Schmidt orthonormalization procedure, using quaternion projection and subtraction of course.

-- Brian Clarkson (clarkson@csl.sony.co.jp), November 19, 2003.

Here is a some decomposition methods that can help. http://www.euclideanspace. com/maths/geometry/rotations/for/decomposition/

-- Michael Norel (minorlogic@yahoo.com), May 12, 2004.

Moderation questions? read the FAQ