Platform SDK: DirectX

CrossProduct

このヘルパー関数は、指定したベクトルの外積を返す。CrossProduct は、D3D_OVERLOADS を定義する C++ プログラマが使用できる拡張機能セットの一部である。

_D3DVECTOR CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2);

この関数は、以下のように定義される。

inline _D3DVECTOR
CrossProduct (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
    _D3DVECTOR result;
 
    result[0] = v1[1] * v2[2] - v1[2] * v2[1];
    result[1] = v1[2] * v2[0] - v1[0] * v2[2];
    result[2] = v1[0] * v2[1] - v1[1] * v2[0];
 
    return result;
}

動作環境

  Windows NT/2000 :Windows 2000 が必要。
  Windows 95/98 : Windows 95 以降が必要。Windows 95 用に再配布可能な形で使用可能。
  バージョン : DirectX 5.0 以降が必要。
  ヘッダー : d3d.h で宣言。

参照

DotProduct