feat: 新增月掩与日月食地理绘图并提升观测计算精度

- 新增月掩恒星和行星:支持搜索、掩甚点、全球掩带及固定地点轨迹计算
- 支持恒星星表坐标转换、有限盘面行星接触事件和月掩 SVG 输出
- 新增日月食及月掩全球投影图、时间标记和 GeoJSON 地理数据接口
- 扩展日食中心线、南北界及偏食足迹采样,支持极区投影
- 修正站心时角、月出月落、月球视半径、折射和恒星自行计算
- 优化内外行星事件搜索、边界选择、极端输入处理和计算稳定性
This commit is contained in:
2026-08-06 12:00:56 +08:00
parent 25dc7ac0bc
commit 9ee2163cc7
137 changed files with 21770 additions and 1746 deletions
+37
View File
@@ -0,0 +1,37 @@
package geodata
import (
"math"
"testing"
)
func TestPolylineSegmentsTreatsExactAntimeridianAsOneMeridian(t *testing.T) {
segments := PolylineSegments([]GeoPoint{
{Longitude: -180, Latitude: 10},
{Longitude: 180, Latitude: 20},
}, ProjectionEquirectangular)
if len(segments) != 1 || len(segments[0]) != 2 {
t.Fatalf("exact-antimeridian line segments = %#v", segments)
}
if segments[0][0].Longitude != segments[0][1].Longitude {
t.Fatalf("exact-antimeridian line spans %.1f degrees",
math.Abs(segments[0][1].Longitude-segments[0][0].Longitude))
}
}
func TestPolygonFragmentsDropsExactAntimeridianZeroAreaDuplicate(t *testing.T) {
fragments := PolygonFragments([]GeoPoint{
{Longitude: -180, Latitude: 15},
{Longitude: 180, Latitude: 14},
{Longitude: 150, Latitude: 13},
{Longitude: 150, Latitude: -12},
{Longitude: 180, Latitude: -11},
{Longitude: -180, Latitude: -10},
}, ProjectionEquirectangular)
if len(fragments) != 1 {
t.Fatalf("exact-antimeridian polygon produced %d fragments, want 1", len(fragments))
}
if math.Abs(signedPolygonArea(fragments[0])) < 1e-12 {
t.Fatal("exact-antimeridian polygon fragment has zero area")
}
}