Open
Description
Sometimes I need to project a vector on another vector, as described here. It seems that DirectXMath does not offer a function to do this out of the box which is why I came up with the following implementation:
inline XMVECTOR ProjectVectorToVector(XMVECTOR v1, XMVECTOR v2)
{
return XMVectorMultiply(XMVectorDivide(XMVector3Dot(v1, v2), XMVector3Dot(v2, v2)), v2);
}
Admittedly, such a function isn't hard to implement but to me, it seems like such a common geometric operation that I think it makes sense to add this to DirectXMath itself.