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// SPDX-FileCopyrightText: Copyright (C) 2023 Tobias Hienzsch
3
4#ifndef TETL_COMPLEX_POLAR_HPP
5#define TETL_COMPLEX_POLAR_HPP
6
7#include <etl/_cmath/cos.hpp>
8#include <etl/_cmath/sin.hpp>
9#include <etl/_complex/complex.hpp>
10
11namespace etl {
12
13/// \ingroup complex
14template <typename T>
15[[nodiscard]] constexpr auto polar(T const& r, T const& theta = T()) noexcept -> etl::complex<T>
16{
17 return etl::complex<T>{r * etl::cos(theta), r * etl::sin(theta)};
18}
19
20} // namespace etl
21
22#endif // TETL_COMPLEX_POLAR_HPP
constexpr auto polar(T const &r, T const &theta=T()) noexcept -> etl::complex< T >
Definition polar.hpp:15
Definition adjacent_find.hpp:9
A complex number.
Definition complex.hpp:20