Files
astro/basic/orbit_phase.go
T
b612 16c62a97d5 feat: 完善时标与天象几何计算并扩展输出接口
- 新增时标、ΔT 模型、质心时间与 UT1 支持
- 改进日月食、月掩、行星事件及路径边界计算
- 完善恒星三维自行与动态距离传播
- 扩展 SVG、GeoJSON、KML 输出与底层距离换算工具
- 整理中英文手册、示例资源及回归测试
2026-09-23 18:55:12 +08:00

40 lines
1.6 KiB
Go

package basic
import . "b612.me/astro/tools"
// OrbitSunDistance 返回轨道目标在给定 TT/TDB 儒略日的日心距离,单位 AU。
func OrbitSunDistance(jde float64, elements OrbitElements) float64 {
_, _, distance := OrbitHeliocentricEclipticJ2000(jde, elements)
return distance
}
// OrbitEarthDistance 返回轨道目标在给定 TT/TDB 儒略日的地心距离,单位 AU。
func OrbitEarthDistance(jde float64, elements OrbitElements) float64 {
_, _, distance := OrbitGeocentricEclipticJ2000(jde, elements)
return distance
}
// OrbitPhaseAngle 返回轨道目标的相位角,单位度。
func OrbitPhaseAngle(jde float64, elements OrbitElements) float64 {
return ArcCos(orbitPhaseCosine(jde, elements))
}
// OrbitIlluminatedFraction 返回轨道目标的被照亮比例。
func OrbitIlluminatedFraction(jde float64, elements OrbitElements) float64 {
return (1 + orbitPhaseCosine(jde, elements)) / 2
}
// OrbitElongation 返回轨道目标相对于太阳的地心视角距,单位度。
func OrbitElongation(jde float64, elements OrbitElements) float64 {
lon, lat, _ := OrbitApparentGeocentricEcliptic(jde, elements)
return StarAngularSeparation(lon, lat, HSunApparentLo(jde), HSunTrueBo(jde))
}
func orbitPhaseCosine(jde float64, elements OrbitElements) float64 {
sunDistance := OrbitSunDistance(jde, elements)
earthDistance := OrbitEarthDistance(jde, elements)
earthSunDistance := EarthAway(jde)
cosine := (sunDistance*sunDistance + earthDistance*earthDistance - earthSunDistance*earthSunDistance) / (2 * sunDistance * earthDistance)
return clampUnit(cosine)
}