28template <
typename Real>
30 std::array<Real, 3> to_y_axis) {
31 static_assert(std::is_floating_point_v<Real>);
33 auto to_z_axis_mapped = Eigen::Map<Eigen::Vector3<Real>>(to_z_axis.data()).normalized();
34 auto to_y_axis_mapped = Eigen::Map<Eigen::Vector3<Real>>(to_y_axis.data()).normalized();
36 if (std::abs(to_z_axis_mapped.dot(to_y_axis_mapped)) > std::numeric_limits<Real>::epsilon()) {
37 throw std::runtime_error(
"The z-axis and the y-axis are not orhogonal.");
41 rotator << to_y_axis_mapped.cross(to_z_axis_mapped), to_y_axis_mapped, to_z_axis_mapped;
60template <
typename Real>
62 std::array<Real, 3> to_y_axis) {
63 static_assert(std::is_floating_point_v<Real>);
66 std::array<Real, 3> euler_zyz{};
67 Eigen::Map<Eigen::Vector3<Real>>(euler_zyz.data()) = rotator.eulerAngles(2, 1, 2);
Matrix< Type, 3, 3 > Matrix3
std::array< Real, 3 > get_euler_angles(std::array< Real, 3 > to_z_axis, std::array< Real, 3 > to_y_axis)
Extract the Euler angles alpha, beta, gamma.
Eigen::Matrix3< Real > get_rotation_matrix(std::array< Real, 3 > to_z_axis, std::array< Real, 3 > to_y_axis)
Build a matrix that rotates the coordinate system to the new z-axis and y-axis.