8namespace net_axis_rotation
12inline std::array<double, 9> RotationWithAxisZ(
const double axis[3])
14 const double helper[3] = {std::fabs(axis[0]) < 0.9 ? 1.0 : 0.0, std::fabs(axis[0]) < 0.9 ? 0.0 : 1.0, 0.0};
15 double first[3] = {helper[1] * axis[2] - helper[2] * axis[1], helper[2] * axis[0] - helper[0] * axis[2], helper[0] * axis[1] - helper[1] * axis[0]};
16 const double norm = std::sqrt(first[0] * first[0] + first[1] * first[1] + first[2] * first[2]);
17 for (
double& component : first)
19 const double second[3] = {axis[1] * first[2] - axis[2] * first[1], axis[2] * first[0] - axis[0] * first[2], axis[0] * first[1] - axis[1] * first[0]};
20 return {first[0], first[1], first[2], second[0], second[1], second[2], axis[0], axis[1], axis[2]};