Page 1 of 1

Quaternion inverse() in btQuaternion.h

Posted: Tue Mar 25, 2008 12:46 pm
by LvR
Hi, I' ve a small question about inverse() as coded in btQuaternion.h :

Code: Select all

	btQuaternion inverse() const
	{
		return btQuaternion(m_x, m_y, m_z, -m_unusedW);
	}
I thougth that inverse was the conjugate divided by the norm (if not a unit quaternion)

So I would see instead :

Code: Select all

	btQuaternion inverse() const
	{
		return btQuaternion(-m_x, -m_y, -m_z, m_unusedW);
	}
Is this equivalent or it's a bug ?

Re: Quaternion inverse() in btQuaternion.h

Posted: Tue Mar 25, 2008 3:16 pm
by Erwin Coumans
Quaternions q and ?q represent the same rotation indeed.

Thanks,
Erwin

Re: Quaternion inverse() in btQuaternion.h

Posted: Wed Mar 26, 2008 7:18 am
by LvR
I've found this when checking a HingeConstraint constructor bug, where I had a inverted axis after using quatRotate(...), so I think it should be corrected because I got a inversed Vector here :

Code: Select all

SIMD_FORCE_INLINE btVector3 
quatRotate(const btQuaternion& rotation, const btVector3& v) 
{
	btQuaternion q = rotation * v;
	q *= rotation.inverse();
	return btVector3(q.getX(),q.getY(),q.getZ());
}

Re: Quaternion inverse() in btQuaternion.h

Posted: Mon Apr 07, 2008 11:33 pm
by Erwin Coumans
Thanks for the report,

It has been fixed in latest Bullet subversion, ready for upcoming Bullet 2.68:
http://code.google.com/p/bullet/issues/detail?id=47

Thanks also to Eddybox.
Erwin