feat: 引入可切换星历模型并扩展天象观测链路

- 新增半解析、旧模型、自定义与多源堆叠星历实例,提供 Context、Instance、SPK 读取及状态与视位置计算
- 统一太阳、月球和行星实例接口,扩展黄经穿越、留、相位、最近角距、偕日可见、任意高度升落、轨道节点及凌日等天象查询
- 完善日月食、月掩与凌日的月缘剖面、有限盘面接触、站心修正、局地可见性、全球路径和地图输出
- 新增 SVG、GeoJSON、KML 天象输出及凌日、月掩和月缘地形相关缓存与几何求解
- 新增恒星星表导入与查询,支持 CSV、Hipparcos、BSC5、Stellarium 等格式及名称、交叉标识、锥面检索和星等过滤
- 补充 IAU 2006、地球定向、折射消光、大气观测、轨道传播及半解析行星/月球数据支持
- 将默认未来民用时标切换为 TimeScaleLeapHour,更新 2027–2400 农历速查表、中文日期解析和时区边界处理
- 增加事件基线、跨模型回归、几何边界、月缘地形和输出契约测试,完善中英文手册、示例资源、NOTICE 与忽略规则
This commit is contained in:
2026-10-15 23:54:15 +08:00
parent 16c62a97d5
commit 044f2f4381
674 changed files with 62983 additions and 8396 deletions
+10 -133
View File
@@ -1,6 +1,10 @@
package basic
import "math"
import (
"math"
"b612.me/astro/internal/ltp"
)
// Precess 函数实现了基于 Explanatory Supplement 2nd ed. table 3.211.1 的岁差计算
// ra0, dec0: 初始赤经和赤纬(弧度)
@@ -54,142 +58,15 @@ type Vector3 [3]float64
// 三维矩阵
type Matrix3 [3][3]float64
// 计算长期岁差的黄极向量
func ltpPECL(epj float64) Vector3 {
// 多项式系数
pqPol := [2][4]float64{
{+5851.607687, -0.1189000, -0.00028913, +0.000000101},
{-1600.886300, +1.1689818, -0.00000020, -0.000000437},
}
func ltpPECL(epj float64) Vector3 { return Vector3(ltp.EclipticPole(epj)) }
// 周期项系数
pqPer := [8][5]float64{
{708.15, -5486.751211, -684.661560, 667.666730, -5523.863691},
{2309.00, -17.127623, 2446.283880, -2354.886252, -549.747450},
{1620.00, -617.517403, 399.671049, -428.152441, -310.998056},
{492.20, 413.442940, -356.652376, 376.202861, 421.535876},
{1183.00, 78.614193, -186.387003, 184.778874, -36.776172},
{622.00, -180.732815, -316.800070, 335.321713, -145.278396},
{882.00, -87.676083, 198.296071, -185.138669, -34.744450},
{547.00, 46.140315, 101.135679, -120.972830, 22.885731},
}
func ltpPEQU(epj float64) Vector3 { return Vector3(ltp.EquatorPole(epj)) }
// 计算从J2000.0起算的儒略世纪数
t := (epj - 2000.0) / 100.0
func pxp(a, b Vector3) Vector3 { return Vector3(ltp.Cross(ltp.Vector3(a), ltp.Vector3(b))) }
// 初始化P和Q累加器
p, q := 0.0, 0.0
// 周期项
for i := 0; i < 8; i++ {
w := D2PI * t
a := w / pqPer[i][0]
s := math.Sin(a)
c := math.Cos(a)
p += c*pqPer[i][1] + s*pqPer[i][3]
q += c*pqPer[i][2] + s*pqPer[i][4]
}
// 多项式项
w := 1.0
for i := 0; i < 4; i++ {
p += pqPol[0][i] * w
q += pqPol[1][i] * w
w *= t
}
// 转换为弧度
p *= AS2R
q *= AS2R
// 形成黄极向量
z := math.Sqrt(math.Max(1.0-p*p-q*q, 0.0))
s := math.Sin(EPS0)
c := math.Cos(EPS0)
return Vector3{p, -q*c - z*s, -q*s + z*c}
}
// 计算长期岁差的赤道极向量
func ltpPEQU(epj float64) Vector3 {
// 多项式系数
xyPol := [2][4]float64{
{+5453.282155, +0.4252841, -0.00037173, -0.000000152},
{-73750.930350, -0.7675452, -0.00018725, +0.000000231},
}
// 周期项系数
xyPer := [14][5]float64{
{256.75, -819.940624, 75004.344875, 81491.287984, 1558.515853},
{708.15, -8444.676815, 624.033993, 787.163481, 7774.939698},
{274.20, 2600.009459, 1251.136893, 1251.296102, -2219.534038},
{241.45, 2755.175630, -1102.212834, -1257.950837, -2523.969396},
{2309.00, -167.659835, -2660.664980, -2966.799730, 247.850422},
{492.20, 871.855056, 699.291817, 639.744522, -846.485643},
{396.10, 44.769698, 153.167220, 131.600209, -1393.124055},
{288.90, -512.313065, -950.865637, -445.040117, 368.526116},
{231.10, -819.415595, 499.754645, 584.522874, 749.045012},
{1610.00, -538.071099, -145.188210, -89.756563, 444.704518},
{620.00, -189.793622, 558.116553, 524.429630, 235.934465},
{157.87, -402.922932, -23.923029, -13.549067, 374.049623},
{220.30, 179.516345, -165.405086, -210.157124, -171.330180},
{1200.00, -9.814756, 9.344131, -44.919798, -22.899655},
}
// 计算从J2000.0起算的儒略世纪数
t := (epj - 2000.0) / 100.0
// 初始化X和Y累加器
x, y := 0.0, 0.0
// 周期项
for i := 0; i < 14; i++ {
w := D2PI * t
a := w / xyPer[i][0]
s := math.Sin(a)
c := math.Cos(a)
x += c*xyPer[i][1] + s*xyPer[i][3]
y += c*xyPer[i][2] + s*xyPer[i][4]
}
// 多项式项
w := 1.0
for i := 0; i < 4; i++ {
x += xyPol[0][i] * w
y += xyPol[1][i] * w
w *= t
}
// 转换为弧度
x *= AS2R
y *= AS2R
// 形成赤道极向量
w = x*x + y*y
z := 0.0
if w < 1.0 {
z = math.Sqrt(1.0 - w)
}
return Vector3{x, y, z}
}
// 向量叉乘
func pxp(a, b Vector3) Vector3 {
return Vector3{
a[1]*b[2] - a[2]*b[1],
a[2]*b[0] - a[0]*b[2],
a[0]*b[1] - a[1]*b[0],
}
}
// 向量归一化
func pn(p Vector3) (Vector3, float64) {
w := math.Sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2])
if w == 0.0 {
return Vector3{0, 0, 0}, 0
}
return Vector3{p[0] / w, p[1] / w, p[2] / w}, w
u, w := ltp.Normalize(ltp.Vector3(p))
return Vector3(u), w
}
// 计算长期岁差矩阵