19#ifndef UTILS_COORDINATE_TRANSFORMATION_HPP
20#define UTILS_COORDINATE_TRANSFORMATION_HPP
49 bool reverse =
false) {
54 {e_x[0], e_x[1], e_x[2]},
55 {e_y[0], e_y[1], e_y[2]},
61 return M.inversed() * v;
73 auto const r = std::sqrt(
pos[0] *
pos[0] +
pos[1] *
pos[1]);
74 auto const phi = std::atan2(
pos[1],
pos[0]);
75 return {r, phi,
pos[2]};
96 assert(std::abs(axis * orientation) <
97 5 * std::numeric_limits<double>::epsilon());
112 auto const &rho =
pos[0];
113 auto const &phi =
pos[1];
114 auto const &z =
pos[2];
115 return {rho * std::cos(phi), rho * std::sin(phi), z};
136 assert(std::abs(axis * orientation) <
137 5 * std::numeric_limits<double>::epsilon());
140 return basis_change(orientation, rotation_axis, axis, pos_t,
true);
152 static auto const z_axis =
Vector3d{{0, 0, 1}};
155 auto const rotated_pos =
vec_rotate(rotation_axis, angle,
pos);
156 auto const rotated_vec =
vec_rotate(rotation_axis, angle, vec);
157 auto const r = std::sqrt(rotated_pos[0] * rotated_pos[0] +
158 rotated_pos[1] * rotated_pos[1]);
161 (rotated_pos[0] * rotated_vec[0] + rotated_pos[1] * rotated_vec[1]) / r;
164 (rotated_pos[0] * rotated_vec[1] - rotated_pos[1] * rotated_vec[0]) / r;
165 return Vector3d{v_r, v_phi, rotated_vec[2]};
Vector implementation and trait types for boost qvm interoperability.
__shared__ int pos[MAXDEPTH *THREADS5/WARPSIZE]
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.
Quaternion implementation and trait types for boost qvm interoperability.
Matrix representation with static size.
Matrix< T, Cols, Rows > transposed() const
Retrieve a transposed copy of the matrix.