Private Sub Form_Load()
Const PI = 3.14159265
Dim x As Single
Dim y As Single
Dim r As Single
Dim t As Single
Dim dt As Single
' Set a convenient scale.
picGraph.AutoRedraw = True
picGraph.Scale (-2, 2)-(2, -2)
' Draw axes.
picGraph.Line (-2, 0)-(2, 0), vbBlue
For x = -2 To 2 Step 0.5
picGraph.Line (x, -0.1)-(x, 0.1), vbBlue
Next x
picGraph.Line (0, -2)-(0, 2), vbBlue
For y = -2 To 2 Step 0.5
picGraph.Line (-0.1, y)-(0.1, y), vbBlue
Next y
' Draw the parametric curve.
t = 0
dt = PI / 100
picGraph.CurrentX = 0
picGraph.CurrentY = 0
Do While t <= 2 * PI
r = 2 * Sin(5 * t)
x = r * Cos(t)
y = r * Sin(t)
picGraph.Line -(x, y)
t = t + dt
Loop
picGraph.Line -(0, 0)
End Sub
|