WorksheetFunction.Atan2 Method
Returns the arctangent, or inverse tangent, of the specified x- and y-coordinates. The arctangent is the angle from the x-axis to a line containing the origin (0, 0) and a point with coordinates (x_num, y_num). The angle is given in radians between -pi and pi, excluding -pi.
Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
Syntax
'Declaration
Function Atan2 ( _
Arg1 As Double, _
Arg2 As Double _
) As Double
'Usage
Dim instance As WorksheetFunction
Dim Arg1 As Double
Dim Arg2 As Double
Dim returnValue As Double
returnValue = instance.Atan2(Arg1, Arg2)
double Atan2(
double Arg1,
double Arg2
)
Parameters
Arg1
Type: System.DoubleThe x-coordinate of the point.
Arg2
Type: System.DoubleThe y-coordinate of the point.
Return Value
Type: System.Double
Remarks
A positive result represents a counterclockwise angle from the x-axis; a negative result represents a clockwise angle.
Atan2(a,b) equals Atan(b/a), except that a can equal 0 in Atan2.
If both Arg1 and Arg2 are 0, Atan2 returns an error value.
To express the arctangent in degrees, multiply the result by 180/PI( ) or use the Degrees(Double) method.