     Home Search   What's New Index Books Links Q & A Newsletter Banners   Feedback Tip Jar     MSDN Visual Basic Community   Title Draw a epitrochoid epitrochoid, curve Graphics The epitrochoid is represented by the following parametric functions as t ranges from 0 to 8 * Pi.

```' The parametric function X(t).
Private Function X(ByVal t As Single) As Single
X = 8 * Cos(t / 4) - 7 * Cos(t)
End Function

' The parametric function Y(t).
Private Function Y(ByVal t As Single) As Single
Y = 8 * Sin(t / 4) - 7 * Sin(t)
End Function```

In the form's Paint event handler, the program calls the DrawCurve subroutine to connect points defined by these functions.

```' Draw the curve on the form.
Private Sub DrawCurve(ByVal start_t As Single, ByVal stop_t _
As Single, ByVal dt As Single)
Dim t As Single

Cls
CurrentX = X(start_t)
CurrentY = Y(start_t)

t = start_t + dt
Do While t < stop_t
Line -(X(t), Y(t))
t = t + dt
Loop

Line -(X(stop_t), Y(stop_t))
End Sub```

See my book Visual Basic Graphics Programming for more information on drawing other interesting curves normally or transformed (stretched, squashed, or rotated).  Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.  Updated 