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

◆ from_semipolar

kyosu::from_semipolar = eve::functor<from_semipolar_t>
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.

Header file

#include kyosu/module/quaternion.hpp>`

Callable Signatures

namespace kyosu
{
auto from_semipolar(auto rho, auto alpha, auto theta1, auto theta2) const noexcept;
}
constexpr auto from_semipolar
Callable object computing a quaternion from its semipolar representation.
Definition: from_semipolar.hpp:70
Main KYOSU namespace.
Definition: cinf.hpp:13

Parameters

  • r, alpha, theta1, theta2

Return value

the quaternion value.

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
auto rho = 2.0;
auto alpha = eve::pio_3(eve::as(rho));
auto theta1 = eve::pio_4(eve::as(rho));
auto theta2 = eve::pio_2(eve::as(rho));
std::cout << " <- rho " << rho << std::endl;
std::cout << " <- alpha " << alpha<< std::endl;
std::cout << " <- theta1 " << theta1<< std::endl;
std::cout << " <- theta2 " << theta2<< std::endl;
std::cout << " -> " << from_semipolar(rho, alpha, theta1, theta2) << "\n";
return 0;
}