From 6528c1581d9079e50a77b45c5252817dee751eff Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Mon, 16 Mar 2020 13:59:04 +0100 Subject: [PATCH] added polar() --- complex.hh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/complex.hh b/complex.hh index b3cc5e5..50905f8 100644 --- a/complex.hh +++ b/complex.hh @@ -126,5 +126,11 @@ static constexpr T arg(Complex a) return atan2(a.imag(), a.real()); } +template +static constexpr Complex polar(T a, T b) +{ + return Complex(a * cos(b), a * sin(b)); +} + }