I think I had a similar issue once about rotating a btVector3 by a btQuaternion. In my simulator, I just found myself to perform this operation in Ogre::Vector and Ogre::Quaternion. It could be a good idea to add this functionality.
I will look into the override you speak of, I am interested.
Edit:
I went back to before the introduction of the cryptic SIMD notation.
That is what it was before:
Code: Select all
SIMD_FORCE_INLINE btQuaternion
operator*(const btQuaternion& q, const btVector3& w)
{
return btQuaternion( q[3] * w.x() + q.y() * w.z() - q.z() * w.y(),
q[3] * w.y() + q.z() * w.x() - q.x() * w.z(),
q[3] * w.z() + q.x() * w.y() - q.y() * w.x(),
-q.x() * w.x() - q.y() * w.y() - q.z() * w.z());
}
SIMD_FORCE_INLINE btQuaternion
operator*(const btVector3& w, const btQuaternion& q)
{
return btQuaternion( w.x() * q[3] + w.y() * q.z() - w.z() * q.y(),
w.y() * q[3] + w.z() * q.x() - w.x() * q.z(),
w.z() * q[3] + w.x() * q.y() - w.y() * q.x(),
-w.x() * q.x() - w.y() * q.y() - w.z() * q.z());
}
from [
https://github.com/bulletphysics/bullet ... ion.h#L236]
Maybe we can find out what it does. To me, it looks like some kind of 4D crossproduct, but that is not defined in such a way to my understanding.
Edit2:
Ok it is just a quaternion multiplication with w[3] = 0. Compare this (I marked the elements in the quaternion multiplication which are 0 within the lower quaternion-vector example because the vector does not have a fourth value):
SIMD_FORCE_INLINE btQuaternion
operator*(const btQuaternion& q1, const btQuaternion& q2) {
return btQuaternion( q1[3] * q2.x() +
q1.x() * q2[3] + q1.y() * q2.z() - q1.z() * q2.y(),
q1[3] * q2.y() +
q1.y() * q2[3] + q1.z() * q2.x() - q1.x() * q2.z(),
q1[3] * q2.z() +
q1.z() * q2[3] + q1.x() * q2.y() - q1.y() * q2.x(),
q1[3] * q2[3] - q1.x() * q2.x() - q1.y() * q2.y() - q1.z() * q2.z());
}
SIMD_FORCE_INLINE btQuaternion
operator*(const btQuaternion& q1, const btVector3& w)
{
return btQuaternion( q1[3] * w.x() + q1.y() * w.z() - q1.z() * w.y(),
q1[3] * w.y() + q1.z() * w.x() - q1.x() * w.z(),
q1[3] * w.z() + q1.x() * w.y() - q1.y() * w.x(),
-q1.x() * w.x() - q1.y() * w.y() - q1.z() * w.z());
}
However, I am not sure what the interpretation of this is.