kyosu v0.1.0
Complex Without Complexes
 
Loading...
Searching...
No Matches

◆ from_cylindrical

kyosu::from_cylindrical = eve::functor<from_cylindrical_t>
inlineconstexpr

Callable object computing a quaternion from its cylindrical representation.

This function build quaternions in a way similar to the way polar builds complex numbers from a cylindrical representation of an \(\mathbb{R}^2\) element.

from_cylindrical first two inputs are the polar coordinates of the first \(\mathbb{C}\) component of the quaternion. The third and fourth inputs are placed into the third and fourth \(\mathbb{R}\) components of the quaternion, respectively.

Header file

#include kyosu/module/quaternion.hpp>`

Callable Signatures

namespace kyosu
{
auto from_cylindrical(auto r, auto angle, auto h1, auto h2) const noexcept;
}
constexpr auto from_cylindrical
Callable object computing a quaternion from its cylindrical representation.
Definition: from_cylindrical.hpp:73
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • r, angle, h1, h2

Return value

the quaternion value.

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
auto r = 2.0;
auto a = eve::pio_3(eve::as(r));
auto h1 = 3.0;
auto h2 = 4.0;
std::cout << " <- modulus " << r << std::endl;
std::cout << " <- angle " << a << std::endl;
std::cout << " <- h1 " << h1<< std::endl;
std::cout << " <- h2 " << h2<< std::endl;
std::cout << " -> " << from_cylindrical(r, a, h1, h2) << "\n";
return 0;
}
as_cayley_dickson_n_t< 4, T > quaternion_t
Type alias for quaternion numbers.
Definition: quaternion.hpp:24
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition: complex.hpp:27