lagier2005 发表于 2004-12-16 21:34:07

[VBA函数]:测量中常用的角度转换

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

自由的鱼 发表于 2004-12-17 23:53:36

不错,这样转换角度确实不错!!

zh_6531394 发表于 2004-12-21 11:09:48

怎么用

hojing7 发表于 2004-12-27 01:06:18

希望能教如何使用
感激不盡

wangxj2002 发表于 2004-12-27 19:51:16

楼主,怎么使用呀??

清风明月10 发表于 2013-6-27 08:21:50

太谢谢楼主了,我正需要这个呢。
页: [1]
查看完整版本: [VBA函数]:测量中常用的角度转换