diff --git a/crates/physics/apsis-frames/src/earth_rotation.rs b/crates/physics/apsis-frames/src/earth_rotation.rs index 31eec1b..8ac9334 100644 --- a/crates/physics/apsis-frames/src/earth_rotation.rs +++ b/crates/physics/apsis-frames/src/earth_rotation.rs @@ -9,6 +9,11 @@ use core::f64::consts::PI; /// The epoch value is zero by the definition of the angle: the International /// Astronomical Union defines the Earth Rotation Angle to be zero at /// 2000-01-01T12:00:00 UT1. +/// +/// J2000.0 历元处的地球自转角,以周计。 +/// +/// 按该角的定义,历元值就是零:国际天文学联合会把 2000-01-01T12:00:00 UT1 +/// 处的地球自转角定义为零。 pub const ERA_J2000_TURNS: f64 = 0.0; /// The rate of change of the Earth Rotation Angle, in turns per day of UT1. @@ -18,6 +23,13 @@ pub const ERA_J2000_TURNS: f64 = 0.0; /// in a sidereal day, which is shorter than a solar day. /// /// Source: IERS Conventions (2010), equation 8.32. +/// +/// 地球自转角的变化率,以每 UT1 日的周数计。 +/// +/// 该值为 `1.002 737 811 911 354 6`,即每天 `360.985 612 288 088` 度。它 +/// 超过每天一周,因为地球在一个恒星日内转一周,而恒星日短于太阳日。 +/// +/// 出处:IERS Conventions(2010),式 8.32。 pub const ERA_RATE_TURNS_PER_DAY: f64 = 1.002_737_811_911_354_6; /// The number of days from the J2000.0 epoch to the given Julian Date on the @@ -25,6 +37,10 @@ pub const ERA_RATE_TURNS_PER_DAY: f64 = 1.002_737_811_911_354_6; /// /// The J2000.0 epoch is Julian Date 2451545.0, which is noon on /// 2000-01-01. +/// +/// 从 J2000.0 历元到给定 UT1 时标儒略日的天数。 +/// +/// J2000.0 历元是儒略日 2451545.0,即 2000-01-01 的正午。 pub fn ut1_days_from_j2000(ut1_julian_date: f64) -> f64 { ut1_julian_date - 2_451_545.0 } @@ -40,6 +56,14 @@ pub fn ut1_days_from_j2000(ut1_julian_date: f64) -> f64 { /// is periodic with a period of one. The value returned is not reduced to /// any interval, so differences between two angles are meaningful even when /// the interval is longer than a day. +/// +/// 某瞬时的地球自转角。 +/// +/// 该角是从天球中间原点到地球中间原点的转动,绕天球中间极量取。它在现代 +/// 实践中取代格林尼治平恒星时,且与恒星时不同,它是 UT1 的线性函数。 +/// +/// 该值以周保存。一周即一整圈,故该角以 1 为周期。所返回的值不归约到任何 +/// 区间,故即便区间长于一日,两角之差仍有意义。 #[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] pub struct EarthRotationAngle { turns: f64, @@ -47,11 +71,15 @@ pub struct EarthRotationAngle { impl EarthRotationAngle { /// Creates an angle from a value in turns. + /// + /// 由以周表示的值创建角。 pub const fn from_turns(turns: f64) -> Self { Self { turns } } /// Creates an angle from a value in radians. + /// + /// 由以弧度表示的值创建角。 pub fn from_radians(radians: f64) -> Self { Self { turns: radians / (2.0 * PI), @@ -59,6 +87,8 @@ impl EarthRotationAngle { } /// Returns the angle for a Julian Date on the UT1 scale. + /// + /// 返回 UT1 时标上某儒略日对应的角。 pub fn from_ut1_julian_date(ut1_julian_date: f64) -> Self { Self::from_ut1_days(ut1_days_from_j2000(ut1_julian_date)) } @@ -72,6 +102,14 @@ impl EarthRotationAngle { /// about 280.46 degrees. /// /// Source: IERS Conventions (2010), equation 8.32. + /// + /// 返回自 J2000.0 历元起的若干 UT1 天对应的角。 + /// + /// 该式为线性:`theta = 0.779 057 273 2640 + 1.002 737 909 350 795 * d`, + /// 其中 `d` 是以天计的间隔。`0.779 057` 周的常数项是历元本身的角, + /// 约为 280.46 度。 + /// + /// 出处:IERS Conventions(2010),式 8.32。 pub fn from_ut1_days(days_since_j2000: f64) -> Self { const EPOCH_TURNS: f64 = 0.779_057_273_264_0; Self { @@ -82,11 +120,17 @@ impl EarthRotationAngle { /// Returns the angle in turns. /// /// The value is not reduced to `[0, 1)`. + /// + /// 返回以周表示的角。 + /// + /// 该值不归约到 `[0, 1)`。 pub const fn turns(self) -> f64 { self.turns } /// Returns the angle in turns, reduced to `[0, 1)`. + /// + /// 返回以周表示的角,归约到 `[0, 1)`。 pub fn turns_positive(self) -> f64 { self.turns.rem_euclid(1.0) } @@ -94,11 +138,17 @@ impl EarthRotationAngle { /// Returns the angle in radians. /// /// The value is not reduced to `[0, 2 pi)`. + /// + /// 返回以弧度表示的角。 + /// + /// 该值不归约到 `[0, 2 pi)`。 pub fn radians(self) -> f64 { self.turns * 2.0 * PI } /// Returns the angle in radians, reduced to `[0, 2 pi)`. + /// + /// 返回以弧度表示的角,归约到 `[0, 2 pi)`。 pub fn radians_positive(self) -> f64 { self.turns_positive() * 2.0 * PI } @@ -111,6 +161,12 @@ impl EarthRotationAngle { /// Rotation Angle. Applying it to an inertial vector yields the Earth-fixed /// vector, so a vector that is fixed in inertial space acquires a negative /// rotation as the Earth turns beneath it. +/// +/// 返回把惯性系中的矢量映射到地固系的转动。 +/// +/// 该转动是绕第三轴按地球自转角作顺时针转。把它施加于惯性矢量即得地固 +/// 矢量,故在惯性空间固定的矢量会随地球在其下方转动而获得一个负的 +/// 转动。 pub fn rotation_eci_to_ecef(angle: EarthRotationAngle) -> Mat3 { let (sin, cos) = angle.radians_positive().sin_cos(); Mat3::from_rows([cos, sin, 0.0], [-sin, cos, 0.0], [0.0, 0.0, 1.0]) @@ -121,6 +177,10 @@ pub fn rotation_eci_to_ecef(angle: EarthRotationAngle) -> Mat3 { /// /// This is the transpose of [`rotation_eci_to_ecef`], which for a rotation /// matrix is also its inverse. +/// +/// 返回把地固系中的矢量映射到惯性系的转动。 +/// +/// 它是 [`rotation_eci_to_ecef`] 的转置,对旋转矩阵而言也是其逆。 pub fn rotation_ecef_to_eci(angle: EarthRotationAngle) -> Mat3 { rotation_eci_to_ecef(angle).transpose() } diff --git a/crates/physics/apsis-frames/src/iau2000/eect_table.rs b/crates/physics/apsis-frames/src/iau2000/eect_table.rs index 663bd2d..e8ea266 100644 --- a/crates/physics/apsis-frames/src/iau2000/eect_table.rs +++ b/crates/physics/apsis-frames/src/iau2000/eect_table.rs @@ -14,6 +14,11 @@ use super::ComplementaryTerm; /// The eight multipliers apply to the arguments `l`, `l'`, `F`, `D`, `Om`, /// the mean longitude of Venus, the mean longitude of the Earth, and the /// general accumulated precession, in that order. +/// +/// 不依赖时间的各项。 +/// +/// 八个乘数按 `l`、`l'`、`F`、`D`、`Om`、金星的平黄经、地球的平黄经,以及 +/// 一般累积岁差的次序施加于这些参数。 pub static CONSTANT_TERMS: [ComplementaryTerm; 33] = [ ComplementaryTerm { argument: [0, 0, 0, 0, 1, 0, 0, 0], @@ -152,6 +157,10 @@ pub static CONSTANT_TERMS: [ComplementaryTerm; 33] = [ /// The terms whose amplitude grows linearly with time. /// /// The arguments are the same as for the constant terms. +/// +/// 幅度随时间线性增长的各项。 +/// +/// 参数与常数项相同。 pub static LINEAR_TERMS: [ComplementaryTerm; 1] = [ComplementaryTerm { argument: [0, 0, 0, 0, 1, 0, 0, 0], coefficients: [-0.87e-6, 0.00e-6], diff --git a/crates/physics/apsis-frames/src/iau2000/fundamental.rs b/crates/physics/apsis-frames/src/iau2000/fundamental.rs index 7ba8fd0..63f6cae 100644 --- a/crates/physics/apsis-frames/src/iau2000/fundamental.rs +++ b/crates/physics/apsis-frames/src/iau2000/fundamental.rs @@ -298,12 +298,20 @@ impl DelaunayArguments { #[derive(Debug, Clone, Copy, PartialEq)] pub struct PlanetaryArguments { /// The mean anomaly of the Moon. + /// + /// 月球的平近点角。 pub l: f64, /// The mean argument of latitude of the Moon. + /// + /// 月球的平纬度参数。 pub f: f64, /// The mean elongation of the Moon from the Sun. + /// + /// 月球相对太阳的平距角。 pub d: f64, /// The mean longitude of the Moon's ascending node. + /// + /// 月球升交点的平黄经。 pub omega: f64, /// The mean longitude of Mercury. /// @@ -366,6 +374,8 @@ impl PlanetaryArguments { } /// Returns the arguments as an array in series order. + /// + /// 按级数次序把各参数作为数组返回。 pub const fn as_array(self) -> [f64; 13] { [ self.l, diff --git a/crates/physics/apsis-frames/src/iau2000/mod.rs b/crates/physics/apsis-frames/src/iau2000/mod.rs index 76e7dbb..a96196a 100644 --- a/crates/physics/apsis-frames/src/iau2000/mod.rs +++ b/crates/physics/apsis-frames/src/iau2000/mod.rs @@ -67,12 +67,22 @@ pub use terrestrial::{ /// `l`, `l'`, `F`, `D`, `Om`. The six coefficients are the longitude sine, /// its time derivative, the longitude cosine, the obliquity cosine, its time /// derivative, and the obliquity sine, in units of 0.1 microarcsecond. +/// +/// 日月章动级数的一项。 +/// +/// 五个乘数按 `l`、`l'`、`F`、`D`、`Om` 的次序施加于 Delaunay 参数。六个 +/// 系数依次是黄经正弦、其时间导数、黄经余弦、黄赤交角余弦、其时间导数, +/// 以及黄赤交角正弦,单位为 0.1 微角秒。 #[derive(Debug, Clone, Copy)] pub struct SeriesTerm { /// The integer multipliers of the five Delaunay arguments. + /// + /// 五个 Delaunay 参数的整数乘数。 pub argument: [i32; 5], /// The six coefficients of the term, in the order the reference lists /// them. + /// + /// 该项的六个系数,按参考实现列出的次序。 pub coefficients: [f64; 6], } @@ -82,11 +92,20 @@ pub struct SeriesTerm { /// the mean longitude of Venus, the mean longitude of the Earth, and the /// general accumulated precession. The two coefficients are the sine and /// cosine amplitudes, in arcseconds. +/// +/// 分点方程式补充项的一项。 +/// +/// 八个乘数施加于参数 `l`、`l'`、`F`、`D`、`Om`、金星的平黄经、地球的平 +/// 黄经,以及一般累积岁差。两个系数是正弦与余弦幅度,单位为角秒。 #[derive(Debug, Clone, Copy)] pub struct ComplementaryTerm { /// The integer multipliers of the eight arguments. + /// + /// 八个参数的整数乘数。 pub argument: [i32; 8], /// The sine and cosine coefficients. + /// + /// 正弦与余弦系数。 pub coefficients: [f64; 2], } @@ -97,11 +116,21 @@ pub struct ComplementaryTerm { /// general accumulated precession. The four coefficients are the longitude /// sine, the longitude cosine, the obliquity sine, and the obliquity cosine, /// in units of 0.1 microarcsecond. +/// +/// 行星章动级数的一项。 +/// +/// 十三个乘数按 `l`、`F`、`D`、`Om`、水星到天王星、海王星,以及一般累积 +/// 岁差的次序施加于行星参数。四个系数依次是黄经正弦、黄经余弦、黄赤交角 +/// 正弦与黄赤交角余弦,单位为 0.1 微角秒。 #[derive(Debug, Clone, Copy)] pub struct PlanetaryTerm { /// The integer multipliers of the thirteen planetary arguments. + /// + /// 十三个行星参数的整数乘数。 pub argument: [i32; 13], /// The four coefficients of the term, in the order the reference lists /// them. + /// + /// 该项的四个系数,按参考实现列出的次序。 pub coefficients: [f64; 4], } diff --git a/crates/physics/apsis-frames/src/iau2000/nutation.rs b/crates/physics/apsis-frames/src/iau2000/nutation.rs index 4187d51..68cc6d1 100644 --- a/crates/physics/apsis-frames/src/iau2000/nutation.rs +++ b/crates/physics/apsis-frames/src/iau2000/nutation.rs @@ -25,6 +25,8 @@ use super::{PlanetaryTerm, SeriesTerm}; use core::f64::consts::PI; /// Converts a coefficient in units of 0.1 microarcsecond to radians. +/// +/// 把以 0.1 微角秒为单位的系数换算为弧度。 const UNIT_TO_RADIAN: f64 = 1.0e-7 * PI / (180.0 * 3_600.0); /// Converts arcseconds to radians. @@ -33,16 +35,24 @@ const UNIT_TO_RADIAN: f64 = 1.0e-7 * PI / (180.0 * 3_600.0); const ARCSECOND_TO_RADIAN: f64 = PI / (180.0 * 3_600.0); /// The nutation in longitude and obliquity, in radians. +/// +/// 黄经与黄赤交角方向的章动,单位为弧度。 #[derive(Debug, Clone, Copy, PartialEq, Default)] pub struct Nutation { /// The nutation in longitude, in radians. + /// + /// 黄经方向的章动,单位为弧度。 pub longitude: f64, /// The nutation in obliquity, in radians. + /// + /// 黄赤交角方向的章动,单位为弧度。 pub obliquity: f64, } impl Nutation { /// Creates a nutation from its two angles. + /// + /// 由其两个角创建章动。 pub const fn new(longitude: f64, obliquity: f64) -> Self { Self { longitude, @@ -51,16 +61,22 @@ impl Nutation { } /// Returns the nutation in longitude, in arcseconds. + /// + /// 返回黄经方向的章动,单位为角秒。 pub fn longitude_arcseconds(self) -> f64 { self.longitude / ARCSECOND_TO_RADIAN } /// Returns the nutation in obliquity, in arcseconds. + /// + /// 返回黄赤交角方向的章动,单位为角秒。 pub fn obliquity_arcseconds(self) -> f64 { self.obliquity / ARCSECOND_TO_RADIAN } /// Returns the sum of two nutations. + /// + /// 返回两个章动之和。 pub const fn plus(self, other: Self) -> Self { Self::new( self.longitude + other.longitude, @@ -75,6 +91,12 @@ impl Nutation { /// is the sum of a time dependent sine, a constant sine, and a cosine. The /// obliquity is the sum of a time dependent cosine, a constant cosine, and a /// sine. +/// +/// 求日月级数的一项。 +/// +/// 五个乘数施加于 Delaunay 参数。黄经是一个随时间变化的正弦、一个常数 +/// 正弦与一个余弦之和。黄赤交角是一个随时间变化的余弦、一个常数余弦与 +/// 一个正弦之和。 fn lunisolar_term(term: &SeriesTerm, arguments: &DelaunayArguments, t: f64) -> Nutation { let multipliers = &term.argument; let c = &term.coefficients; @@ -86,6 +108,7 @@ fn lunisolar_term(term: &SeriesTerm, arguments: &DelaunayArguments, t: f64) -> N let (sine, cosine) = argument.sin_cos(); // The order is the one the reference uses: sp, spt, cp, ce, cet, se. + // 次序即参考实现所用者:sp、spt、cp、ce、cet、se。 Nutation::new( (c[0] + c[1] * t) * sine + c[2] * cosine, (c[3] + c[4] * t) * cosine + c[5] * sine, @@ -97,6 +120,11 @@ fn lunisolar_term(term: &SeriesTerm, arguments: &DelaunayArguments, t: f64) -> N /// The thirteen multipliers are applied to the planetary arguments. The /// longitude is a sine plus a cosine, and the obliquity is a sine plus a /// cosine, with no time dependence in either. +/// +/// 求行星级数的一项。 +/// +/// 十三个乘数施加于行星参数。黄经是一个正弦加一个余弦,黄赤交角也是一个 +/// 正弦加一个余弦,二者都不含时间依赖。 fn planetary_term(term: &PlanetaryTerm, arguments: &PlanetaryArguments) -> Nutation { let multipliers = &term.argument; let c = &term.coefficients; @@ -108,6 +136,7 @@ fn planetary_term(term: &PlanetaryTerm, arguments: &PlanetaryArguments) -> Nutat let (sine, cosine) = argument.sin_cos(); // The order is the one the reference uses: sp, cp, se, ce. + // 次序即参考实现所用者:sp、cp、se、ce。 Nutation::new(c[0] * sine + c[1] * cosine, c[2] * sine + c[3] * cosine) } @@ -146,10 +175,20 @@ pub fn nutation_2000a(t: f64) -> Nutation { /// /// Source: IAU 2006, as implemented by `eraNut06a`, which applies the /// expressions of Wallace and Capitaine (2006), equations 5. +/// +/// 返回施加 IAU 2006 岁差调整后的章动。 +/// +/// IAU 2000A 模型建立在 IAU 1976 岁差之上,而 IAU 2006 岁差改变了岁差 +/// 速率。该调整使章动与较新的岁差一致,这一组合正是现代天球到地球转换 +/// 所用的。 +/// +/// 出处:IAU 2006,按 `eraNut06a` 所实现,它施加 Wallace 与 +/// Capitaine(2006)式 5 的表达式。 pub fn nutation_2000a_with_2006_adjustment(t: f64) -> Nutation { let nutation = nutation_2000a(t); // The adjustment scales the nutation itself rather than adding an // independent term, which is why it is written as a factor. + // 该调整是对章动本身缩放,而非加上一个独立项,故它被写成一个因子。 let fj2 = -2.777_4e-6 * t; Nutation::new( nutation.longitude * (1.0 + 0.469_7e-6 + fj2), diff --git a/crates/physics/apsis-frames/src/iau2000/nutation_table.rs b/crates/physics/apsis-frames/src/iau2000/nutation_table.rs index d975f83..4d1d8b0 100644 --- a/crates/physics/apsis-frames/src/iau2000/nutation_table.rs +++ b/crates/physics/apsis-frames/src/iau2000/nutation_table.rs @@ -19,6 +19,12 @@ use super::{PlanetaryTerm, SeriesTerm}; /// in that order. The coefficients are the longitude sine, its time /// derivative, the longitude cosine, the obliquity cosine, its time /// derivative, and the obliquity sine, in units of 0.1 microarcsecond. +/// +/// 级数中的日月各项。 +/// +/// 各乘数按 `l`、`l'`、`F`、`D`、`Om` 的次序施加于这些参数。各系数依次是 +/// 黄经正弦、其时间导数、黄经余弦、黄赤交角余弦、其时间导数,以及黄赤交角 +/// 正弦,单位为 0.1 微角秒。 pub static LUNI_SOLAR: [SeriesTerm; 678] = [ SeriesTerm { argument: [0, 0, 0, 0, 1], @@ -2749,6 +2755,12 @@ pub static LUNI_SOLAR: [SeriesTerm; 678] = [ /// coefficients are the longitude sine, the longitude cosine, the /// obliquity sine, and the obliquity cosine, in units of 0.1 /// microarcsecond. +/// +/// 级数中的行星各项。 +/// +/// 各乘数按 `l`、`F`、`D`、`Om`、水星到天王星的平黄经、海王星的平黄经, +/// 以及一般累积岁差的次序施加于这些参数。各系数依次是黄经正弦、黄经余弦、 +/// 黄赤交角正弦与黄赤交角余弦,单位为 0.1 微角秒。 pub static PLANETARY: [PlanetaryTerm; 687] = [ PlanetaryTerm { argument: [0, 0, 0, 0, 0, 0, 8, -16, 4, 5, 0, 0, 0], diff --git a/crates/physics/apsis-frames/src/iau2000/precession.rs b/crates/physics/apsis-frames/src/iau2000/precession.rs index 1d2a02c..e0d0276 100644 --- a/crates/physics/apsis-frames/src/iau2000/precession.rs +++ b/crates/physics/apsis-frames/src/iau2000/precession.rs @@ -30,6 +30,11 @@ const ARCSECOND_TO_RADIAN: f64 = PI / (180.0 * 3_600.0); /// The offset between the origin of the International Celestial Reference /// System and the dynamical equinox of J2000.0. The value is /// minus 0.0146 arcseconds. +/// +/// 赤经方向的坐标架偏差,单位为弧度。 +/// +/// 国际天球参考系原点与 J2000.0 动力学春分点之间的偏移。该值为负 +/// 0.0146 角秒。 pub const FRAME_BIAS_RIGHT_ASCENSION: f64 = -0.014_6 * ARCSECOND_TO_RADIAN; /// The frame bias in declination, in radians. @@ -37,12 +42,21 @@ pub const FRAME_BIAS_RIGHT_ASCENSION: f64 = -0.014_6 * ARCSECOND_TO_RADIAN; /// The offset between the pole of the International Celestial Reference /// System and the mean pole of J2000.0. The value is minus 0.0068192 /// arcseconds. +/// +/// 赤纬方向的坐标架偏差,单位为弧度。 +/// +/// 国际天球参考系极与 J2000.0 平极之间的偏移。该值为负 0.0068192 +/// 角秒。 pub const FRAME_BIAS_DECLINATION: f64 = -0.006_819_2 * ARCSECOND_TO_RADIAN; /// The frame bias in longitude, in radians. /// /// The offset between the two origins measured along the equator. The value /// is minus 0.041775 arcseconds. +/// +/// 黄经方向的坐标架偏差,单位为弧度。 +/// +/// 沿赤道量得的两个原点之间的偏移。该值为负 0.041775 角秒。 pub const FRAME_BIAS_LONGITUDE: f64 = -0.041_775 * ARCSECOND_TO_RADIAN; /// The four angles that describe the precession from J2000.0 to a date. @@ -51,15 +65,29 @@ pub const FRAME_BIAS_LONGITUDE: f64 = -0.041_775 * ARCSECOND_TO_RADIAN; /// `gamma_bar` about the third axis, then by `phi_bar` about the first, then /// by minus `psi_bar` about the third, then by minus `epsilon_a` about the /// first. +/// +/// 描述从 J2000.0 到某日岁差的四个角。 +/// +/// 它们按参考实现所用的次序施加:绕第三轴转 `gamma_bar`,再绕第一轴转 +/// `phi_bar`,再绕第三轴转负的 `psi_bar`,再绕第一轴转负的 +/// `epsilon_a`。 #[derive(Debug, Clone, Copy, PartialEq)] pub struct PrecessionAngles { /// The precession of the equator along the ecliptic, in radians. + /// + /// 赤道沿黄道的岁差,单位为弧度。 pub gamma_bar: f64, /// The inclination of the moving equator to the ecliptic, in radians. + /// + /// 运动赤道相对黄道的倾角,单位为弧度。 pub phi_bar: f64, /// The accumulated precession in longitude, in radians. + /// + /// 黄经上的累积岁差,单位为弧度。 pub psi_bar: f64, /// The mean obliquity at the date, in radians. + /// + /// 该日的平黄赤交角,单位为弧度。 pub epsilon: f64, } @@ -70,6 +98,13 @@ pub struct PrecessionAngles { /// is 84381.406 arcseconds, which is the obliquity at J2000.0. /// /// Source: the IAU 2006 precession, as implemented by `eraObl06`. +/// +/// 返回黄道的平黄赤交角,单位为弧度。 +/// +/// 该多项式是 IAU 2006 表达式,按地球时标、自 J2000.0 起的儒略世纪求值。 +/// 常数项为 84381.406 角秒,即 J2000.0 处的黄赤交角。 +/// +/// 出处:IAU 2006 岁差,按 `eraObl06` 所实现。 pub fn mean_obliquity(t: f64) -> f64 { let arcseconds = 84_381.406 + t * (-46.836_769 @@ -118,9 +153,18 @@ pub fn precession_angles(t: f64) -> PrecessionAngles { /// /// Source: as implemented by `eraBi00`, which gives the bias as three small /// rotations rather than as a matrix. +/// +/// 返回坐标架偏差旋转矩阵。 +/// +/// 该偏差是从国际天球参考系到 J2000.0 动力学平赤道与平春分点的常值 +/// 转动。其三个角远小于十分之一角秒,但略去它会留下大于章动级数精度 +/// 的系统误差。 +/// +/// 出处:按 `eraBi00` 所实现,它把偏差给出为三个小转动而非一个矩阵。 pub fn frame_bias_matrix() -> Mat3 { // The reference builds the bias from three elementary rotations, and // the result is reproduced here in the same order. + // 参考实现由三个基本转动构建该偏差,此处按同一次序再现结果。 rotation_z(FRAME_BIAS_LONGITUDE) * rotation_x(FRAME_BIAS_DECLINATION) * rotation_y(FRAME_BIAS_RIGHT_ASCENSION) @@ -150,6 +194,13 @@ pub fn bias_precession_matrix(t: f64) -> Mat3 { /// rotations in sequence. The reference helper composes each new rotation /// on the left of the accumulator, so the product here is written with the /// last rotation applied first, in the same order. +/// +/// 在给定预先算出的岁差角时,返回从天球参考系到该日平赤道与平春分点的 +/// 转动。 +/// +/// 出处:按 `eraFw2m` 所实现,它依次施加四个基本转动。参考辅助函数把 +/// 每个新转动合成到累加器的左侧,故此处的乘积按最后施加的转动写在最前, +/// 次序一致。 pub fn frame_to_mean_of_date(angles: &PrecessionAngles) -> Mat3 { rotation_x(-angles.epsilon) * rotation_z(-angles.psi_bar) @@ -164,6 +215,12 @@ pub fn frame_to_mean_of_date(angles: &PrecessionAngles) -> Mat3 { /// is the transpose of the one that would rotate a vector by the same angle. /// Composing `a * b` therefore applies `b` first, and the products in this /// module read in the order the rotations are physically applied. +/// +/// 返回绕第一轴转 `angle` 的旋转,单位为弧度。 +/// +/// 该约定与参考辅助函数 `eraRx` 与 `eraRz` 一致:转动施加于坐标系而非 +/// 矢量,故该矩阵是把矢量转同一角度的矩阵的转置。因此合成 `a * b` 时先 +/// 施加 `b`,本模块中的各乘积按各转动实际施加的次序阅读。 pub(crate) fn rotation_x(angle: f64) -> Mat3 { let (sine, cosine) = angle.sin_cos(); Mat3::from_rows([1.0, 0.0, 0.0], [0.0, cosine, sine], [0.0, -sine, cosine]) @@ -172,6 +229,10 @@ pub(crate) fn rotation_x(angle: f64) -> Mat3 { /// Returns a rotation of `angle` about the second axis, in radians. /// /// The sign convention matches the other axis rotations in this module. +/// +/// 返回绕第二轴转 `angle` 的旋转,单位为弧度。 +/// +/// 符号约定与本模块中其余各轴转动一致。 fn rotation_y(angle: f64) -> Mat3 { let (sine, cosine) = angle.sin_cos(); Mat3::from_rows([cosine, 0.0, -sine], [0.0, 1.0, 0.0], [sine, 0.0, cosine]) @@ -180,6 +241,10 @@ fn rotation_y(angle: f64) -> Mat3 { /// Returns a rotation of `angle` about the third axis, in radians. /// /// The sign convention matches the other axis rotations in this module. +/// +/// 返回绕第三轴转 `angle` 的旋转,单位为弧度。 +/// +/// 符号约定与本模块中其余各轴转动一致。 pub fn rotation_z(angle: f64) -> Mat3 { let (sine, cosine) = angle.sin_cos(); Mat3::from_rows([cosine, sine, 0.0], [-sine, cosine, 0.0], [0.0, 0.0, 1.0]) diff --git a/crates/physics/apsis-frames/src/iau2000/teme.rs b/crates/physics/apsis-frames/src/iau2000/teme.rs index eb3c363..7e8994a 100644 --- a/crates/physics/apsis-frames/src/iau2000/teme.rs +++ b/crates/physics/apsis-frames/src/iau2000/teme.rs @@ -27,6 +27,8 @@ use apsis_math::Mat3; use core::f64::consts::PI; /// The number of seconds in a day. +/// +/// 一日的秒数。 const SECONDS_PER_DAY: f64 = 86_400.0; /// Converts seconds of time to radians. @@ -34,6 +36,11 @@ const SECONDS_PER_DAY: f64 = 86_400.0; /// A full turn is 86 400 seconds of time, so one second of time is /// `2 pi / 86400` radians. Sidereal time is quoted in seconds of time, not in /// arcseconds, and the two differ by a factor of fifteen. +/// +/// 把时间秒换算为弧度。 +/// +/// 一整圈是 86 400 时间秒,故一时间秒是 `2 pi / 86400` 弧度。恒星时以时间 +/// 秒而非角秒给出,二者相差十五倍。 const SECONDS_OF_TIME_TO_RADIAN: f64 = 2.0 * PI / SECONDS_PER_DAY; /// Returns Greenwich mean sidereal time from the 1982 expression, in @@ -54,9 +61,22 @@ const SECONDS_OF_TIME_TO_RADIAN: f64 = 2.0 * PI / SECONDS_PER_DAY; /// part preserves more of the fraction. /// /// Source: as implemented by `eraGmst82`. +/// +/// 返回 1982 表达式给出的格林尼治平恒星时,单位为弧度。 +/// +/// 该表达式是自 J2000.0 起儒略世纪数加上当日以时间秒计的零头所构成的多项 +/// 式。它是 SGP4 理论所拟合的恒星时,故此处用它而非现代表达式:根数集与 +/// 它一致。 +/// +/// 儒略日按两部分取,一为整数天数、一为零头,因为接近 2 461 000 的单个 +/// `f64` 分辨率约为 40 微秒,而所要求的恒星时优于该值。只有一个值的调用 +/// 方可以分别传入整数部分与零头,或把同一个值传两次:`(jd, 0.0)`、 +/// `(2400000.5, mjd)` 与 `(jd - 0.5, 0.5)` 都可接受,但整数部分更小的 +/// 拆分能保留更多零头。 pub fn greenwich_mean_sidereal_time_1982(day: f64, fraction: f64) -> f64 { // The constant absorbs the half day between the start of the Julian // date and the start of the day. + // 该常数吸收了儒略日起点与当日起点之间的半日。 let a = 24_110.548_41 - SECONDS_PER_DAY / 2.0; let b = 8_640_184.812_866; let c = 0.093_104; @@ -64,6 +84,7 @@ pub fn greenwich_mean_sidereal_time_1982(day: f64, fraction: f64) -> f64 { // The reference orders the two parts so that the smaller is the first, // which is the arrangement that preserves the most precision. + // 参考实现把两部分排序使较小者在前,这是最能保留精度的安排。 let (first, second) = if day < fraction { (day, fraction) } else { @@ -85,6 +106,13 @@ pub fn greenwich_mean_sidereal_time_1982(day: f64, fraction: f64) -> f64 { /// /// This is the transformation to apply to the position and velocity that /// `apsis-sgp4` produces. +/// +/// 返回从真赤道平春分点坐标系到地固系的转动。 +/// +/// 参数是 UT1 儒略日,因为该转动即地球自转;极移由调用方提供,因为它是 +/// 实测而非建模的。 +/// +/// 这是施加于 `apsis-sgp4` 所产生的位置与速度的变换。 pub fn teme_to_terrestrial_matrix( ut1_day: f64, ut1_fraction: f64, @@ -93,6 +121,7 @@ pub fn teme_to_terrestrial_matrix( let sidereal = greenwich_mean_sidereal_time_1982(ut1_day, ut1_fraction); // The composition applies the Earth rotation first and the polar motion // last, with each new rotation on the left of the accumulator. + // 该合成先施加地球自转、最后施加极移,每个新转动都在累加器的左侧。 polar_motion.matrix() * rotation_z(sidereal) } @@ -100,6 +129,11 @@ pub fn teme_to_terrestrial_matrix( /// /// The convention is the one the reference helpers use: the rotation is /// applied to the frame, so composing `a * b` applies `b` first. +/// +/// 返回绕第三轴转 `angle` 的旋转,单位为弧度。 +/// +/// 约定即各参考辅助函数所用者:转动施加于坐标系,故合成 `a * b` 时先施加 +/// `b`。 fn rotation_z(angle: f64) -> Mat3 { super::precession::rotation_z(angle) } diff --git a/crates/physics/apsis-frames/src/iau2000/terrestrial.rs b/crates/physics/apsis-frames/src/iau2000/terrestrial.rs index 2c4054d..04ef78d 100644 --- a/crates/physics/apsis-frames/src/iau2000/terrestrial.rs +++ b/crates/physics/apsis-frames/src/iau2000/terrestrial.rs @@ -41,6 +41,13 @@ const ARCSECOND_TO_RADIAN: f64 = PI / (180.0 * 3_600.0); /// reference uses. /// /// Source: as implemented by `eraPnm06a` and `eraFw2m`. +/// +/// 返回某时刻的偏差-岁差-章动矩阵。 +/// +/// 该矩阵把矢量从天球参考系带到该日的真赤道与真春分点。它由四个岁差角 +/// 构成,其中最后两个角加上章动,这正是参考实现所用的形式。 +/// +/// 出处:按 `eraPnm06a` 与 `eraFw2m` 所实现。 pub fn bias_precession_nutation_matrix(t: f64) -> Mat3 { let angles = super::precession::precession_angles(t); let nutation = nutation_2000a_with_2006_adjustment(t); @@ -61,11 +68,20 @@ pub fn bias_precession_nutation_matrix(t: f64) -> Mat3 { /// sidereal time that is quoted to that precision. /// /// Source: the MHB2000 complementary terms, as implemented by `eraEect00`. +/// +/// 返回分点方程式的补充项。 +/// +/// 分点方程式除黄经章动在真赤道上的投影外,还有来自同一理论的一组小 +/// 周期项。它们达到密切章动常数项的两倍左右,即一毫秒的时间,故对以该 +/// 精度给出的恒星时是重要的。 +/// +/// 出处:MHB2000 补充项,按 `eraEect00` 所实现。 pub fn equation_of_the_equinoxes_complementary_terms(t: f64) -> f64 { use super::eect_table::{CONSTANT_TERMS, LINEAR_TERMS}; // The complementary terms use the IERS 2003 forms of two arguments, // which differ from the ones the nutation series was fitted with. + // 补充项使用两个参数的 IERS 2003 形式,它们与章动级数所拟合的有所不同。 let arguments = [ super::fundamental::mean_anomaly_moon(t), super::fundamental::mean_anomaly_sun_iers2003(t), @@ -102,6 +118,7 @@ pub fn equation_of_the_equinoxes_complementary_terms(t: f64) -> f64 { } // The tabulated coefficients are in arcseconds. + // 所列系数以角秒计。 (constant + linear * t) * ARCSECOND_TO_RADIAN } @@ -113,6 +130,13 @@ pub fn equation_of_the_equinoxes_complementary_terms(t: f64) -> f64 { /// /// The value is the projection of the nutation in longitude onto the true /// equator, `dpsi cos(eps)`, plus the complementary terms of the theory. +/// +/// 返回某时刻的分点方程式。 +/// +/// 分点方程式是沿真赤道量得的真春分点与平春分点之差。它是恒星时须用以 +/// 改正才能成为真春分点时角的量。 +/// +/// 该值是黄经章动在真赤道上的投影 `dpsi cos(eps)`,加上该理论的补充项。 pub fn equation_of_the_equinoxes(t: f64) -> f64 { let nutation = nutation_2000a_with_2006_adjustment(t); let obliquity = mean_obliquity(t); @@ -125,18 +149,31 @@ pub fn equation_of_the_equinoxes(t: f64) -> f64 { /// is measured daily and published by the International Earth Rotation and /// Reference Systems Service, so it cannot be computed from a model and is /// supplied by the caller. +/// +/// 地球的极移,以两个角与转动表示。 +/// +/// 极移是自转极在地球内部的运动。它由国际地球自转与参考系服务每日测量 +/// 并发布,故无法由模型算出,而由调用方提供。 #[derive(Debug, Clone, Copy, PartialEq, Default)] pub struct PolarMotion { /// The displacement of the pole along the Greenwich meridian, in /// radians. + /// + /// 极点沿格林尼治子午线的位移,单位为弧度。 pub x: f64, /// The displacement of the pole along the meridian ninety degrees west, /// in radians. + /// + /// 极点沿西经九十度子午线的位移,单位为弧度。 pub y: f64, /// The rotation of the terrestrial frame about the pole, in radians. /// /// This is the terrestrial intermediate origin locator, which is small /// and is often taken as zero. + /// + /// 地球坐标系绕极点的转动,单位为弧度。 + /// + /// 这是地球中间原点定位角,它很小,常取为零。 pub s: f64, } @@ -147,6 +184,11 @@ impl PolarMotion { /// The error from omitting the polar motion is under a tenth of an /// arcsecond, well below the nutation but above the precision of a /// modern transformation. + /// + /// 零极移,即无法获得已发布值时所采用的近似。 + /// + /// 略去极移的误差不到十分之一角秒,远低于章动,但高于现代转换的 + /// 精度。 pub const NONE: Self = Self { x: 0.0, y: 0.0, @@ -154,11 +196,15 @@ impl PolarMotion { }; /// Creates a polar motion from its three angles. + /// + /// 由其三个角创建极移。 pub const fn new(x: f64, y: f64, s: f64) -> Self { Self { x, y, s } } /// Returns `true` when the angles are usable. + /// + /// 当各角可用时返回 `true`。 pub fn is_valid(self) -> bool { self.x.is_finite() && self.y.is_finite() && self.s.is_finite() } @@ -173,6 +219,15 @@ impl PolarMotion { /// /// Source: as implemented by `eraPom00`, which applies the rotations in /// sequence by composing each on the left of the accumulator. + /// + /// 返回极移的旋转矩阵。 + /// + /// 该转动是绕第三轴转定位角,再绕第二轴转负的 `x` 位移,再绕第一轴 + /// 转负的 `y` 位移。符号是参考实现所用者,它们把地球坐标系带到与 + /// 天极对齐。 + /// + /// 出处:按 `eraPom00` 所实现,它依次施加各转动,每次都把新转动合成 + /// 到累加器的左侧。 pub fn matrix(self) -> Mat3 { rotation_x(-self.y) * rotation_y(-self.x) * rotation_z(self.s) } @@ -190,6 +245,16 @@ impl PolarMotion { /// Source: the composition is the one `eraC2t06a` produces for the equinox /// based chain, with the polar motion applied separately by the caller of /// the full transformation. +/// +/// 返回某时刻的中间坐标系到地球坐标系的矩阵。 +/// +/// 中间坐标系是该日的真赤道与真春分点,地球坐标系是同一日的地固系。这里 +/// 用基于春分点的方法,其中从一个到另一个的转动是格林尼治视恒星时。 +/// +/// 时间参数为 UT1 与 TT 儒略日。 +/// +/// 出处:该合成即 `eraC2t06a` 对基于春分点的链条所产生者,极移由完整 +/// 变换的调用方单独施加。 pub fn intermediate_to_terrestrial_matrix(ut1_julian_date: f64, tt_julian_date: f64) -> Mat3 { let apparent_sidereal = greenwich_apparent_sidereal_time(ut1_julian_date, tt_julian_date); rotation_z(apparent_sidereal) @@ -201,6 +266,12 @@ pub fn intermediate_to_terrestrial_matrix(ut1_julian_date: f64, tt_julian_date: /// is the hour angle of the true equinox. /// /// Source: as implemented by `eraGst06a`. +/// +/// 返回某 UT1 与 TT 儒略日的格林尼治视恒星时。 +/// +/// 它是平恒星时加分点方程式,故即真春分点的时角。 +/// +/// 出处:按 `eraGst06a` 所实现。 pub fn greenwich_apparent_sidereal_time(ut1_julian_date: f64, tt_julian_date: f64) -> f64 { let t = (tt_julian_date - 2_451_545.0) / 36_525.0; let mean = greenwich_mean_sidereal_time(ut1_julian_date, tt_julian_date); @@ -214,9 +285,17 @@ pub fn greenwich_apparent_sidereal_time(ut1_julian_date: f64, tt_julian_date: f6 /// non-rotating origin. /// /// Source: as implemented by `eraGmst06`. +/// +/// 返回某 UT1 与 TT 儒略日的格林尼治平恒星时。 +/// +/// 关系为地球自转角加上赤经上的累积岁差,后者是联系春分点与非旋转原点 +/// 的量。 +/// +/// 出处:按 `eraGmst06` 所实现。 pub fn greenwich_mean_sidereal_time(ut1_julian_date: f64, tt_julian_date: f64) -> f64 { let t = (tt_julian_date - 2_451_545.0) / 36_525.0; // The accumulated precession in right ascension, in arcseconds. + // 赤经上的累积岁差,单位为角秒。 let arcseconds = 0.014_506 + t * (4_612.156_534 + t * (1.391_581_7 @@ -230,6 +309,12 @@ pub fn greenwich_mean_sidereal_time(ut1_julian_date: f64, tt_julian_date: f64) - /// which is exact to the precision the angle is known. /// /// Source: IERS Conventions (2010), equation 8.32. +/// +/// 返回某 UT1 儒略日的地球自转角。 +/// +/// 这是国际天文学联合会的线性表达式,它在该角已知的精度内是精确的。 +/// +/// 出处:IERS Conventions(2010),式 8.32。 pub fn earth_rotation_angle(ut1_julian_date: f64) -> f64 { let days = ut1_julian_date - 2_451_545.0; let turns = 0.779_057_273_264_0 + 1.002_737_811_911_354_6 * days; @@ -245,6 +330,15 @@ pub fn earth_rotation_angle(ut1_julian_date: f64) -> f64 { /// is supplied by the caller because it is measured rather than modelled. /// /// Source: the composition is the one `eraC2t06a` produces. +/// +/// 返回某时刻的天球到地球坐标系矩阵。 +/// +/// 它合成整条链:坐标架偏差、岁差、章动、地球自转与极移。 +/// +/// 时间参数为 UT1 与 TT 儒略日,极移由调用方提供,因为它是实测而非建模 +/// 的。 +/// +/// 出处:该合成即 `eraC2t06a` 所产生者。 pub fn celestial_to_terrestrial_matrix( ut1_julian_date: f64, tt_julian_date: f64, @@ -256,6 +350,8 @@ pub fn celestial_to_terrestrial_matrix( // The composition is the one `eraC2tcio` produces: the bias, precession, // and nutation first, then the Earth rotation, then the polar motion, // with each new rotation composed on the left of the accumulator. + // 该合成即 `eraC2tcio` 所产生者:先是偏差、岁差与章动,然后是地球 + // 自转,再是极移,每个新转动都合成到累加器的左侧。 polar_motion.matrix() * rotation_z(sidereal) * bias_precession_nutation } @@ -264,6 +360,11 @@ pub fn celestial_to_terrestrial_matrix( /// The convention matches the reference helper `eraRx`: the rotation is /// applied to the frame, so the matrix is the transpose of the one that /// would rotate a vector by the same angle. +/// +/// 返回绕第一轴转 `angle` 的旋转,单位为弧度。 +/// +/// 该约定与参考辅助函数 `eraRx` 一致:转动施加于坐标系,故该矩阵是把 +/// 矢量转同一角度的矩阵的转置。 fn rotation_x(angle: f64) -> Mat3 { let (sine, cosine) = angle.sin_cos(); Mat3::from_rows([1.0, 0.0, 0.0], [0.0, cosine, sine], [0.0, -sine, cosine]) @@ -272,6 +373,10 @@ fn rotation_x(angle: f64) -> Mat3 { /// Returns a rotation of `angle` about the second axis, in radians. /// /// The convention is the one of [`rotation_x`]. +/// +/// 返回绕第二轴转 `angle` 的旋转,单位为弧度。 +/// +/// 约定与 [`rotation_x`] 相同。 fn rotation_y(angle: f64) -> Mat3 { let (sine, cosine) = angle.sin_cos(); Mat3::from_rows([cosine, 0.0, -sine], [0.0, 1.0, 0.0], [sine, 0.0, cosine])