Quaternion inverse() in btQuaternion.h

Post Reply
LvR
Posts: 13
Joined: Mon Mar 17, 2008 8:09 am

Quaternion inverse() in btQuaternion.h

Post by LvR » Tue Mar 25, 2008 12:46 pm

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 ?

User avatar
Erwin Coumans
Site Admin
Posts: 4189
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Quaternion inverse() in btQuaternion.h

Post by Erwin Coumans » Tue Mar 25, 2008 3:16 pm

Quaternions q and ?q represent the same rotation indeed.

Thanks,
Erwin

LvR
Posts: 13
Joined: Mon Mar 17, 2008 8:09 am

Re: Quaternion inverse() in btQuaternion.h

Post by LvR » Wed Mar 26, 2008 7:18 am

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());
}

User avatar
Erwin Coumans
Site Admin
Posts: 4189
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Quaternion inverse() in btQuaternion.h

Post by Erwin Coumans » Mon Apr 07, 2008 11:33 pm

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

Post Reply