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

◆ from_semipolar

kyosu::from_semipolar = {}
inlineconstexpr

Callable object computing a quaternion from its semipolar representation.

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

from_semipolar 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.

Defined in header

#include kyosu/module/quaternion.hpp>`

Callable Signatures

namespace kyosu
{
auto from_semipolar(auto r, auto angle, auto h1, auto h2) const noexcept;
}
constexpr tags::callable_from_semipolar from_semipolar
Callable object computing a quaternion from its semipolar representation.
Definition: from_semipolar.hpp:96
Main KYOSU namespace.
Definition: types.hpp:14

Parameters

  • r, angle,h1,h2`

Return value

the quaternion value.

Example

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