tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
polar.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_COMPLEX_POLAR_HPP
4#define TETL_COMPLEX_POLAR_HPP
5
6#include <etl/_cmath/cos.hpp>
7#include <etl/_cmath/sin.hpp>
9
10namespace etl {
11
13template <typename T>
14[[nodiscard]] constexpr auto polar(T const& r, T const& theta = T()) noexcept -> etl::complex<T>
15{
16 return etl::complex<T>{r * etl::cos(theta), r * etl::sin(theta)};
17}
18
19} // namespace etl
20
21#endif // TETL_COMPLEX_POLAR_HPP
constexpr auto cos(float arg) noexcept -> float
Computes the cosine of arg (measured in radians).
Definition cos.hpp:44
constexpr auto sin(float arg) noexcept -> float
Computes the sine of arg (measured in radians).
Definition sin.hpp:44
constexpr auto polar(T const &r, T const &theta=T()) noexcept -> etl::complex< T >
Definition polar.hpp:14
Definition adjacent_find.hpp:8
A complex number.
Definition complex.hpp:19