1、逐点比较法三、四象限逆圆插补计算 第三象限 第四象限 Private Sub Command1_Click() Picture1.ForeColor = vbBlack Picture1.DrawWidth = 2 Picture1.Line (500, 1000)-(8500, 1000) 画直线坐标轴 Picture1.Line (4500, 1000)-(4500, 5000) Picture1.CurrentX = 230 当前位置 Picture1.CurrentY = 900 Picture1.Print “-X“ 坐标轴标注 Picture1.CurrentX = 4300 Pi
2、cture1.CurrentY = 800 Picture1.Print “(0,0)“ Picture1.CurrentX = 8650 Picture1.CurrentY = 900 Picture1.Print “X“ Picture1.CurrentX = 4400 Picture1.CurrentY = 5100 Picture1.Print “-Y“ Picture1.Line (500, 1000)-(600, 950) 箭头 Picture1.Line (500, 1000)-(600, 1050) Picture1.Line (8500, 1000)-(8400, 950)
3、Picture1.Line (8500, 1000)-(8400, 1050) Picture1.Line (4500, 5000)-(4450, 4900) Picture1.Line (4500, 5000)-(4550, 4900) End Sub Private Sub 坐标判别_Click() If Not (Option1.Value = True Or Option2.Value = True) Then ans = MsgBox(“出错了,请选择象限“, 48, “ 提示信息“) End If Dim a, b, c, d, n, m As Integer Dim r As S
4、ingle a = Val(Text1.Text) b = Val(Text2.Text) c = Val(Text3.Text) d = Val(Text4.Text) n = a * a + b * b m = c * c + d * d r = Sqr(n) If Option1.Value = True Then If Not (a = 0 And b = 0 And d = 0 And b = 0 And d = 0 And j 0 Then m = m + 1 k = k + 1 F(m) = F(m - 1) - 2 * Abs(Y(m - 1) + 1 X(m) = X(m -
5、 1) Y(m) = Y(m - 1) + 1 Picture1.Line (4500 + 300 * (a + l), 1000 - 300 * (b + k - 1)-(4500 + 300 * (a + l), 1000 - 300 * (b + k) Form1.CurrentX = 200 Form1.CurrentY = 200 + m * 300 Print “第“ & m & “步“, “ -Y “, “F(“ & m & “)=“ & F(m), “ X(“ & m & “)=“ & X(m), “ Y(“ & m & “)=“ & Y(m), “ Xe = “ & Int(
6、Text4), “ Ye = “ & Int(Text3), “ = “ & j - n Else l = l + 1 m = m + 1 F(m) = F(m - 1) + 2 * Abs(X(m - 1) + 1 Y(m) = Y(m - 1) X(m) = X(m - 1) + 1 Picture1.Line (4500 + 300 * (a + l - 1), 1000 - 300 * (b + k)-(4500 + 300 * (a + l), 1000 - 300 * (b + k) Form1.CurrentX = 200 Form1.CurrentY = 200 + m * 3
7、00 Print “第“ & m & “步“, “ +X “, “F(“ & m & “)=“ & F(m), “ X(“ & m & “)=“ & X(m), “ Y(“ & m & “)=“ & Y(m), “ Xe = “ & Int(Text4), “ Ye = “ & Int(Text3), “ = “ & j - n End If Next n End If End Sub Private Sub Command3_Click() 清除 Text1.Text = “ Text2.Text = “ Text3.Text = “ Text4.Text = “ Picture1.Cls Form1.Cls Text1.SetFocus