Vector2.Ccw(Vector2,Vector2) Method (Microsoft.DirectX)

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


Visual Basic Public Shared Function Ccw( _
    ByVal left As Vector2, _
    ByVal right As Vector2 _
) As Single
C# public static float Ccw(
    Vector2 left,
    Vector2 right
C++ public:
static float Ccw(
    Vector2 left,
    Vector2 right
JScript public static function Ccw(
    left : Vector2,
    right : Vector2
) : float;


left Microsoft.DirectX.Vector2
Source Vector2 structure.
right Microsoft.DirectX.Vector2
Source Vector2 structure.

Return Value

The z component.


This method determines the z component by calculating the cross product based on the following formula.

((x1,y1,0) cross (x2,y2,0))

The following C# code fragment provides an example.

left->x * right->y - left->y * right->x

If the z component's value is positive, the vector right is counterclockwise from the vector left. This information is useful for back-face culling.