Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDraw a Bowditch curve (or Curve of Lissajous)
KeywordsBowditch, Lissajous, curve
CategoriesGraphics
 
The Bowditch curve 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 * Sin(3 * t / 4)
End Function

' The parametric function Y(t).
Private Function Y(ByVal t As Single) As Single
    Y = 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