View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Is the concatenation of a VQS with its inverse commutative?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1thewhiteaussie  Members

Posted 22 June 2013 - 04:41 PM

Quaternion concatenation is noncommutative. That is

qa * qb    qb * qa

However

q-1 * q = q * q-1 = Iq

where q-1 is the inverse of q and Iq is the identity quaternion. VQS concatenation is also noncommutative:

TA_B  * TB_C     TB_C * TA_B

Where TA_B represents a VQS transformation. Now, we find the inverse of TA_B like so:

TA_B-1 = TB_A

My question is, is the concatenation of a VQS with its inverse commutative? Ie, is the following statement correct?

TA_B * TB_A = TB_A * TA_B = IVQS

Where IVQS  is the identity VQS. With the implementation I’m using I’m finding

T -1 * T   =   IVQS, whereas

T * T -1      IVQS

This seems incorrect; both sould return IVQS.

EDIT:

Here is the implementation of VQS Inverse and concatenation functions I'm using:

//--------------------------------------------------------------------------------
//		Concatenation
//--------------------------------------------------------------------------------
VQS VQS::operator*(const VQS& rhs) const
{
VQS result;

//Combine translation vectors
result.v = q.Rotate(rhs.v) * s + v;

//Combine quaternions
result.q = q * rhs.q;

//Combine scales
result.s = s * rhs.s;

//Return result
return result;

}	//End: VQS::operator*()

//--------------------------------------------------------------------------------
//		Returns inverse VQS
//--------------------------------------------------------------------------------
VQS Inverse(const VQS& other)
{
VQS temp;

//Inverse scale
temp.s = 1.0f / other.s;

//Inverse quaternion
temp.q = Inverse(other.q);

//Inverse vector
temp.v = temp.q.Rotate(-other.v) * temp.s;

return temp;

}	//End: Inverse()


### #2Álvaro  Members

Posted 22 June 2013 - 09:36 PM

Yes, you should get the identity in both cases. Can you post a specific example where you don't get that? Simple numbers would be best, so we can do the computations by hand...

### #3thewhiteaussie  Members

Posted 22 June 2013 - 11:26 PM

Ok good idea. Here's an example that might help. Incidentally, the issue it seems appears to be with the Inverse(VQS) function. Here's a test case:

T = [(-3.2, 1.6, -10.3) , (-0.52, 0.68, 0.49, 0.32) , 2]

Inverse( Inverse(T) ) = [(-4.0, 2.5, -9.9) , (-0.52, 0.68, 0.49, 0.32) , 2]

Inverse( Inverse(T) ) should return T. The scalar and quaternion components are correct, however the translation vector is off. It looks like the method to find the inverse translation component might be incorrect.

### #4thewhiteaussie  Members

Posted 23 June 2013 - 01:58 AM

SOLVED.

Solution was to ensure all quaternions were normalized, thus representing rotations.

### #5BornToCode  Members

Posted 23 June 2013 - 11:00 AM

Just to let you know just because your quaternions are normalized does not mean they represent rotation. Quaternion can be used for other things other than rotation.

In the graphics world, it is used mostly for that. But in reality they can be used for other things other than rotation.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.