Private Sub DrawCurve()
Const PI As Double = 3.14159265
Const NUM_LINES As Long = 5000
Const NUM_COLORS As Integer = 6
Dim i As Long
Dim t As Double
Dim expr As Double
Dim r As Double
Dim x As Double
Dim y As Double
Dim colors(0 To NUM_COLORS - 1) As OLE_COLOR
' Initialize colors.
i = 0
colors(i) = RGB(255, 0, 0): i = i + 1
colors(i) = RGB(0, 255, 0): i = i + 1
colors(i) = RGB(0, 0, 255): i = i + 1
colors(i) = RGB(255, 255, 0): i = i + 1
colors(i) = RGB(0, 255, 255): i = i + 1
colors(i) = RGB(255, 0, 255): i = i + 1
' Get the first point.
t = 0
r = 5 * (1 + Sin(11 * t / 5)) - 4 * Sin(17 * t / 3) ^ 4 _
* Sin(2 * Cos(3 * t) - 28 * t) ^ 8
x = r * Cos(t)
y = r * Sin(t)
' I switch these for vertical symmetry.
Me.CurrentX = y
Me.CurrentY = -x
Me.DrawWidth = 2
For i = 1 To NUM_LINES - 1
t = i * 21# * PI / NUM_LINES
r = 5 * (1 + Sin(11 * t / 5)) - 4 * Sin(17 * t / 3) _
^ 4 * Sin(2 * Cos(3 * t) - 28 * t) ^ 8
x = r * Cos(t)
y = r * Sin(t)
'Line -(y, -x),vbblue
Line -(y, -x), colors((i * 21 / NUM_LINES) Mod _
NUM_COLORS)
Next i
End Sub
|