9ee2163cc7
- 新增月掩恒星和行星:支持搜索、掩甚点、全球掩带及固定地点轨迹计算 - 支持恒星星表坐标转换、有限盘面行星接触事件和月掩 SVG 输出 - 新增日月食及月掩全球投影图、时间标记和 GeoJSON 地理数据接口 - 扩展日食中心线、南北界及偏食足迹采样,支持极区投影 - 修正站心时角、月出月落、月球视半径、折射和恒星自行计算 - 优化内外行星事件搜索、边界选择、极端输入处理和计算稳定性
34 lines
900 B
Go
34 lines
900 B
Go
package geodata
|
|
|
|
import "testing"
|
|
|
|
func TestJoinPolylineSegmentsUsesBothResultEndpoints(t *testing.T) {
|
|
segments := [][]GeoPoint{
|
|
{
|
|
{Longitude: -179, Latitude: 16},
|
|
{Longitude: -41, Latitude: 64},
|
|
},
|
|
{
|
|
{Longitude: 51, Latitude: 60},
|
|
{Longitude: 179, Latitude: 16},
|
|
},
|
|
}
|
|
joined := JoinPolylineSegments(segments)
|
|
if len(joined) != 4 {
|
|
t.Fatalf("joined point count = %d, want 4", len(joined))
|
|
}
|
|
if absoluteLongitude(joined[0].Longitude) > 90 || absoluteLongitude(joined[len(joined)-1].Longitude) > 90 {
|
|
t.Fatalf("joined open endpoints are on the antimeridian: first=%+v last=%+v", joined[0], joined[len(joined)-1])
|
|
}
|
|
if angularDistanceDegrees(joined[1], joined[2]) > 3 {
|
|
t.Fatalf("nearest antimeridian endpoints were not joined: %+v -> %+v", joined[1], joined[2])
|
|
}
|
|
}
|
|
|
|
func absoluteLongitude(value float64) float64 {
|
|
if value < 0 {
|
|
return -value
|
|
}
|
|
return value
|
|
}
|