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

◆ from_euler

kyosu::from_euler = eve::functor<from_euler_t>
inlineconstexpr

Callable object computing a quaternion from its euler representation.

This function builds a quaternion from 3 euler angles in radian. Template parameters I, J, K of type int are used to choose the euler axis order.

for instance I = 3, J = 2, K = 3 choose the ZYZ sequence. the values of I, J, and K must be in {1, 2, 3} ans satisfy I != J && J != K.

Header file

#include kyosu/quaternion.hpp>`

Callable Signatures

namespace eve
{
template < int I, int J, int K > auto from_euler(auto a, auto b, auto c
, axis<I> a1, axis<J> a2, axis<K> a3
) const noexcept;
requires(I != J && J != K) //1
template < int I, int J, int K > auto from_euler[extrinsic](auto a, auto b, auto c
, axis<I> a1, axis<J> a2, axis<K> a3
) const noexcept;
requires(I != J && J != K) //1
template < int I, int J, int K > auto from_euler[intrinsic](auto a, auto b, auto c
, axis<I> a1, axis<J> a2, axis<K> a3
) const noexcept;
requires(I != J && J != K) //2
}
}
constexpr auto from_euler
Callable object computing a quaternion from its euler representation.
Definition: from_euler.hpp:122

Parameters

  • a, b, c: the angles in radian
  • a1, a2, a3 the axis parameters to be chosen between X_, Y_, Z_ (two consecutive axis cannot be the same)

Template parameters

  • I, J, K: are on call deduced from the axis parameters

Return value

  1. quaternion representing the rotation. extrinsic rotation scheme is used
  2. Same but the intrinsic way is used to interpret the angles.

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using kyosu::X_;
using kyosu::Z_;
using kyosu::Y_;
auto psi = eve::pio_3(eve::as(0.0));
auto theta= eve::pio_4(eve::as(0.0));
auto phi = eve::pio_6(eve::as(0.0));
std::cout << " <- psi " << psi << std::endl;
std::cout << " <- theta " << theta << std::endl;
std::cout << " <- phi " << phi<< std::endl;
std::cout << " -> from_euler(psi, theta, phi, X_, Z_, Y_) "
<< kyosu::from_euler(psi, theta, phi, X_, Z_, Y_) << "\n";
std::cout << " -> from_euler[intrinsic](psi, theta, phi, Y_, Z_, Y_) "
<< kyosu::from_euler[kyosu::intrinsic](psi, theta, phi, Y_, Z_, Y_) << "\n";
return 0;
}