Callable object computing a quaternion from its to_rotation_matrix representation.
This function build rotation_matrix angles from a quaternion. Template parameters I, J, K of type int are used to choose the rotation_matrix 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>`
namespace eve
{
}
constexpr tags::callable_to_rotation_matrix to_rotation_matrix
Callable object computing a quaternion from its to_rotation_matrix representation.
Definition: to_rotation_matrix.hpp:115
Parameters
q
quaternion representing the rotation
assume_normalized
: suppose that q is already normalized
Return value
compute the rotation matrix associated to the quaternion.
if T is the element type of q, returns an std::array<std::array<T, 3>, 3> containing the 9 coefficients of the rotation matrix
- Note
- use this function if you really need the rotation matrix, but to rotate vectors prefer the function rot_vec that directly uses the quaternion.
#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
std::cout << "Quaternion: "<< "\n";
q_t q0(1, 5, 2, 3);
std::cout << "q0 = " << q0 << std::endl;
std::cout << "to_rotation_matrix(q0) = \n";
{
std::cout << " ";
for(int j=0; j < 2 ; ++j)
{
std::cout << m[
i][j] <<
", ";
}
std::cout << m[
i][2] <<
"\n";
}
return 0;
}
constexpr tags::callable_i i
Computes the complex number cinf i.e. complex(nan, inf) in the chosen type.
Definition: i.hpp:77
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