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

◆ from_semipolar

auto 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;
auto from_semipolar[radpi](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:72
Main KYOSU namespace.
Definition cinf.hpp:13

Parameters

  • r, alpha, theta1, theta2

Return value

  • the quaternion value.
  • If radpi is used alpha, theta1 and theta2must be given in \(\pi\) multiples else in radian.

Example

#include <eve/wide.hpp>
#include <iostream>
#include <kyosu/kyosu.hpp>
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;
}