Microsoft DirectX 8.1 (C++)

D3DXComputeBoundingBox

Computes a bounding box.

HRESULT D3DXComputeBoundingBox(
  PVOID pPointsFVF,
  DWORD NumVertices,
  DWORD FVF,
  D3DXVECTOR3* pMin,
  D3DXVECTOR3* pMax
);

Parameters

pPointsFVF
[in] Pointer to a buffer containing the vertex data around which to calculate the bounding box.
NumVertices
[in] Number of vertices.
FVF
[in] Combination of Flexible Vertex Format Flags that describes the vertex format.
pMin
[out] Pointer to a D3DXVECTOR3 structure, describing the returned lower-left corner of the bounding box. See remarks.
pMax
[out] Pointer to a D3DXVECTOR3 structure, describing the returned upper-right corner of the bounding box. See remarks.

Return Values

If the function succeeds, the return value is D3D_OK.

If the function fails, the return value can be one D3DERR_INVALIDCALL.

Remarks

The D3DXVECTOR3 values returned by D3DXComputeBoundingBox are xmin, xmax, ymin, ymax, zmin, and zmax. Thus, the following defines the corners of the bounding box.

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

The depth of the bounding box in the z direction is zmax - zmin, in the y direction is ymax - ymin, and in the x direction is xmax - xmin. For example, with the following minimum and maximum vectors, min (-1, -1, -1) and max (1, 1, 1), the bounding box is defined in the following manner.

 1,  1,  1
 1,  1, -1
 1, -1,  1
 1, -1, -1
-1,  1,  1
-1,  1, -1
-1, -1,  1
-1, -1, -1

Requirements

  Header: Declared in D3dx8mesh.h.
  Import Library: Use D3dx8.lib.