atan2

Returns the arctangent of two values (x,y).

ret atan2(y, x)

Parameters

Item Description
y
[in] The y value.
x
[in] The x value.

Return Value

The arctangent of (y,x).

Remarks

The signs of the x and y parameters are used to determine the quadrant of the return values within the range of -π to π. The atan2 HLSL intrinsic function is well-defined for every point other than the origin, even if y equals 0 and x does not equal 0.

Type Description

Name Template Type Component Type Size
y same as input x float same dimension(s) as input x
x scalar, vector, or matrix float any
ret same as input x float same dimension(s) as input x

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 2 (DirectX HLSL) and higher shader models yes
Shader Model 1 (DirectX HLSL) vs_1_1

Requirements

Requirement Value
Header
Corecrt_math.h

See also

Intrinsic Functions (DirectX HLSL)