29 lines
735 B
C++
29 lines
735 B
C++
|
|
#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;
|
|
};
|
|
|
|
struct CartesianPos {
|
|
double x;
|
|
double y;
|
|
double z;
|
|
};
|
|
|
|
/// 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
|
|
|
|
#endif // COORDINATES_H
|