|
|
测量中常用的角度转换(CAD程序)Lisp Public Const M_SEC# = 206264.8 Public Const M_DEG# = 57.2957795130823 Public Const M_RAD# = 1.74532925199433E-02 Public Const M_PI# = 3.14159265358979 Public Function Rad(ByVal angle As Double) As Double Dim a As Double, B As Double, c As Double, d As Double Dim ang As Double, sign As Integer ang = Abs(angle) + 0.0000000000001: sign = Sgn(angle) a = Int(ang): B = (ang - a) * 100#: c = Int(B): d = (B - c) * 100# Rad = sign * (a + c / 60# + d / 3600#) * M_RAD End Function Public Function Dms(ByVal radian As Double) As Double Dim a As Double, B As Double, c As Double, d As Double, e As Double Dim ang As Double, sign As Integer ang = Abs(radian) + 0.00000000000001: sign = Sgn(radian): a = ang * M_DEG B = Int(a): c = (a - B) * 60: d = Int(c): e = (c - d) * 60 Dms = sign * (B + d / 100# + e / 10000#) End Function
|
|
|