16c62a97d5
- 新增时标、ΔT 模型、质心时间与 UT1 支持 - 改进日月食、月掩、行星事件及路径边界计算 - 完善恒星三维自行与动态距离传播 - 扩展 SVG、GeoJSON、KML 输出与底层距离换算工具 - 整理中英文手册、示例资源及回归测试
37 lines
1.0 KiB
Go
37 lines
1.0 KiB
Go
package moon
|
|
|
|
import (
|
|
"time"
|
|
|
|
"b612.me/astro/basic"
|
|
)
|
|
|
|
// ApsisInfo 轨道极值事件 / orbital distance extremum event.
|
|
type ApsisInfo struct {
|
|
// Time 事件时刻,UTC / event time in UTC.
|
|
Time time.Time
|
|
// Distance 极值距离,单位 km / extremum distance in km.
|
|
Distance float64
|
|
}
|
|
|
|
// PerigeesInMonth 指定年月内的所有月球近地点 / all lunar perigees in the given Gregorian month.
|
|
func PerigeesInMonth(year int, month time.Month) []ApsisInfo {
|
|
return convertMoonApsisInfos(basic.MoonPerigees(year, month))
|
|
}
|
|
|
|
// ApogeesInMonth 指定年月内的所有月球远地点 / all lunar apogees in the given Gregorian month.
|
|
func ApogeesInMonth(year int, month time.Month) []ApsisInfo {
|
|
return convertMoonApsisInfos(basic.MoonApogees(year, month))
|
|
}
|
|
|
|
func convertMoonApsisInfos(events []basic.ApsisEvent) []ApsisInfo {
|
|
result := make([]ApsisInfo, 0, len(events))
|
|
for _, event := range events {
|
|
result = append(result, ApsisInfo{
|
|
Time: basic.JD2DateByZone(event.JD, time.UTC, false),
|
|
Distance: event.Distance,
|
|
})
|
|
}
|
|
return result
|
|
}
|