atan2()

Math / Trigonometry

Description

Calculates the angle formed by a point relative to the positive x-axis. More useful than atan for full-circle angles.

Syntax

float atan2(float y, float x)

Parameters

NameTypeDescription
yfloaty-coordinate
xfloatx-coordinate

Returns

float

Related

Under the Hood

From Processing.h:

float heading() const { return std::atan2(y, x); static float atan2(float y, float x) { return std::atan2(y,x); } static float atan2(float y, float x) { return std::atan2(y,x);