[VBA函数]:测量中常用的角度转换
Public Const M_SEC# = 206264.8Public 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 不错,这样转换角度确实不错!! 怎么用 希望能教如何使用
感激不盡 楼主,怎么使用呀?? 太谢谢楼主了,我正需要这个呢。
页:
[1]