Microsoft DirectX 8.1 (Visual Basic)

D3DX8.ComputeBoundingBoxFromMesh

Computes a bounding box from a mesh.

object.ComputeBoundingBoxFromMesh( _ 
    MeshIn As D3DXMesh, _ 
    MinArray As D3DVECTOR, _ 
    MaxArray As D3DVECTOR)

Parts

object
Object expression that resolves to a D3DX8 object.
MeshIn
D3DXMesh object, representing the input mesh.
MinArray
D3DVECTOR type, describing the returned lower-left corner of the bounding box. See Remarks.
MaxArray
D3DVECTOR type, describing the returned upper-right corner of the bounding box. See Remarks.

Error Codes

If the method fails, an error is raised and Err.Number can be set to D3DERR_INVALIDCALL.

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

The D3DVECTOR values returned by ComputeBoundingBoxFromMesh 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

See Also

D3DX8.ComputeBoundingBox