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

◆ rot_angle

kyosu::rot_angle = {}
inlineconstexpr

Callable object computing the normalized angle of rotation defined by a quaternion.

Defined in header

#include eve/module/quaternion.hpp>`

Callable Signatures

namespace eve
{
auto rot_angle(auto q) const noexcept;
}
constexpr tags::callable_rot_angle rot_angle
Callable object computing the normalized angle of rotation defined by a quaternion.
Definition: rot_angle.hpp:81

Parameters

q: quaternion, complex or floating

Return value

the rotation angle in radian. This is two times the arg of the quaternion.


Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
std::cout << "Real: ";
std::cout << 72.9f << " -> " << rot_angle(72.9f) << "\n";
std::cout << "Complex: ";
std::cout << kyosu::complex_t<float>(3.5f,-2.9f) << " -> " << rot_angle(kyosu::complex_t<float>(3.5f,-2.9f)) << "\n";
std::cout << "Quaternion: ";
std::cout << kyosu::quaternion_t<double>(1.,2.,3.,4.) << " -> " << rot_angle(kyosu::quaternion_t<double>(1.,2.,3.,4.)) << "\n";
std::cout << "SIMD: ";
using wc_t = eve::wide<kyosu::complex_t<double>, eve::fixed<2>>;
std::cout << wc_t(kyosu::complex_t<double>(1.3,-3.7)) << " -> " << rot_angle(wc_t(kyosu::complex_t<double>(1.3,-3.7))) << "\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