Classic Computer Magazine Archive COMPUTE! ISSUE 94 / MARCH 1988 / PAGE 83

"Math Draw" is a menu-driven program that can create graphic webs, seashells, and wheels.

Math Draw For Amiga

Rhett Anderson

Create complex geometric patterns with this menu-driven graphics program for the Amiga. When you've finished, you can save your picture as an IFF graphics file for use with Deluxe Paint II and other Amiga paint programs. Requires 512K.

"Math Draw" lets you create intricate geometric designs and patterns, even if you don't understand the mathematics behind them. Use the special menu to select from a palette of 32 different colors and several different drawing options. When you've finished your picture, you can save it in IFF ILBM format, which is used by most paint programs.

Math Draw is written in Amiga Basic. Type it in and save it to disk. When you're ready to use the program, load and run it.

Math Draw starts drawing immediately. After you've seen the pattern it draws, activate the Amiga menus by pressing the right mouse button. Math Draw adds an Option menu to Amiga Basic's menus. While holding the right button, slide the mouse pointer up to the word Option to see the new menu options. To choose an option, release the button while pointing to the desired option. Here is a list of the new options:

Color Control. When you activate this function, you'll be presented with a chart which shows 32 colors, each labeled with a number. Choose a new drawing color by entering a number. The 32 colors are fixed; they cannot be changed from within the program. If you wish to change the colors, you'll need to modify the numbers in the first set of DATA statements in the program.

Radius Control. Math Draw works by moving an imaginary circle inside or outside another imaginary circle. The drawing pen is "attached" to the edge of the moving circle. You change the size of these circles (and thus the scale of your drawing) by choosing the Radius Control menu selection. You'll be asked for new radius values for the circles.

Growth Control. If you choose, the imaginary circles used to move the drawing pen can grow at a fixed rate. This feature can be used to create spirals and shell designs. Normally, you'll want to keep this parameter at its default value, 0. A reasonable growth rate is 0.01. A negative number will make the circles shrink.

Type Control. This option lets you choose between drawing epicycloids and hypocycloids. In an epicycloid, the moving circle moves around the outside of the stationary circle. In a hypocycloid, the moving circle moves around the inside of the stationary one.

Pause. This option halts drawing. After selecting this option, the drawing pen freezes. This is useful when you want to make several changes to the pen at once. For instance, you may want to change the pen color and the outer radius at the same time. Select Pause and then use the menu options to select the new color and the new radii. Continue is used to start the pen moving again.

Continue. Ends Pause mode.

Save Picture. Saves your picture as an IFF file compatible with Deluxe Paint II, Digi-Paint, Aegis Images, and other Amiga paint programs. Since the save routine is written entirely in BASIC, it takes a few minutes to save a picture. Be sure not to drop any menus down while the picture is being saved, or else you'll see ghosts of the menus in your saved pictures.

Clear. Clears the screen. Since your work could be lost if you accidently select this option, you'll be asked whether you're sure you want to clear the screen.

Quit. Exits to BASIC cleanly. You should always use this menu option to stop the program. If you quit another way, type MENU RESET to disable the Math Draw menu and SCREEN CLOSE 1 to free up the screen created by Math Draw. Since your work could be lost if you select this option accidently, you'll be asked whether you're sure you want to quit.

Your First Drawing

Let's create a picture. First, select Pause to freeze the drawing pen. Now select Clear to erase any picture that might be on the screen. Select Color Control and pick a color. Now select Radius Control. Type 30 at the first prompt, 8 at the second. Select Continue, and a pattern will be drawn. When the pattern begins to repeat, select Pause again and then change the color. Change the radii to 50 and 10. Repeat this process until you're satisfied with your picture. If you wish to save it, select the Save option.

When you're ready for a new effect, turn on the Growth control. A moderate value for Growth is 0.01, but try values like 0.001,1, and 10 to see how Growth works.

The following table has six sets of parameters that produce attractive designs. After seeing what they do, try combining them.

Radius 1 Radius 2 Growth Type
120 35 0 2
75 25 -.1 1
10 45 0 2
80 46 0 2
30 16 0 1
40 16 0 1

After you have saved a couple of pictures, go to a paint program and fill in different areas with different colors. From within the paint program, you can modify the palette colors if you like.