Hi,
I take a look at FQuat source code and I have a question about 2 methods:
FQuat::operator*(const FVector& V) const
FQuat::RotateVector( FVector V ) const
operator* documentation say
but, the source code is not the same but the goal is the same… Does anybody know why?
inline FVector FQuat::operator*( const FVector& V ) const
{
FQuat VQ(V.X, V.Y, V.Z, 0.f);
FQuat VT, VR;
FQuat I = Inverse();
VectorQuaternionMultiply(&VT, this, &VQ);
VectorQuaternionMultiply(&VR, &VT, &I);
return FVector(VR.X, VR.Y, VR.Z);
}
and
FORCEINLINE FVector FQuat::RotateVector( FVector V ) const
{
// (q.W*q.W-qv.qv)v + 2(qv.v)qv + 2 q.W (qv x v)
const FVector qv(X, Y, Z);
FVector vOut = 2.f * W * (qv ^ V);
vOut += ((W * W) - (qv | qv)) * V;
vOut += (2.f * (qv | V)) * qv;
return vOut;
}
Is it better to used the operator or the method instead? RotateVector is not able to use SSE or other.
Thanks!