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:
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