- 新增日食、月食、本地可见性、中心线、半影区域、SVG 图示与沙罗周期信息 - 新增行星冲合、留、方照、物理星历、视直径、相位、亮肢角、轨道节点等计算 - 新增木星伽利略卫星位置、现象与接触事件计算 - 新增恒星星表、星座判定、自行修正与观测辅助能力 - 新增 coord、formula、orbit、sundial、lite/sun、lite/moon 等扩展包 - 完善农历年号、月相英文别名、视差角、大气质量、折射、日晷与双星计算 - 增加 NASA、JPL Horizons、IMCCE 等回归测试数据与基线测试 - 重构基础算法文件组织,补充大量公开 API 注释和语义回归测试 - 更新中文和英文 README,补充示例、精度说明、SVG 配图
62 lines
2.9 KiB
Go
62 lines
2.9 KiB
Go
package basic
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type venusEventFunc func(float64) float64
|
|
|
|
type venusEventCase struct {
|
|
name string
|
|
tolerance float64
|
|
fn venusEventFunc
|
|
}
|
|
|
|
func venusEventSamples() []time.Time {
|
|
start := time.Date(1994, 2, 3, 4, 56, 12, 345000000, time.UTC)
|
|
samples := make([]time.Time, 0, 96)
|
|
for i := 0; i < 48; i++ {
|
|
d := start.AddDate(0, 0, i*173)
|
|
d = d.Add(time.Duration((i%9)*5)*time.Hour + time.Duration((i%7)*11)*time.Minute + time.Duration((i%13)*13)*time.Second)
|
|
samples = append(samples, d)
|
|
}
|
|
extraStart := start.AddDate(0, 0, 29)
|
|
for i := 0; i < 48; i++ {
|
|
d := extraStart.AddDate(0, 0, i*127)
|
|
d = d.Add(time.Duration((i%8)*6)*time.Hour + time.Duration((i%10)*13)*time.Minute + time.Duration((i%15)*17)*time.Second)
|
|
samples = append(samples, d)
|
|
}
|
|
return samples
|
|
}
|
|
|
|
func venusEventSampleTTJD(date time.Time) float64 {
|
|
return TD2UT(Date2JDE(date.UTC()), true)
|
|
}
|
|
|
|
func venusEventCases() []venusEventCase {
|
|
const (
|
|
conjunctionTolerance = 0.00001
|
|
searchTolerance = 30.0 / 86400.0
|
|
)
|
|
return []venusEventCase{
|
|
{name: "LastVenusConjunction", tolerance: conjunctionTolerance, fn: LastVenusConjunction},
|
|
{name: "NextVenusConjunction", tolerance: conjunctionTolerance, fn: NextVenusConjunction},
|
|
{name: "LastVenusInferiorConjunction", tolerance: conjunctionTolerance, fn: LastVenusInferiorConjunction},
|
|
{name: "NextVenusInferiorConjunction", tolerance: conjunctionTolerance, fn: NextVenusInferiorConjunction},
|
|
{name: "LastVenusSuperiorConjunction", tolerance: conjunctionTolerance, fn: LastVenusSuperiorConjunction},
|
|
{name: "NextVenusSuperiorConjunction", tolerance: conjunctionTolerance, fn: NextVenusSuperiorConjunction},
|
|
{name: "LastVenusRetrograde", tolerance: searchTolerance, fn: LastVenusRetrograde},
|
|
{name: "NextVenusRetrograde", tolerance: searchTolerance, fn: NextVenusRetrograde},
|
|
{name: "LastVenusProgradeToRetrograde", tolerance: searchTolerance, fn: LastVenusProgradeToRetrograde},
|
|
{name: "NextVenusProgradeToRetrograde", tolerance: searchTolerance, fn: NextVenusProgradeToRetrograde},
|
|
{name: "LastVenusRetrogradeToPrograde", tolerance: searchTolerance, fn: LastVenusRetrogradeToPrograde},
|
|
{name: "NextVenusRetrogradeToPrograde", tolerance: searchTolerance, fn: NextVenusRetrogradeToPrograde},
|
|
{name: "LastVenusGreatestElongation", tolerance: searchTolerance, fn: LastVenusGreatestElongation},
|
|
{name: "NextVenusGreatestElongation", tolerance: searchTolerance, fn: NextVenusGreatestElongation},
|
|
{name: "LastVenusGreatestElongationEast", tolerance: searchTolerance, fn: LastVenusGreatestElongationEast},
|
|
{name: "NextVenusGreatestElongationEast", tolerance: searchTolerance, fn: NextVenusGreatestElongationEast},
|
|
{name: "LastVenusGreatestElongationWest", tolerance: searchTolerance, fn: LastVenusGreatestElongationWest},
|
|
{name: "NextVenusGreatestElongationWest", tolerance: searchTolerance, fn: NextVenusGreatestElongationWest},
|
|
}
|
|
}
|