DirectX Math function confusion

狂风中的少年 提交于 2019-12-08 08:24:24

问题


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



来源:https://stackoverflow.com/questions/8650570/directx-math-function-confusion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!