microsoft / DirectXMath

DirectXMath is an all inline SIMD C++ linear algebra library for use in games and graphics apps
https://walbourn.github.io/introducing-directxmath/
MIT License
1.52k stars 234 forks source link

XMQuaternionSquad param name and doc needs clarification #117

Closed alek314 closed 3 years ago

alek314 commented 3 years ago

Hi! Currently, the signature of XMQuaternionSquad is: XMQuaternionSquad( FXMVECTOR Q0, FXMVECTOR Q1, FXMVECTOR Q2, GXMVECTOR Q3, float t) which is misleading because acording to https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dxquaternionsquad, the param list should be ( FXMVECTOR Q1, FXMVECTOR A, FXMVECTOR B, GXMVECTOR C, float t)

Here is my test case , a modified version from https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dxquaternionsquadsetup:

XMVECTOR Q0 = XMVectorSet(0,  0, 0.707f, -.707f);
XMVECTOR Q1 = XMVectorSet(0,  0, 0.000f, 1.000f);
XMVECTOR Q2 = XMVectorSet(0,  0, 0.707f, 0.707f);
XMVECTOR Q3 = XMVectorSet(0,  0, 1.000f, 0.000f);
XMVECTOR A, B, C;
XMQuaternionSquadSetup(&A, &B, &C, Q0, Q1, Q2, Q3);
XMVECTOR result = XMQuaternionSquad(Q1, A, B, C, 0.5);
XMVECTOR axis;
float angle;
XMQuaternionToAxisAngle(&axis, &angle, result);

which is 45 degree rotation around z axis

P.S. Please consider adding a sample like above to the doc, should be helpful to others. Thank you!

walbourn commented 3 years ago

Thanks for the suggestion. Filed a PR.

Note you can submit PRs to Microsoft Docs directly if you want.