
This implementation of Quaternion multiplication looks backwards/inverse to me:
const ofQuaternion ofQuaternion::operator*(const ofQuaternion& rhs) const {
return ofQuaternion(rhs._v.w*_v.x + rhs._v.x*_v.w + rhs._v.y*_v.z  rhs._v.z*_v.y,
rhs._v.w*_v.y  rhs._v.x*_v.z + rhs._v.y*_v.w + rhs._v.z*_v.x,
rhs._v.w*_v.z + rhs._v.x*_v.y  rhs._v.y*_v.x + rhs._v.z*_v.w,
rhs._v.w*_v.w  rhs._v.x*_v.x  rhs._v.y*_v.y  rhs._v.z*_v.z);
}
This looks like rhs * this, instead of this * rhs.
Given that quaternions are noncommutative, this is important. 
I’m not sure where this implementation of QuaternionVector multiplication came from:
ofVec3f ofQuaternion::operator*(const ofVec3f& v) const {
// nVidia SDK implementation
ofVec3f uv, uuv;
ofVec3f qvec(_v.x, _v.y, _v.z);
uv = qvec.getCrossed(v); //uv = qvec ^ v;
uuv = qvec.getCrossed(uv); //uuv = qvec ^ uv;
uv = (2.0f * _v.w);
uuv = 2.0f;
return v + uv + uuv;
}
It says it came from the NVIDIA implementation, but this is what I found for the NVIDIA implementation:
const PxVec3 rotate(const PxVec3& v)
{
const float vx = 2.0f * v.x;
const float vy = 2.0f * v.y;
const float vz = 2.0f * v.z;
const float w2 = w * w  0.5f;
const float dot2 = (x * vx + y * vy + z * vz);
return PxVec3((vx * w2 + (y * vz  z * vy) * w + x * dot2), (vy * w2 + (z * vx  x * vz) * w + y * dot2),
(vz * w2 + (x * vy  y * vx) * w + z * dot2));
}
For one, these two algorithms might look similar if you squint, but they are different (as far as I can tell).
Furthermore, the OF implementation doesn’t even use w at all. It disregards it altogether. NVIDIA uses w.
Last but not least, I’m not familiar with this sort of implementation. I’m more familiar with the qvq^{1} method of rotating a vector with a quaternion. So both of the above implementations don’t make sense to me.
Any relevant feedback is highly appreciated. Thanks!
Also, if I wanted to help improve the source code, how would I go about doing that?
References:
OpenFrameworks Quaternion: https://openframeworks.cc/documentation/math/ofQuaternion/#show_operator*
NVIDIA Quaternion: https://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/PxQuat_8hsource.html