Inverse transformation of triangulation functions

Tweet


For functions s=sin(a) and c=cos(a), we can calculate s and c from a. How can we calculate a from s and c?

Input is s and c. These can be calculated from the definition of sin and cos, for example, from the vector which represents some kind of direction.

atan2 function solves this problem.

double atan2(double y, double x);

Giving y=s x=c, the function returns a=(from -pi to pi).

If you want the value (from 0 to 2pi) except for (from -pi to pi), then add 2pi into the return value.


Back