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

◆ rot_axis

kyosu::rot_axis = {}
inlineconstexpr

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

Defined in header

#include eve/module/quaternion.hpp>`

Callable Signatures

namespace eve
{
auto rot_axis(auto q) const noexcept;
}
constexpr tags::callable_rot_axis rot_axis
Callable object computing the normalized axis of rotation defined by a quaternion.
Definition: rot_axis.hpp:82

Parameters

q: quaternion, complex or floating.

Return value

a span containing the three coordinates of the axis if the quaternion is zero {1, 0, 0} is returned


Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
std::cout << "Real: ";
auto v = rot_axis(kyosu::complex_t<float>(3.5f,-2.9f));
std::cout << 72.9f << " -> (" << v[0] << ", " << v[1] << ", " << v[2] << ")\n";
std::cout << "Complex: ";
auto vc = rot_axis(kyosu::complex_t<float>(3.5f,-2.9f));
std::cout << kyosu::complex_t<float>(3.5f,-2.9f) << " -> (" << vc[0] << ", " << vc[1] << ", " << vc[2] << ")\n";
std::cout << "Quaternion: ";
auto vq = rot_axis(kyosu::quaternion_t<double>(1.,2.,3.,4.));
std::cout << kyosu::quaternion_t<double>(1.,2.,3.,4.) << " -> " << vq[0] << ", " << vq[1] << ", " << vq[2] << ")\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