D3DXBoxBoundProbe 函式

判斷光線是否與方塊周框方塊的磁片區交集。

語法

BOOL D3DXBoxBoundProbe(
  _In_ const D3DXVECTOR3 *pMin,
  _In_ const D3DXVECTOR3 *pMax,
  _In_ const D3DXVECTOR3 *pRayPosition,
  _In_ const D3DXVECTOR3 *pRayDirection
);

參數

pMin [in]

類型:const D3DXVECTOR3*

D3DXVECTOR3結構的指標,描述周框方塊左下角。 請參閱<備註>。

pMax [in]

類型:const D3DXVECTOR3*

D3DXVECTOR3結構的指標,描述周框方塊的右上角。 請參閱<備註>。

pRayPosition [in]

類型:const D3DXVECTOR3*

D3DXVECTOR3結構的指標,指定光線的原點座標。

pRayDirection [in]

類型:const D3DXVECTOR3*

D3DXVECTOR3結構的指標,指定光線的方向。 此向量不應該 (0,0,0) ,但不需要正規化。

傳回值

類型: BOOL

如果光線與方塊周框方塊的磁片區交集,則會傳回 TRUE 。 否則會傳回 FALSE

備註

D3DXboxBoundProbe 會判斷光線是否與方塊周框方塊的磁片區交集,而不只是方塊的表面。

傳遞至 D3DXboxBoundProbe 的值是 xmin、xmax、ymin、ymax、zmin 和 zmax。 因此,下列會定義周框方塊的角落。

xmax, ymax, zmax
xmax, ymax, zmin
xmax, ymin, zmax
xmax, ymin, zmin
xmin, ymax, zmax
xmin, ymax, zmin
xmin, ymin, zmax
xmin, ymin, zmin

z 方向周框方塊的深度為 zmax - zmin,y 方向為 ymax - ymin,而 x 方向為 xmax - xmin。 例如,使用下列最小和最大向量、min (-1、-1、-1) 和 max (1、1、1) ,周框方塊會以下列方式定義。

 1,  1,  1
 1,  1, -1
 1, -1,  1
 1, -1, -1
-1,  1,  1
-1,  1, -1
-1, -1,  1
-1, -1, -l

規格需求

需求
標頭
D3DX9Mesh.h
程式庫
D3dx9.lib

另請參閱

網格函數

D3DXComputeBoundingBox