This commit is contained in:
Dominik Demuth
2026-03-08 15:33:56 +01:00
parent 072e211e90
commit 5acbaaa5f8
14 changed files with 157 additions and 27 deletions

View File

@@ -2,7 +2,10 @@
#ifndef COORDINATES_H
#define COORDINATES_H
/// Coordinate types and rotations for molecular orientations on the unit sphere.
namespace coordinates {
/// Spherical position stored as (cos_theta, phi) to avoid repeated cos/acos.
struct SphericalPos {
double cos_theta;
double phi;
@@ -14,7 +17,10 @@ struct CartesianPos {
double z;
};
SphericalPos rotate(const SphericalPos &, double, double);
/// Rotate a spherical position by polar angle alpha around an axis defined
/// by azimuthal angle beta (rotation about the original position's z-axis).
SphericalPos rotate(const SphericalPos &, double alpha, double beta);
CartesianPos spherical_to_xyz(const SphericalPos &);
SphericalPos xyz_to_spherical(const CartesianPos &);
} // namespace coordinates