DirectX Math function confusion

2019-05-22 20:03发布

While I was going over some older DirectX code, I came by the functions D3DXVec3Transform and D3DXVec3TransformCoord. Upon looking up the descriptions for them, they seemed rather similar but I don't see what the difference between the two are. Can someone please explain what is the difference between D3DXVec3Transform and D3DXVec3TransformCoord are, along with the math behind them?

1条回答
Summer. ? 凉城
2楼-- · 2019-05-22 20:43

When you transform a 3D vector by matrix it results in a 4D vector where w!=1

a 3D vector can be described as 4D vector where w=1.

D3DXVec3Transform returns the 4D vector where w!=1. D3DXVec3TransformCoord gets the 4D vector and the projects it onto w=1 to make it 3D vector.

EDIT: And here is the paper I google'd and found if interested in how to do the transformation: http://www.heldermann-verlag.de/jgg/jgg01_05/jgg0404.pdf

查看更多
登录 后发表回答