DirectX9.0常用向量函数

1.计算向量的长度

D3DXVec3Length

FLOAT D3DXVec3Length(CONST D3DXVECTOR3 * pV );

2.单位向量

D3DXVec3Normalize

D3DXVECTOR3 * D3DXVec3Normalize(
  D3DXVECTOR3 *pOut,
  CONST D3DXVECTOR3 *pV
);

3.向量点乘

用来计算两个向量的夹角

D3DXVec3Dot

FLOAT D3DXVec3Dot(
  CONST D3DXVECTOR3 * pV1,
  CONST D3DXVECTOR3 * pV2
);

4.向量叉积

求与两向量同时垂直的第三个向量

D3DXVec3Cross

D3DXVECTOR3 * D3DXVec3Cross(
  D3DXVECTOR3 * pOut,
  CONST D3DXVECTOR3 * pV1,
  CONST D3DXVECTOR3 * pV2
);

 

以上只列举了四个常用向量的计算方法

代码可见

http://download.csdn.net/source/1771603

你可能感兴趣的:(DirectX9.0常用向量函数)