Name

polar function template — Converts to polar coordinates

Synopsis

template<typename T>
complex<T> polar(const T& r, const T& theta)

The polar function returns a complex object that represents the value given in polar coordinates, in which r is the magnitude and theta is the angle (in radians). The resulting value has the following real and imaginary parts:

real = r * cos(theta)
imag = r * sin(theta)

Get C++ In a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.