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

◆ to_angle_axis

kyosu::to_angle_axis = eve::functor<to_angle_axis_t>
inlineconstexpr

Callable object computing the angle and axis coordinates from a quaternion.

This function is the reciprocal of from_angle_axis

Header file

#include kyosu/quaternion.hpp>`

Callable Signatures

namespace eve
{
auto to_angle_axis(auto q) const noexcept;
}
constexpr auto to_angle_axis
Callable object computing the angle and axis coordinates from a quaternion.
Definition: to_angle_axis.hpp:74

Parameters

q: quaternion

Return value

a tuple an angle of rotation and a vector of \(\mathbb{R}^3\) representing the direction of the rotation axis.

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using e_t = float;
std::cout << "Real: "<< "\n";
e_t e0(1);
auto [ae, axe] = to_angle_axis(e0);
std::cout << e0 << " -> " << ae << ", (" << axe[0] << ", " << axe[1] << ", " << axe[2] << ") " "\n";
std::cout << "Complex: "<< "\n";
c_t c0(1, 5);
auto [ac, axc] = to_angle_axis(c0);
std::cout << c0 << " -> " << ac << ", (" << axc[0] << ", " << axc[1] << ", " << axc[2] << ") " "\n";
std::cout << "Quaternion: "<< "\n";
q_t q0(1, 5, 2, 3);
auto [aq, axq] = to_angle_axis(q0);
std::cout << q0 << " -> " << aq << ", (" << axq[0] << ", " << axq[1] << ", " << axq[2] << ") " "\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