Callable object computing a quaternion from its angle_axis representation.
This function build an unitary quaternion from an angle value and a 3 dimensionnal axis vector
An unitary quaternion value representing a rotation that align v0 to v1.
#include <kyosu/kyosu.hpp>
#include <eve/wide.hpp>
#include <iostream>
int main()
{
auto norm = [](auto &v){
auto n = eve::hypot(v[0], v[1], v[2]);
for(
int i=0;
i <= 2; ++
i) v[
i]/= n;
};
std::array<double, 3> v0{-1.0, 5.0, 4.0};
std::array<double, 3> v1{ 1.5, 2.0, -3.0};
norm(v0);
norm(v1);
std::cout << " v0 " << v0[0] << ", " << v0[1] << ", " << v0[2] << "\n";
std::cout << " v1 " << v1[0] << ", " << v1[1] << ", " << v1[2] << "\n";
std::cout << " q " << q << std::endl;
std::cout << " rotate_vec(q, v0) " << rv[0] << ", " << rv[1] << ", " << rv[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
constexpr tags::callable_rotate_vec rotate_vec
Callable object rotating an vector using a quaternion.
Definition: rotate_vec.hpp:105