|
发表于 2007-1-6 21:47:00
|
显示全部楼层
' 按照起点、终点和凸度计算多段线中某一段的长度
Function GetArcLeng(PointS As Variant, PointE As Variant, Bugle As Double) As Double
Dim Angle As Double
Dim Radius As Double
Dim Length As Double
Dim Dist As Double
Dim i As Integer
' 计算起点到终点的长度
For i = LBound(PointS) To UBound(PointS)
Dist = Dist + ((PointS(i) - PointE(i)) ^ 2)
Next
Length = Sqr(Dist)
' 如果凸度为0,则为直线段,所以起点到终点的长度就是需要的长度
If Bugle = 0 Then
GetArcLeng = Length
Else
' 如果凸度不为零,则计算弧段的长度。按照凸度的定义,凸度为包角的1/4的正切值。
Angle = 4 * Atn(Abs(Bugle))
' 计算弧段的半径
Radius = (Length / 2) / Sin(Angle / 2)
' 计算弧段的长度
GetArcLeng = Radius * Angle
End If
End Function中的Bugle怎样得到其值? |
|