设为首页收藏本站

路桥隧 - 免费·分享·共赢

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

测量角度计算公式

1970-1-1 08:00| 发布者: lq52搜集| 查看: 2560| 评论: 0|原作者: lq52搜集|来自: 不详

'角度化弧度
Public Function Radian(a As Double) As Double
  Dim Ra As Double
  Dim c As Double
  Dim FS As Double
  Dim Ib As Integer
  Dim Ic As Integer
  Ra = pi / 180#
  Ib = Int(a)
  c = (a - Ib) * 100#
  Ic = Int(c)
  FS = (c - Ic) * 100#
  Radian = (Ib + Ic / 60# + FS / 3600#) * Ra
End Function
'弧度化角度
Public Function Degree(a As Double) As Double
  Dim B As Double
  Dim Fs1 As Double
  Dim Im1 As Integer
  Dim Id1 As Integer
  B = a
  Call DMS(B, Id1, Im1, Fs1)
  Degree = Id1 + Im1 / 100# + Fs1 / 10000#
End Function

Public Sub DMS(a As Double, ID As Integer, IM As Integer, FS As Double)
  Dim B As Double
  Dim c As Double
  c = a
  c = 180# / pi * c
  ID = Int(c + 0.0000005)
  B = (c - ID) * 60 + 0.0005
  IM = Int(B)
  FS = (B - IM) * 60

End Sub

'计算两点间的方位角
Public Function azimuth(x1 As Double, y1 As Double, x2 As Double, y2 As Double) As Single
  Dim dx As Double
  Dim dy As Double
  Dim fwj As Double
  dx = x2 - x1
  dy = y2 - y1
  If dy <> 0 Then
    fwj = pi * (1 - Sgn(dy) / 2) - Atn(dx / dy)
    azimuth = Degree(fwj)
  Else
    If dx > 0 Then
      azimuth = 0
    Else
      azimuth = 180
    End If
  End If

End Function

最新评论

QQ|【路桥隧】 ( 湘ICP备16018960号-1 )  QQ群:【路桥吾爱-lq52.com】

GMT+8, 2026-4-2 09:40

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

返回顶部