帮忙看下这个程序哪里有问题
目的是选取任意两点计算方位角,代码如下:<br/>Sub calculateangel()<br/> Dim point1 As Variant<br/> Dim point2 As Variant<br/> p1 = ThisDrawing.Utility.GetPoint(, vbCrLf & "第一点:")<br/> p2 = ThisDrawing.Utility.GetPoint(, vbCrLf & "第二点:")<br/> Const pi As Single = 3.14<br/> Dim x As Double<br/> Dim y As Double<br/> Dim z As Double<br/> Dim ang1to2 As Double<br/> x = point1(0) - point2(0)<br/> y = point1(1) - point2(1)<br/> z = point1(2) - point2(2)<br/> ang1to2 = pi - Sgn(y) * pi / 2 - Atn(y / x)<br/> MsgBox "两点之间的方位角为:" & ang1to2, , "个计算单位"<br/>End Sub<br/>希望高手尽快给个解答! point1,point2这两个变量与p1,p2是什么关系。<br/>pi精度太低了吧,这样出来的角度偏差有点大。<br/>如果只是求点选的两个点的角度,可以直接调用GetAngle方法。
页:
[1]