30 const auto coshEta = std::cosh(eta);
31 const auto tanhEta = std::tanh(eta);
33 std::cos(phi) / coshEta,
34 std::sin(phi) / coshEta,
50 const auto cosTheta = std::cos(theta);
51 const auto sinTheta = std::sin(theta);
53 std::cos(phi) * sinTheta,
54 std::sin(phi) * sinTheta,
66 template <
typename InputVector>
68 const Eigen::MatrixBase<InputVector>& direction) {
69 EIGEN_STATIC_ASSERT_FIXED_SIZE(InputVector);
70 EIGEN_STATIC_ASSERT_VECTOR_ONLY(InputVector);
71 static_assert(3 <= InputVector::RowsAtCompileTime,
72 "Direction vector must be at least three-dimensional.");
74 using OutputVector =
typename InputVector::PlainObject;
75 using OutputScalar =
typename InputVector::Scalar;
77 OutputVector unitU = OutputVector::Zero();
79 unitU[0] = -direction[1];
80 unitU[1] = direction[0];
81 const auto scale = unitU.template head<2>().
norm();
90 unitU.template head<2>() /=
scale;
108 template <
typename InputVector>
110 const Eigen::MatrixBase<InputVector>& direction) {
111 EIGEN_STATIC_ASSERT_FIXED_SIZE(InputVector);
112 EIGEN_STATIC_ASSERT_VECTOR_ONLY(InputVector);
113 static_assert(3 <= InputVector::RowsAtCompileTime,
114 "Direction vector must be at least three-dimensional.");
116 using OutputVector =
typename InputVector::PlainObject;
118 std::pair<OutputVector, OutputVector> unitVectors;
120 unitVectors.second = direction.cross(unitVectors.first);
121 unitVectors.second.normalize();