Personal Computer News
22nd December 1984
Author: Ian Wood
Published in Personal Computer News #092
With Ian Wood's Three Dimensional Graphics program you can explore and design your own 3D line drawings on the Beeb.
3D Drawing
With Ian Wood's Three Dimensional Graphics program you can explore and design your own 3D line drawings on the Beeb
The BBC's graphics capabilities are excellent, but to take full advantage of them you need the right software. Three Dimensional Graphics for the BBC lets you design a three dimensional line drawing which can then be rotated in any direction. You can also save and load your own programs.
Main Menu
-
Rotate Shape
This brings up the rotation menu. -
Save Shape
If this is chosen the program asks for the filename. Be careful not to cause a 'Bad string' error (by using a CHR$ less than 32). If you are using tape, the computer will print 'Record then RETURN'. -
Change Shape
This brings up the shape menu. -
Move Shape
This brings up the movement menu. -
Exit Menu
This redraws the shape. -
End Program
If this is chosen, the computer asks whether you want to start again. If you don't, the program ends.
Shape Menu
-
Use Demonstration Shape
Clears the current shape and loads the built-in demonstration shape. -
Load New Shape From Tape/Disk
Clears the current shape and asks for the filename of the program to be loaded. Pressing RETURN without a filename loads the next program on tape. -
Create New Shape
Clears the current shape and enters the editor. -
Edit Shape
Enters the editor. -
Change Title
Is the only way to change the title, as clearing the shape does not. A null string may be entered. When the shape is saved, the title is saved with it. -
Exit Menu
Redraws the shape.
Rotation And Movement Menu
Both these give a choice of six directions plus the 'Exit Menu' option. When a direction has been chosen, the program asks how far you want to rotate or move the shape.
The movement menu also has a 'Change Camera Position' option. This is included in the movement menu because the 'Move' options actually change the camera position.
Editor
The editor is entered from the shape menu simply by selecting either the 'Create New Shape' option or the 'Edit Shape' option.
Two cursors are displayed, together with their x,y,z coordinates, and can be moved around the screen. If the space bar is pressed a line will be drawn between the cursors and if the Delete key is pressed, the line will be deleted. Note that it's possible to draw up to one hundred lines.
To move the square cursor, use the arrow keys, and 'I' and 'O' for 'in' and 'out' (away from and towards you). To move the cross cursor, shift the keys.
When the shape is finished, press Return.
Procedure And Functions
The procedures and functions appear to be rather disorganised, but in fact they are in chronological order. When I thought of something new to put in the program, I just added another procedure to the end.
FNmovex | Works out the coordinate for drawing the shape on the screen from the x and z coordinates, taking into account the camera position. |
FNmovey | Does the same for the y coordinate. |
PROCplot | Draws a line on the screen using the x,y,z coordinates of the start and end of the line. |
PROCdraw | Draws the whole shape and prints the title. |
PROCroll | Works out the clockwise/anticlockwise movement of the shape. |
PROCpitch | Works out up and down movement. |
PROCyaw | Works out left and right movement. |
PROCdemo | Initialises the demonstration shape. |
PROCsave | Saves the shape and title. |
PROCload | Loads the shape. |
PROCenter | This is the main editor procedure. It initialises variables, reads the keyboard and then counts the number of lines. |
PROCpoint1 | Moves square cursor. |
PROCpoint2 | Moves cross cursor. |
PROCline | Draws a line. First checks to see if line already exists. |
PROCedit | Deletes a line. First checks to see if line already exists. |
PROCdelete | Called by PROCedit. Deletes a line and compacts the list of coordinates (removes empty spaces in list). |
PROCcompact | Called by PROCdelete. Compacts the list of coordinates. |
PROCmain_menu | Prints main menu, reads keyboard and calls a procedure depending on choice made. |
PROCrotate_menu | As above, for rotation. |
PROCinput | Inputs the number of degrees that the shape is to be rotated. |
PROCshape_menu | As PROCmain_menu for shape menu. |
PROCerror | Puts colours and cursor back to normal, empties the keyboard buffer and prints an error message. |
PROClear | Called by PROCshape menu. Clears the shape. |
PROCno_room | Called by PROCenter, if the arrays holding the list of coordinates are full. Prints an error message on the screen. |
FNcheck | Called by PROCline. Checks to see if line to be drawn already exists. |
PROCinfo | Prints the instructions. |
PROCtitle | Inputs a new title. |
PROCmove_menu | As PROCmain_menu but for movement menu. |
PROCpoints | Inputs the number of points that the shape is to be moved. |
PROCout | Moves shape out (towards screen). With a negative value, moves shape in (away). |
PROCup | Moves shape up or down. |
PROCleft | Moves shape left or right. |
PROCc_pos | Inputs a new camera position. |
Main Variables
x%,y%,z% | These three arrays make up the list of coordinates that form the shape. |
lines% | The number of lines in the shape minus one. |
line% | Used throughout the program. Current line being worked on. |
key$ | Used in menu procedures. Contains the last key pressed. |
cx%,cy%,cx% | The coordinates of the camera position. |
title$ | The title of the shape. |
This article was converted to a web page from the following pages of Personal Computer News #092.