Solid States
A 3-D Object Plotting System

Solid States Graphic

24K Cassette or 32K Disk
by Tom Hudson

Most people who are familiar with the Atari personal computers will agree that their graphics are superior to any other computer in their price range. By using the Atari's high-resolution GRAPHICS 8 mode, one can produce very respectable images on the video screen. Combine this ability with Atari 1020 printer/plotter hard-copy, and you've got an excellent, low-cost graphics machine.

This article presents a program which lets you show three-dimensional objects on the screen or print them out on a 1020 plotter. You can view the objects from any angle, with true perspective. If you like, object data can be stored on cassette or disk for future use.

The basics of 3-D.

In order to describe any object in our three-dimensional world, we must give at least three coordinates. These coordinates are usually labeled X (length), Y (width) and Z (height). This 3-D program is no exception. When you want to show an object, you must break it down into a number of points. Each point has its own set of X, Y and Z coordinates, which tells the computer where the point is located in space.

In addition to the locations of the points, we must tell the computer how these points are connected to form the sides of the object. The final result will be a "wire-frame" graphic representation of the object (so called because the object looks like it is constructed out of thin wires strung between the individual points of the object). Figure 1 shows the wire-frame representation of a pyramid.

[Pyramid Graphic]
Figure 1

The pyramid in Figure 1 is made up of five points (labeled 1-5) and eight lines. Let's see how we find the coordinates of the points of this pyramid.

First we must draw a top view of the pyramid. A piece of graph paper is best for this. Draw two per- pendicular lines on the paper as in Figure 2. Label the horizontal line X, the vertical line Y and number the lines as shown. These will be the X and Y axes, the first two coordinates in the X-Y-Z group.

[X-Y Graph]
Figure 2

Next, draw the top view of the 3-D object and number each point where two or more lines intersect. Figure 3 shows the top view of our pyramid with its five points labeled.

[Pyramid Top View]
Figure 3

Now draw another set of axis lines and label the horizontal line X and the vertical line Z. This set of axes will be used to draw a side view of the object in order to get the height coordinate (Z) for each point. Figure 4 shows the X-Z axes with the side view of out pyramid. Note that points 2 and 5 are at the same location on the side view, as are points 3 and 4. This is because they have the same X and Z locations.

[Pyramid Side View]
Figure 4

Now that we've drawn our pyramid, we can write down the coordinates for each point. First let's find the coordinates for point 1.

To find the X coordinate, we can look at either Figure 3 or Figure 4. In either case, the X coordinate for point 1 is 0.

To find the Y coordinate, we look at Figure 3. The Y coordinate for point 1 is also 0.

To find the Z coordinate, look at Figure 4. The Z coordinate for point 1 is 5.

Repeat this procedure for the remaining four points in the pyramid and you should have a list that looks like Figure 5.

Point #XYZ
1 0 05
2 4 40
3-4 40
5 4-40
Figure 5

After defining all the points, we're ready to tell the computer how to draw the pyramid. As stated earlier, this pyramid is made up of eight lines. In order to draw each line, the computer must know which two points make up the endpoints of the line. Figure 6 shows the endpoints of the eight lines.

Line #From PointTo Point
Figure 6

With this information in hand, you're ready to enter it into the 3-D image program in Listing 1 Type in the program and check your typing with C:CHECK or D:CHECK2. When you're sure the program is correct, RUN it.

What a view.

When the 3-D object plot program is executed, the computer will ask you several questions.

  1. DMA OFF? If you answer Y, the computer will turn off the screen while performing the complex 3-D math. This will speed up the program considerably. If you don't care about speed, type N.
  2. OUTPUT TO PLOTTER? If you own an Atari 1020 plotter and would like hard-copy of your 3-D objects, ready your plotter and answer Y to this question. Otherwise, answer N.
  3. FILE OR KEYBOARD INPUT? Type an F or a K depending on your choice.
  4. If you want a file input (F), the computer will ask for the name of a 3-D object file. If you're using the cassette, position your tape to the beginning of the 3-D file, press PLAY, type C: and press RETURN. For disk, respond D:FILENAME.EXT and press RETURN. The computer will load the desired 3-D object data and continue at step 6.
  5. If you want to define a new 3-D object (K), you will be asked how many points there are in the object. Our pyramid has 5 points. You will then be asked for the X,Y and Z coordinates of each point. For example, to enter the coordinates of point 2 of the pyramid, you would type 4,4,0 and press RETURN. Next you will be asked how many lines there are in the object. Type this number and press RETURN. After this you must enter the endpoints of each line.
  6. Enter these point numbers as in Figure 6. Finally, you'll be asked if you'd like to save the object in a file. If you type Y, the computer will ask for a filename. For cassette, position your tape, press RECORD and PLAY, type C: and press RETURN. When the computer beeps, press RETURN again and the file will be saved. For disk, type D:FILENAME.EXT and press RETURN.

  7. You're now ready to look at the object. You will be asked:

    If you'd like to examine and/or change the object data, type E, press RETURN and go to step 8. Otherwise, type in the X, Y and Z coordinates of the point in space where your imaginary "eye" is located and press RETURN. A good observer location for our pyramid is 5,7,3. Next you will be asked:


    Now you should enter the X, Y, and Z coordinates of the place where you want to look. If, for example, you want to look at the center of our pyramid, you should type 0,0,2.5 and press RETURN. Finally, you'll be asked:


    The normal zoom factor is 1. To enlarge the object image, type a larger number; to make the object smaller, enter a smaller number.

  8. At this point, the object will be drawn on your screen and on the plotter, if selected. When drawing is complete, a short tone will sound. Press START, SELECT, OPTION or the joystick #1 trigger to start a new plot at step 6.
  9. The EDIT section of the program has three options: PRINT the object data, EDIT POINTS or EDIT LINES. These options are self-prompting and similar to the original data entry procedure above. After editing, you may save the edited object data to a file, if desired, as in step 5.

More complex objects.

You can design and plot extremely complex objects with this image processor. The procedure is the same as the simple pyramid used in the above illustrations; there are just more points and lines involved.

Figure 7 is the data for a futuristic 3-D space shuttle. Try entering this data into your computer and viewing it.

Points: 44Lines: 58
PointXYZ LineFromTo
1-5.5-5.50 176
2-8-10 2629
3-830 3297
4-16140 42935
5-16170 53536
6-5.5210 63637
70162.5 73738
8002.5 83828
9-2.501.25 92829
10-2.5-6.51.25 1065
110-7.52.5 1154
12-1.25-21.5 1243
13-1.25-7.51.5 1332
14-2.518.51.25 1421
15-4.5226.5 1516
16-4.5186.5 1678
17-3.2133 1789
18- 18910
19-4-60 19101
20-4-7.50 20826
210-260 212627
224-7.50 222728
234-60 233031
241.25-7.51.5 243132
251.25-21.5 253233
262.501.25 263334
272.5-6.51.25 273430
285.5-5.50 281415
295.5210 291516
302.518.51.25 301617
314.5226.5 311718
324.5186.5 321814
333.2133 331013
342.55.51.25 341312
3516170 35129
3616140 36128
37830 371311
388-10 38118
393.5-9.50.25 39825
400.5-9.52 402526
410.5-190.6 411124
42-0.5-9.52 422425
43-3.5-9.50.25 432724
44-0.5-190.6 442423
Figure 7

Some suggested views for this shuttle are:

Observer Loc.Looked AtZoom
60,-60,40 0,0,0 1
[Shuttle Image]
Observer Loc.Looked AtZoom
0,-45,6 0,0,0 1
[Shuttle Image]
Observer Loc.Looked AtZoom
1,0,500 0,0,0 4.5
[Shuttle Image]
Observer Loc.Looked AtZoom
500,0,0 0,0,0 6
[Shuttle Image]

Who gets the credit?

To be honest, I can't take all the credit for this program. I got it from a Compucolor II computer bulletin board several years ago; the author was not credited. I modified the program to work on the Atari computers, added the editing, screen clipping, plotter output and file handling.

Although the code has been heavily modified, the author may recognize the general structure, and is encouraged to let me know his or her name. I'll be glad to give credit where it is due.

Attention, artists.

I'd be interested in seeing some of the 3-D objects created by our readers with this program. just send in a printout of your object's data along with your name, and you may see your work displayed in a future issue!

BASIC Listing

SSTATES.LST is available in ATASCII format.

This BASIC listing uses an image to display special characters

Checksum Data
100 DATA 884,171,93,680,49,183,281,21,
250 DATA 7,361,741,555,54,975,741,76,7
400 DATA 684,758,904,746,634,492,366,6
550 DATA 868,182,868,374,466,352,181,8
700 DATA 848,937,854,936,366,889,372,9
850 DATA 158,523,258,560,857,273,581,7
1000 DATA 873,485,698,241,637,893,973,
1150 DATA 713,132,170,273,397,595,386,
1300 DATA 385,553,479,555,355,614,183,
1450 DATA 81,478,859,659,899,355,534,1
1600 DATA 825,36,833,89,832,55,840,626
1750 DATA 964,922,270,808,2964

Previous | Contents | Next

Original text copyright 1984 by ANALOG Computing. Reprinted with permission by the Digital ANALOG Archive.