feat: 完善日月食与月掩几何链路并扩展历法接口
- 新增日月食中心带、偏食带、阴影足迹、等时线、食分线及升落边界计算,支持极区与混合食拓扑 - 新增日食单时刻阴影求解器、站心状态查询、批量采样和 ΔT 覆盖接口 - 重构恒星与行星月掩路径,补充有限盘面接触、站心修正、掩带宽度、极区投影及升落边界 - 扩展 SVG 与 GeoJSON 输出,支持详细面板、全球/极区/地球投影、边界闭合、时间标记和拓扑签名 - 扩展日月食候选搜索、局地搜索、沙罗序列预计算与范围外推,补充系列锚点和成员一致性校验 - 补齐古历纪年、儒略历独有闰日、多公历候选、历法改革跨日及精确日期运算接口 - 优化 ΔT、章动、恒星时、月球地平线、事件根搜索和本地星历缓存,降低重复计算开销并提升边界稳定
This commit is contained in:
+11
-1
@@ -4,31 +4,37 @@ import (
|
||||
"math"
|
||||
)
|
||||
|
||||
// Sin 正弦,角度参数单位为度 / sine; the angle is in degrees.
|
||||
func Sin(x float64) float64 {
|
||||
return (math.Sin(x * math.Pi / 180.00000))
|
||||
}
|
||||
|
||||
// Cos 余弦,角度参数单位为度 / cosine; the angle is in degrees.
|
||||
func Cos(x float64) float64 {
|
||||
return (math.Cos(x * math.Pi / 180.00000))
|
||||
}
|
||||
|
||||
// Tan 正切,角度参数单位为度 / tangent; the angle is in degrees.
|
||||
func Tan(x float64) float64 {
|
||||
return (math.Tan(x * math.Pi / 180.00000))
|
||||
}
|
||||
|
||||
// ArcSin 反正弦,结果单位为度 / arc sine; the result is in degrees.
|
||||
func ArcSin(x float64) float64 {
|
||||
return (math.Asin(x) / math.Pi * 180.00000)
|
||||
}
|
||||
|
||||
// ArcCos 反余弦,结果单位为度 / arc cosine; the result is in degrees.
|
||||
func ArcCos(x float64) float64 {
|
||||
return (math.Acos(x) / math.Pi * 180.00000)
|
||||
}
|
||||
|
||||
// ArcTan 反正切,结果单位为度 / arc tangent; the result is in degrees.
|
||||
func ArcTan(x float64) float64 {
|
||||
return (math.Atan(x) / math.Pi * 180.00000)
|
||||
}
|
||||
|
||||
// ArcTan2 计算两个变量的反正切并转换为角度,处理所有象限
|
||||
// ArcTan2 两变量反正切,结果单位为度并归一到 [0,360) / two-argument arc tangent; the result is in degrees and normalized to [0,360).
|
||||
func ArcTan2(y, x float64) float64 {
|
||||
angle := math.Atan2(y, x) * 180.0 / math.Pi
|
||||
if angle < 0 {
|
||||
@@ -37,11 +43,13 @@ func ArcTan2(y, x float64) float64 {
|
||||
return angle
|
||||
}
|
||||
|
||||
// FloatRound 四舍五入到 n 位小数,实现为 floor(f*10^n+0.5) / round to n decimal places via floor(f*10^n+0.5).
|
||||
func FloatRound(f float64, n int) float64 {
|
||||
p := math.Pow10(n)
|
||||
return math.Floor(f*p+0.5) / p
|
||||
}
|
||||
|
||||
// Limit360 把角度归一到 [0,360) / normalize an angle into [0,360).
|
||||
func Limit360(x float64) float64 {
|
||||
x = math.Mod(x, 360)
|
||||
if x < 0 {
|
||||
@@ -50,10 +58,12 @@ func Limit360(x float64) float64 {
|
||||
return x
|
||||
}
|
||||
|
||||
// FR 四舍五入到 14 位小数 / round to 14 decimal places.
|
||||
func FR(f float64) float64 {
|
||||
return FloatRound(f, 14)
|
||||
}
|
||||
|
||||
// Abs 取 int 的绝对值,只接受 int,与 math.Abs 同名且不支持浮点 / absolute value of an int; same name as math.Abs but accepts only int.
|
||||
func Abs(x int) int {
|
||||
if x < 0 {
|
||||
return -x
|
||||
|
||||
Reference in New Issue
Block a user