求渐开线坐标点计算程序!!!
哪位大神有渐开线坐标点计算的程序或者会的给编一个啊!谢谢啦!!!
渐开线方程(其中θ为弧度):x=r*(cos(θ)+θ*sin(θ)),y=r*(sin(θ)-θ*cos(θ))
据此所写vb代码和运行效果图如下(只需在窗体里放一个命令按钮,代码在按钮事件里):
Private Sub Command1_Click()
Dim r As Integer, x As Single, y As Single, t As Integer, i As Single, j As Single
Dim xo As Integer, yo As Integer
Const pi = 3.1415926 '定义圆周率值
r = Me.ScaleHeight * 0.15 '圆半径为窗体高的1/5
xo = Me.ScaleWidth / 2
yo = Me.ScaleHeight / 2 '定义圆心坐标
For i = 0 To 359.9 Step 0.1
'画基圆
j = i * pi / 180
x = xo + r * Cos(j)
y = yo - r * Sin(j)
Me.PSet (x, y), vbBlack
Next
For i = 0 To 180 Step 0.1 '角度从0度到180度,角度步长为0.1度
'画渐开线
j = i * pi / 180 '角度转换为弧度
x = xo + r * (Cos(j) + j * Sin(j)) '获取横坐标值
y = yo - r * (Sin(j) - j * Cos(j)) '获取纵坐标值
Me.PSet (x, y), vbBlue '画点
Next
End Sub