问题描述
在我浏览一些旧的DirectX代码时,我来自函数D3DXVec3Transform和D3DXVec3TransformCoord。在查找他们的描述时,他们看起来很相似,但我看不出两者之间的区别。有人可以解释D3DXVec3Transform和D3DXVec3TransformCoord之间的区别是什么,以及它们的数学?
3D向量通过矩阵得到其中w = 1的4D向量。3D向量可以被描述为其中w = 1的4D向量。
D3DXVec3Transform返回4D向量,其中w!= 1。
D3DXVec3TransformCoord得到的4D矢量和项目到w = 1,使其成为3D矢量。
编辑:这里是我google'd的文件发现如果有兴趣如何做转型:
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?
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
这篇关于DirectX数学函数混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!