XMVectorClamp

Clamps the components of a vector to a specified minimum and maximum range.

Syntax

XMVECTOR XMVectorClamp(
         XMVECTOR V,
         XMVECTOR Min,
         XMVECTOR Max
)  

Parameters

V
Type: XMVECTOR 

Vector whose components are to be clamped.

Min
Type: XMVECTOR 

Minimum range vector.

Max
Type: XMVECTOR 

Maximum range vector.

Return value

Type: XMVECTOR 

Returns a vector whose components are clamped to the specified minimum and maximum values.

Remarks

The following pseudocode demonstrates the operation of the function:

XMVECTOR Result;

Result.x = min( max( V.x, Min.x ), Max.x );
Result.y = min( max( V.y, Min.y ), Max.y );
Result.z = min( max( V.z, Min.z ), Max.z );
Result.w = min( max( V.w, Min.w ), Max.w );

return Result;  

Requirements

Header: Declared in directxmath.h.