1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
//! Constants and methods that are used to correct the
//! coordinates for the solar motion or the Local Standard of Rest
use crate::F;
/// Galactocentric distance of the Local Standard
/// of Rest around the Galactic center $\[ \text{kpc} \]$
const LSR_R: F = 8.3;
/// Galactocentric linear velocity of the Local Standard
/// of Rest around the Galactic center $\[ \text{km} \\, \text{s}^{-1} \]$
const LSR_V: F = 244.0;
/// Height of the Sun above the Galactic plane $\[ \text{kpc} \]$
const SUN_H: F = 16.0 / 1000.0;
/// The Sun’s peculiar velocity U with respect
/// to the Local Standard of Rest $\[ \text{km} \\, \text{s}^{-1} \]$
const SUN_U: F = 11.1;
/// The Sun’s peculiar velocity V with respect
/// to the Local Standard of Rest $\[ \text{km} \\, \text{s}^{-1} \]$
const SUN_V: F = 12.2;
/// The Sun’s peculiar velocity W with respect
/// to the Local Standard of Rest $\[ \text{km} \\, \text{s}^{-1} \]$
const SUN_W: F = 7.3;
/// Adds correction methods to float types
pub trait Corrections {
/// A float type. Should be the same as Self.
type Output;
/// Convert X component of the radius vector from the
/// Heliocentric Cartesian system to Galactic Cylindrical system
fn to_gca_x(&self) -> Self::Output;
/// Convert Z component of the radius vector from the
/// Heliocentric Cartesian system to Galactic Cylindrical system
fn to_gca_z(&self) -> Self::Output;
/// Convert U component of the velocity vector from the
/// Heliocentric Cartesian system to Galactic Cylindrical system
fn to_gca_u(&self) -> Self::Output;
/// Convert V component of the velocity vector from the
/// Heliocentric Cartesian system to Galactic Cylindrical system
fn to_gca_v(&self) -> Self::Output;
/// Convert W component of the velocity vector from the
/// Heliocentric Cartesian system to Galactic Cylindrical system
fn to_gca_w(&self) -> Self::Output;
}
impl Corrections for F {
type Output = F;
fn to_gca_x(&self) -> Self::Output {
LSR_R - self
}
fn to_gca_z(&self) -> Self::Output {
self + SUN_H
}
fn to_gca_u(&self) -> Self::Output {
self + SUN_U
}
fn to_gca_v(&self) -> Self::Output {
self + SUN_V + LSR_V
}
fn to_gca_w(&self) -> Self::Output {
self + SUN_W
}
}