Parametric equations in 2D and 3D.
Please note that this page is designed to help you practice parametric equations. This is not how you should draw shapes with Logo in either 2D or 3D. See the other Logo pages for the best ways into Logo graphics.
Aims and objectives.
Plot a sin wave on the xy plane and use basic Logo commands. | Plot Lissajous' figures. | More complex parametric equations in 2D. | 3D parametric equations. | Getting Started with Logo If you need it! |
Drawing sin waves | |
Open the procedure editor by typing: edit "drawsin You are going to write a procedure which will plot a sin wave. If you want more help with procedures try the page in the LOGO basics section. | |
Type in this code (or cut and paste):
to drawsin Click save and exit in the file menu. |
Run your code at the command line: drawsin` The drawing turtle starts from the xy coordinate origin which is located at thecentre of the screen. the x-axis is horizontal with positive values to the right. The y-axis is vertical with up positive. |
Lissajous' Figures | |
You are going to edit a routine called "lissfigs. Once you have programmed this routine into Logo you can then call it just like one of the normal Logo commands. edit "lissfigs Now edit the code so that it reads like this.
to lissfigs :a1 :av1 :a2 :av2 :plots Now click on the "file" menu and select "save and exit". Run the code from the command line with: cs ht lissfigs 100 20 50 25 50000 |
The program works by using one sin wave to control the x-motion and a second sin wave to control the y-motion. The shape generated depends on the two angular velocities used used. These will execute their LCM of cycles before the trace repeats itself.
repcount-1 is used as the control parameter (time) so that "time" starts from 0. |
You can extend to 3 dimensions using this procedure.
to lissfigs3D :a1 :av1 :a2 :av2 :a3 :av3 :plots
You enter 3D mode by typing perspective into the command line. | |
Circles and Ellipses | |
This is the code for an ellipse or circle.
to para2 :a1 :av1 :a2 :plots | |
Complex Shapes | |
Ellipse modified by cosine function
to para3 :a1 :av1 :a2 :av2 :plots | |
Cycloids | |
Two circular motions added together.
to cycloid :a1 :av1 :a2 :av2 :plots |
Last updated 2nd February 2012