Download

FTransform::TransformVector vs TransformPosition

FTransform::TransformVector seems to only apply rotation and scaling, not translation:

FORCEINLINE FVector FTransform::TransformVector(const FVector& V) const
{
	DiagnosticCheckNaN_All();

	const VectorRegister InputVectorW0 = VectorLoadFloat3_W0(&V);

	//RotatedVec = Q.Rotate(Scale*V.X, Scale*V.Y, Scale*V.Z, 0.f)
	const VectorRegister ScaledVec = VectorMultiply(Scale3D, InputVectorW0);
	const VectorRegister RotatedVec = VectorQuaternionRotateVector(Rotation, ScaledVec);

	FVector Result;
	VectorStoreFloat3(RotatedVec, &Result);
	return Result;
}

While FTransform::TransformPosition seems to apply rotation, scaling and translation:

FORCEINLINE FVector FTransform::TransformPosition(const FVector& V) const
{
	DiagnosticCheckNaN_All();

	const VectorRegister InputVectorW0 = VectorLoadFloat3_W0(&V);

	//Transform using QST is following
	//QST(P) = Q.Rotate(S*P) + T where Q = quaternion, S = scale, T = translation
	
	//RotatedVec = Q.Rotate(Scale*V.X, Scale*V.Y, Scale*V.Z, 0.f)
	const VectorRegister ScaledVec = VectorMultiply(Scale3D, InputVectorW0);
	const VectorRegister RotatedVec = VectorQuaternionRotateVector(Rotation, ScaledVec);

	const VectorRegister TranslatedVec = VectorAdd(RotatedVec, Translation);

	FVector Result;
	VectorStoreFloat3(TranslatedVec, &Result);
	return Result;
}

I’m still fairly new to the engine so this difference was a little confusing to me, and honestly feels like it should be the other way around, with TransformVector being the more general and TransformPosition maybe only applying to translation.

Can anyone tell me the reason (if there is one) behind this semantic difference?
Thanks!