posts - 25,  comments - 21,  trackbacks - 0
D3DXVec3TransformCoord 对向量进行变换,没啥好说明的,默认向量为行向量,矩阵为列矩阵。
D3DXVec3TransformNormal 这个家伙对法线进行变换,其实就是对于方向性的向量进行变换,在计算中经常用来变换方向,“D3DXVec3TransformNormal transforms a normal using the transpose of the inverse of the given matrix”,他对向量进行变换时,会使用您提供的参数矩阵,先进行逆矩阵计算,再进行转置,然后变换向量,结果就是你想要的。

问题就在于,dx sdk的文档这么写“If you want to transform a normal, the matrix you pass to this function should be the transpose of the inverse of the matrix you would use to transform a point.”它原话的意思是你要提供一个逆矩阵再转置后的矩阵,唉,dx sdk误导人啊。在此记录一下,希望搜索到这里的人不要再浪费时间去琢磨这个问题,呵呵。
posted on 2008-09-02 10:22 Sherk 阅读(988) 评论(2)  编辑 收藏 引用

FeedBack:
# re: D3DXVec3TransformNormal and D3DXVec3TransformCoord
2008-09-02 10:27 | Sherk
另外可能有些新人问,为啥变换坐标时w时1.0,变换方向变量时w使用0.0f,这个其实你只有自己手工做个矩阵计算就很容易明白,当w时1.0f时,变换时乘的时候保留了矩阵最后一行的tanslation,而0.0时translation就清零了。  回复  更多评论
  
# re: D3DXVec3TransformNormal and D3DXVec3TransformCoord
2012-06-08 10:52 | 123
D3DXVec3TransformNormal
微软的用法说明没错,楼主在误导人。  回复  更多评论
  
只有注册用户登录后才能发表评论。
<2008年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿(3)

随笔档案

相册

好友

搜索

  •  

最新评论

阅读排行榜

评论排行榜