Microsoft DirectX 8.1 (Visual Basic)

D3DXVec2CCW

Returns the z-component by taking the cross product of two 2-D vectors.

D3DXVec2CCW( _ 
    V1 As D3DVECTOR2, _ 
    V2 As D3DVECTOR2) As Single 

Parameters

V1
A source D3DVECTOR2 type.
V2
A source D3DVECTOR2 type.

Return Values

The z-component.

Error Codes

If the function fails, an error is raised and Err.Number can be set to one of the following values.

D3DERR_INVALIDCALL
D3DERR_OUTOFVIDEOMEMORY

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

Remarks

This function determines the z-component by determining the cross-product based on the following formula: ((x1,y1,0) cross (x2,y2,0)); or as shown in the following example.

V1.x * V2.y - V1.y * V2.x

If the value of the z-component is positive, the vector V2 is counter-clockwise from the vector V1. This information is useful for back-face culling.

See Also

D3DXVec2Dot