已解决,方法如下
function 角度转换 takes real x returns real //-180 - 180 转 0-360
local real r = x
if((x < 0))then
set r = 0 - x
set r = 180 - r
set r = 180 + r
endif
if((x > 180))then
set r = 180 - x
set r = r + 180
set r = 0 - r
endif
return r
endfunction
function 角度计算 takes real x , real j , real jd returns real //自动计算角度 辨别方向
local real array r
local integer i
if((x != j))then
set r[1] = GetJdzh(x)
set r[2] = GetJdzh(j)
set r[3] = 360 - r[1]
set r[3] = r[3] + r[2]
set r[4] = 360
if((r[3] > 360))then
set r[3] = r[3] - 360
endif
if((r[3] > 180))then
set r[4] = r[4] - r[3]
set r[5] = 0 - jd
set i = 4
else
set i = 3
set r[5] = jd
endif
set Wyss[9] = (180 - r[i]) / 180
if((r[i] <= jd))then
set Wyss[9] = 1
return j
endif
set r[6] = x + r[5]
if((r[6] < 0))then
set r[6] = 360 + r[6]
endif
if((r[6] > 360))then
set r[6] = r[6] - 360
endif
else
set Wyss[9] = 1
return j
endif
return GetJdzh(r[6])
endfunction