测量方位角计算公式VB源代码

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

测量方位角计算公式VB源代码

角度化弧度

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

相关文档
最新文档