This module supplies the user with a simple three-dimensional facility that enables three-dimensional objects (with a small number of faces) to be tranformed and displayed. Three-dimensional scenes can be constructed by placing such objects at difterent positions in three-dimensional space.
Back surface elimination is applied individually to each object. This gives a degree of hidden surface removal. There are two aspects of back surface elimination that prevent it from being true hidden surface removal.
Implementation of true hidden surface removal on a micro-computer is problematic both from memory the memory resource aspect and the time taken for the algorithm to execute.
The following resources are available
4 three-dimensional objects
15 procedures
To use the module
10 MODE 4 20 PROCsetdatastructures(20,20) 30 PROCload3Ddata("CHURCH") 40 PROCobject3D
The following procedures are available
PROCinitialise | PROCscale |
PROCloadscreen | PROCsetdatastructures |
PROCload3Ddata | PROCsetorigin |
PROCobject3D | PROCtraceon |
PROCrotatex | PROCtranslate |
PROCrotatey | PROCuniscale |
PROCrotatez | PROCviewpoint |
Details of how to use each of these procedures are given later in the manual.
The four predrawn objects are included so that users can practise manipulating three-dimensional objects before devising and defining their own. It is this latter process which will provide the main interest in this module.
Unfortunately setting up even a simple three-dimensional object is quite a long-winded process that is usually carried out in practice by using a special drafting program together with an interactive device suc as a graphics tablet.
DATA statements must have the following form:
100 DATA "name of object" 110 DATA number of vertices 120 DATA list of vertices 130 DATA number of surfaces 140 DATA list of the vertices in each surface
The surface information is necessary for hidden surface calculations.
This is best illustrated by the example of a cube.
100 DATA CUBE 110 DATA 8 120 DATA 400,0,400, 400,0,0, 400,400,0 121 DATA 400,400,400, 0,400,0, 0,400,400 122 DATA 0,0,400, 0,0,0 130 DATA 6
The list of vertices in each surface is made of six (the number of surfaces) sublists. Each sublist contains the number of vertices in a surface followed by the vertex which is referred to by a vertex number.
The vertex numbers for the cube are:
and there are six surfaces in the cube each made up of four vertices. The final DATA statement is therefore:
140 DATA 4,1,2,3,4, 4,3,5,6,4, 4,5,8,7,6 141 DATA 4,8,2,1,7, 4,4,6,7,1, 4,3,2,8,5
The vertex numbers in each surface must be listed in anti-clockwise order as seen from the outside of the object