Table of Contents

Class Atan2

Namespace
YndigoBlue.Velocity.Functions
Assembly
YndigoBlue.Velocity.dll

Represents the ATAN2 two-argument arctangent function that calculates the angle between the positive x-axis and a point.

public class Atan2 : Function, ICheckItem, IDefaultItem, IFilterItem, IElement
Inheritance
Atan2
Implements

Remarks

The ATAN2 function calculates the arctangent of y/x, but uses the signs of both arguments to determine the quadrant of the result. Unlike ATAN, ATAN2 returns angles in the full range from -pi to pi radians, correctly handling all four quadrants. This is particularly useful for converting Cartesian coordinates to polar coordinates, calculating bearings, and determining angles in geometric calculations.

Examples

Calculate the bearing angle from Y and X coordinate components:

var schema = manager.LoadSchema("vectors");
var components = schema["components"];

var query = new Query()
    .Select([ components["id"], new Expression("bearing", new Atan2(components["y"], components["x"])) ])
    .From(components);

var results = manager.Retrieve(query);

Constructors

Atan2(IElement, IElement)

Initializes a new instance of ATAN2 with generic element-based y and x coordinates.

Atan2(Column, double)

Initializes a new instance of ATAN2 with a column y-coordinate and literal x-coordinate.

Atan2(Column, Column)

Initializes a new instance of ATAN2 with column-based y and x coordinates.

Atan2(Expression, double)

Initializes a new instance of ATAN2 with an expression y-coordinate and literal x-coordinate.