[][src]Function directx_math::XMVectorClamp

pub fn XMVectorClamp(V: FXMVECTOR, Min: FXMVECTOR, Max: FXMVECTOR) -> XMVECTOR

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

Parameters

V Vector whose components are to be clamped.

Min Minimum range vector.

Max Maximum range vector.

Return value

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;

Reference

https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-XMVectorClamp