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

◆ from_euler

kyosu::from_euler = {}
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.

Defined in header

#include eve/module/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
, ext e
) const noexcept;
requires(I != J && J != K)
}
constexpr tags::callable_from_euler from_euler
Callable object computing a quaternion from its euler representation.
Definition: from_euler.hpp:150

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)
  • ‘e’: allows to choose between extrinsic or intrinsic representations.

Template parameters

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

The computation method is taken from the article: "Quaternion to Euler angles conversion: A direct, general and computationally efficient method". PLoS ONE 17(11): e0276302. https://doi.org/10.1371/journal pone 0276302. Evandro Bernardes, and Stephane Viollet

Return value

quaternion representing the rotation

Example

#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
using kyosu::X_;
using kyosu::Z_;
using kyosu::extrinsic;
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_, X_, extrinsic) "
<< kyosu::from_euler(psi, theta, phi, X_, Z_, X_, extrinsic) << "\n";
return 0;
}