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 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
expr = Exp(Cos(t)) - 2 * Cos(4 * t) - Sin(t / 12) ^ 5
x = Cos(t) * expr
y = Sin(t) * expr
' I switch these for vertical symmetry.
Me.CurrentX = y
Me.CurrentY = -x
Me.DrawWidth = 2
For i = 1 To NUM_LINES - 1
t = i * 24# * PI / NUM_LINES
expr = Exp(Cos(t)) - 2 * Cos(4 * t) - Sin(t / 12) ^ _
5
x = Cos(t) * expr
y = Sin(t) * expr
'Line -(y, -x),vbblue
Line -(y, -x), colors((i * 24 / NUM_LINES) Mod _
NUM_COLORS)
Next i
End Sub
|