Math.Atan2(Y, X)

.Atan2() method returns the angle (in radians) formed by grid coordinates (x, y), (0, 0), and (x, 0).

Applies To

Properties and Methods

None

Available

The .Atan2(Y,X) method is available in:

  • 15.03.016
  • All newer builds

Type

Decimal

Syntax

Math.Atan2(Y,X);

Parameters

Parameter

Required

Description

Y

Yes

The Y coordinate of the point

Any values that are not a number will result in a scripting error.

X

Yes

The X coordinate of the point

Any values that are not a number will result in a scripting error.

Example

var lcMath = 'Math.Atan2(1, 1): ' + Convert.ToString(Math.Atan2(1, 1)) + '\n';

lcMath += 'Math.Atan2(1, 2): ' + Convert.ToString(Math.Atan2(1, 2)) + '\n';

lcMath += 'Math.Atan2(2, 1): ' + Convert.ToString(Math.Atan2(2, 1)) + '\n';

lcMath += 'Math.Atan2(1, 4): ' + Convert.ToString(Math.Atan2(1, 4)) + '\n';

lcMath += 'Math.Atan2(4, 1): ' + Convert.ToString(Math.Atan2(4, 1));

Event.Form.MessageBox(lcMath);

 

/* Expected Prompt Result:

Math.Atan2(1, 1): 0.785398163397448

Math.Atan2(1, 2): 0.463647609000806

Math.Atan2(2, 1): 1.10714871779409

Math.Atan2(1, 4): 0.244978663126864

Math.Atan2(4, 1): 1.32581766366803

*/