47 bool reverse =
false) {
52 {e_x[0], e_x[1], e_x[2]},
53 {e_y[0], e_y[1], e_y[2]},
59 return M.inversed() * v;
71 auto const r = std::sqrt(pos[0] * pos[0] + pos[1] * pos[1]);
72 auto const phi = std::atan2(pos[1], pos[0]);
73 return {r, phi, pos[2]};
94 assert(std::abs(axis * orientation) <
95 5 * std::numeric_limits<double>::epsilon());
97 auto const pos_t =
basis_change(orientation, rotation_axis, axis, pos);
110 auto const &rho = pos[0];
111 auto const &phi = pos[1];
112 auto const &z = pos[2];
113 return {rho * std::cos(phi), rho * std::sin(phi), z};
134 assert(std::abs(axis * orientation) <
135 5 * std::numeric_limits<double>::epsilon());
138 return basis_change(orientation, rotation_axis, axis, pos_t,
true);
150 static auto const z_axis =
Vector3d{{0, 0, 1}};
153 auto const rotated_pos =
vec_rotate(rotation_axis, angle, pos);
154 auto const rotated_vec =
vec_rotate(rotation_axis, angle, vec);
155 auto const r = std::sqrt(rotated_pos[0] * rotated_pos[0] +
156 rotated_pos[1] * rotated_pos[1]);
159 (rotated_pos[0] * rotated_vec[0] + rotated_pos[1] * rotated_vec[1]) / r;
162 (rotated_pos[0] * rotated_vec[1] - rotated_pos[1] * rotated_vec[0]) / r;
163 return Vector3d{v_r, v_phi, rotated_vec[2]};
Vector implementation and trait types for boost qvm interoperability.
Vector normalized() const
Matrix implementation and trait types for boost qvm interoperability.
Vector< T, 3 > vector_product(Vector< T, 3 > const &a, Vector< T, 3 > const &b)
Vector3d vec_rotate(const Vector3d &axis, double angle, const Vector3d &vector)
Rotate a vector around an axis.
double angle_between(Vector3d const &v1, Vector3d const &v2)
Determine the angle between two vectors.
Vector3d transform_vector_cartesian_to_cylinder(Vector3d const &vec, Vector3d const &axis, Vector3d const &pos)
Vector transformation from Cartesian to cylindrical coordinates.
Vector3d transform_coordinate_cylinder_to_cartesian(Vector3d const &pos)
Coordinate transformation from cylindrical to Cartesian coordinates.
Vector3d transform_coordinate_cartesian_to_cylinder(Vector3d const &pos)
Coordinate transformation from Cartesian to cylindrical coordinates.
Vector3d basis_change(Vector3d const &b1, Vector3d const &b2, Vector3d const &b3, Vector3d const &v, bool reverse=false)
Basis change.
Matrix representation with static size.
Matrix< T, Cols, Rows > transposed() const
Retrieve a transposed copy of the matrix.