Home » Archimedes archive » Archimedes World » AW-1994-07-Disc1.adf » Disk1Jul94 » !AWJuly94/Goodies/3D_Demo/HAR-Cube

!AWJuly94/Goodies/3D_Demo/HAR-Cube

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Archimedes World » AW-1994-07-Disc1.adf » Disk1Jul94
Filename: !AWJuly94/Goodies/3D_Demo/HAR-Cube
Read OK:
File size: 249F bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >HAR-Cube
   20REM Program : HAR-Cube
   30REM           A simple 3D cube in BBC BASIC
   40REM Author  : Kevin J Swinton
   50REM Version : Acorn A5000.1.00
   60REM Date    : Thursday 5th May 1994
   70
   80
   90ON ERROR MODE MODE : REPORT : PRINT " at Line ";ERL:END
  100
  110
  120REM ------------------------------------------------------------------------
  130REM                              MAIN PROGRAM
  140REM ------------------------------------------------------------------------
  150
  160
  170MODE 12+128 : OFF
  180
  190 PROCedure_Initialise
  200 PROCedure_Cube
  210
  220END
  230
  240
  250REM ------------------------------------------------------------------------
  260REM         PROCEDURE TO INITIALISE EVERYTHING WE NEED TO KNOW
  270REM ------------------------------------------------------------------------
  280
  290
  300DEF PROCedure_Initialise
  310
  320 REM *** Place our origin in the middle of the screen ***
  330 ORIGIN 640 , 512
  340
  350 REM *** Dimension all the arrays that we will need ***
  360 DIM array_for_the_3D_points( 8 , 3 ) : REM 8 points, each being an X,Y,Z (3D)
  370 DIM array_for_the_2D_points( 8 , 2 ) : REM 8 points, each being an X,Y   (2D)
  380 DIM array_for_the_facets( 12 , 4 )    : REM 12 facets, each being 3 point references and a colour
  390
  400 REM *** Read all the information we need into our arrays. Firstly, ***
  410 REM *** read in all our points that make up the cube, and then     ***
  420 REM *** read in all the facets that join the points together.      ***
  430 PROCedure_Read_Points_Into_Their_Array
  440 PROCedure_Read_Facets_Into_Their_Array
  450
  460 BANK = 1
  470 PROCedure_Swap_The_Screen_Banks : CLS
  480 PROCedure_Swap_The_Screen_Banks : CLS
  490
  500 REM *** Initialise the rotation of the object in space ***
  510 X_ROTATION = 0
  520 Y_ROTATION = 0
  530 Z_ROTATION = 0
  540
  550 REM *** Initialise the position of the object in space ***
  560 REM *** so that it is quite far away from us           ***
  570 X_POSITION = + 0
  580 Y_POSITION = + 0
  590 Z_POSITION = +50
  600
  610 FOR scale = 1 TO 15
  620  r = scale * 16
  630  g = 96
  640  b = 128 + scale * 4
  650  COLOUR scale , r , g , b
  660 NEXT scale
  670
  680ENDPROC
  690
  700
  710REM ------------------------------------------------------------------------
  720REM      MAIN PROCEDURE TO CONTROL THE SPINNING CUBE ON THE SCREEN
  730REM ------------------------------------------------------------------------
  740
  750
  760DEF PROCedure_Cube
  770
  780 REPEAT
  790
  800    PROCedure_Rotate_The_Cube
  810    PROCedure_Draw_The_Cube
  820    PROCedure_Swap_The_Screen_Banks
  830
  840    X_ROTATION = X_ROTATION + 1 : IF X_ROTATION >= 360 THEN X_ROTATION = X_ROTATION - 360
  850    Y_ROTATION = Y_ROTATION + 1 : IF Y_ROTATION >= 360 THEN Y_ROTATION = Y_ROTATION - 360
  860    Z_ROTATION = Z_ROTATION + 1 : IF Z_ROTATION >= 360 THEN Z_ROTATION = Z_ROTATION - 360
  870
  880 UNTIL 1 = 2
  890
  900ENDPROC
  910
  920
  930REM ------------------------------------------------------------------------
  940REM        THE PROCEDURE THAT ROTATES THE 8 POINTS OF THE CUBE
  950REM ------------------------------------------------------------------------
  960
  970
  980DEF PROCedure_Rotate_The_Cube
  990
 1000 FOR point_to_rotate = 1 TO 8
 1010
 1020  x_position_of_point = array_for_the_3D_points( point_to_rotate , 1 )
 1030  y_position_of_point = array_for_the_3D_points( point_to_rotate , 2 )
 1040  z_position_of_point = array_for_the_3D_points( point_to_rotate , 3 )
 1050
 1060  REM *** Formula for rotating the point around the X axis ***
 1070  rotated_y_value = y_position_of_point * COS( RAD X_ROTATION ) - z_position_of_point * SIN( RAD X_ROTATION )
 1080  rotated_z_value = y_position_of_point * SIN( RAD X_ROTATION ) + z_position_of_point * COS( RAD X_ROTATION )
 1090  y_position_of_point = rotated_y_value
 1100  z_position_of_point = rotated_z_value
 1110
 1120  REM *** Formula for rotating the point around the Y axis ***
 1130  rotated_x_value = x_position_of_point * COS( RAD Y_ROTATION ) + z_position_of_point * SIN( RAD Y_ROTATION )
 1140  rotated_z_value = z_position_of_point * COS( RAD Y_ROTATION ) - x_position_of_point * SIN( RAD Y_ROTATION )
 1150  x_position_of_point = rotated_x_value
 1160  z_position_of_point = rotated_z_value
 1170
 1180  REM *** Formula for rotating the point around the Z axis ***
 1190  rotated_x_value = x_position_of_point * COS( RAD Z_ROTATION ) - y_position_of_point * SIN( RAD Z_ROTATION )
 1200  rotated_y_value = x_position_of_point * SIN( RAD Z_ROTATION ) + y_position_of_point * COS( RAD Z_ROTATION )
 1210  x_position_of_point = rotated_x_value
 1220  y_position_of_point = rotated_y_value
 1230
 1240  REM *** Now we've rotated the object about itself we must ***
 1250  REM *** position it in space relative to where WE are     ***
 1260  x_position_of_point = x_position_of_point + X_POSITION
 1270  y_position_of_point = y_position_of_point + Y_POSITION
 1280  z_position_of_point = z_position_of_point + Z_POSITION
 1290
 1300  REM *** Convert from the rotated 3D position into the relevant    ***
 1310  REM *** 2D position. Don't forget that this involves dividing     ***
 1320  REM *** X and Y by Z, and apllying a perspective factor (eg. 800) ***
 1330  array_for_the_2D_points( point_to_rotate , 1 ) = ( 800 * x_position_of_point ) / z_position_of_point
 1340  array_for_the_2D_points( point_to_rotate , 2 ) = ( 800 * y_position_of_point ) / z_position_of_point
 1350
 1360 NEXT point_to_rotate
 1370
 1380ENDPROC
 1390
 1400
 1410REM ------------------------------------------------------------------------
 1420REM      THE PROCEDURE THAT DRAWS THE FACETS THAT MAKE UP THE CUBE
 1430REM ------------------------------------------------------------------------
 1440
 1450
 1460DEF PROCedure_Draw_The_Cube
 1470
 1480 FOR facet = 1 TO 12
 1490
 1500     point_1      = array_for_the_facets( facet , 1 )
 1510     point_2      = array_for_the_facets( facet , 2 )
 1520     point_3      = array_for_the_facets( facet , 3 )
 1530     facet_colour = array_for_the_facets( facet , 4 )
 1540
 1550     first_x_position   = array_for_the_2D_points( point_1 , 1 )
 1560     first_y_position   = array_for_the_2D_points( point_1 , 2 )
 1570
 1580     second_x_position  = array_for_the_2D_points( point_2 , 1 )
 1590     second_y_position  = array_for_the_2D_points( point_2 , 2 )
 1600
 1610     third_x_position   = array_for_the_2D_points( point_3 , 1 )
 1620     third_y_position   = array_for_the_2D_points( point_3 , 2 )
 1630
 1640     REM *** The following lines implement the algorithm for     ***
 1650     REM *** determining whether or not the facet is currently   ***
 1660     REM *** visible. It's easy to read, and some users may      ***
 1670     REM *** evenh like to discover how it works in more detail. ***
 1680     REM *** Others are welcome to extract any part of this      ***
 1690     REM *** program for their own advantage!                    ***
 1700
 1710     r0 = second_x_position - first_x_position
 1720     r1 = third_y_position  - first_y_position : r2 = r0 * r1
 1730
 1740     r0 = third_x_position  - first_x_position
 1750     r1 = second_y_position - first_y_position : r3 = r0 * r1
 1760
 1770     IF r2 - r3 > 0 THEN
 1780      GCOL 0 , facet_colour
 1790      MOVE      first_x_position  , first_y_position
 1800      DRAW      second_x_position , second_y_position
 1810      PLOT 85 , third_x_position  , third_y_position
 1820     ENDIF
 1830
 1840 NEXT facet
 1850
 1860ENDPROC
 1870
 1880
 1890REM ------------------------------------------------------------------------
 1900REM  PROCEDURE TO SWAP OUR SCREENS, KEEPING THE ANIMATION FLICKER FREE
 1910REM ------------------------------------------------------------------------
 1920
 1930
 1940DEF PROCedure_Swap_The_Screen_Banks
 1950
 1960 WAIT
 1970 BANK = BANK EOR 3
 1980 SYS 6,112,BANK
 1990 SYS 6,113,BANK EOR 3
 2000 CLS
 2010
 2020ENDPROC
 2030
 2040
 2050REM ------------------------------------------------------------------------
 2060REM  THE PROCEDURE THAT READS THE 8 POINTS INTO THE ARRAY WE'VE SET UP
 2070REM ------------------------------------------------------------------------
 2080
 2090
 2100DEF PROCedure_Read_Points_Into_Their_Array
 2110
 2120 RESTORE 2300
 2130
 2140 FOR point = 1 TO 8
 2150
 2160     READ X_POSITION , Y_POSITION , Z_POSITION
 2170
 2180     array_for_the_3D_points( point , 1 ) = X_POSITION
 2190     array_for_the_3D_points( point , 2 ) = Y_POSITION
 2200     array_for_the_3D_points( point , 3 ) = Z_POSITION
 2210
 2220 NEXT point
 2230
 2240ENDPROC
 2250
 2260
 2270REM *** The data for the 8 points of the cube ***
 2280
 2290
 2300DATA -10,+10 , +10 : REM The 4 points for the front of the cube
 2310DATA +10,+10 , +10
 2320DATA +10,-10 , +10
 2330DATA -10,-10 , +10
 2340
 2350DATA -10,+10 , -10 : REM The 4 points for the back  of the cube
 2360DATA +10,+10 , -10
 2370DATA +10,-10 , -10
 2380DATA -10,-10 , -10
 2390
 2400
 2410REM ------------------------------------------------------------------------
 2420REM  THE PROCEDURE THAT READS THE 12 FACETS INTO THE ARRAY WE'VE SET UP
 2430REM ------------------------------------------------------------------------
 2440
 2450
 2460DEF PROCedure_Read_Facets_Into_Their_Array
 2470
 2480 RESTORE 2670
 2490
 2500 FOR facet = 1 TO 12
 2510
 2520     READ JOIN_1 , JOIN_2 , JOIN_3 , FACET_COLOUR
 2530
 2540     array_for_the_facets( facet , 1 ) = JOIN_1
 2550     array_for_the_facets( facet , 2 ) = JOIN_2
 2560     array_for_the_facets( facet , 3 ) = JOIN_3
 2570     array_for_the_facets( facet , 4 ) = FACET_COLOUR
 2580
 2590 NEXT facet
 2600
 2610ENDPROC
 2620
 2630
 2640REM *** The data for the 12 facets to make up the cube ***
 2650
 2660
 2670DATA 1 , 2 , 3 ,  1 : REM The links to join up the front face
 2680DATA 1 , 3 , 4 ,  1
 2690
 2700DATA 6 , 5 , 7 ,  3 : REM The links to join up the back face
 2710DATA 5 , 8 , 7 ,  3
 2720
 2730DATA 2 , 6 , 7 ,  5 : REM The links to join up the RHS face
 2740DATA 2 , 7 , 3 ,  5
 2750
 2760DATA 5 , 1 , 4 ,  7 : REM The links to join up the LHS face
 2770DATA 5 , 4 , 8 ,  7
 2780
 2790DATA 5 , 6 , 2 ,  9 : REM The links to join up the top face
 2800DATA 5 , 2 , 1 ,  9
 2810
 2820DATA 4 , 3 , 8 , 11 : REM The links to join up the bottom face
 2830DATA 3 , 7 , 8 , 11

� >HAR-Cube
� Program : HAR-Cube
-�           A simple 3D cube in BBC BASIC
(� Author  : Kevin J Swinton
2 � Version : Acorn A5000.1.00
<%� Date    : Thursday 5th May 1994
F
P
Z#� � � � : � : � " at Line ";�:�
d
n
xN� ------------------------------------------------------------------------
�/�                              MAIN PROGRAM
�N� ------------------------------------------------------------------------
�
�
�� 12+128 : �
�
� �edure_Initialise
� �edure_Cube
�
��
�
�
�N� ------------------------------------------------------------------------
@�         PROCEDURE TO INITIALISE EVERYTHING WE NEED TO KNOW
N� ------------------------------------------------------------------------

"
,� �edure_Initialise
6
@; � *** Place our origin in the middle of the screen ***
J ȑ 640 , 512
T
^9 � *** Dimension all the arrays that we will need ***
hN � array_for_the_3D_points( 8 , 3 ) : � 8 points, each being an X,Y,Z (3D)
rN � array_for_the_2D_points( 8 , 2 ) : � 8 points, each being an X,Y   (2D)
|b � array_for_the_facets( 12 , 4 )    : � 12 facets, each being 3 point references and a colour
�
�I � *** Read all the information we need into our arrays. Firstly, ***
�I � *** read in all our points that make up the cube, and then     ***
�I � *** read in all the facets that join the points together.      ***
�( �edure_Read_Points_Into_Their_Array
�( �edure_Read_Facets_Into_Their_Array
�
�
 BANK = 1
�% �edure_Swap_The_Screen_Banks : �
�% �edure_Swap_The_Screen_Banks : �
�
�= � *** Initialise the rotation of the object in space ***
� X_ROTATION = 0
 Y_ROTATION = 0
 Z_ROTATION = 0

&= � *** Initialise the position of the object in space ***
0= � *** so that it is quite far away from us           ***
: X_POSITION = + 0
D Y_POSITION = + 0
N Z_POSITION = +50
X
b � scale = 1 � 15
l  r = scale * 16
v  g = 96
�  b = 128 + scale * 4
�  � scale , r , g , b
� � scale
�
��
�
�
�N� ------------------------------------------------------------------------
�D�      MAIN PROCEDURE TO CONTROL THE SPINNING CUBE ON THE SCREEN
�N� ------------------------------------------------------------------------
�
�
�� �edure_Cube

 �

     �edure_Rotate_The_Cube
*    �edure_Draw_The_Cube
4$    �edure_Swap_The_Screen_Banks
>
HY    X_ROTATION = X_ROTATION + 1 : � X_ROTATION >= 360 � X_ROTATION = X_ROTATION - 360
RY    Y_ROTATION = Y_ROTATION + 1 : � Y_ROTATION >= 360 � Y_ROTATION = Y_ROTATION - 360
\Y    Z_ROTATION = Z_ROTATION + 1 : � Z_ROTATION >= 360 � Z_ROTATION = Z_ROTATION - 360
f
p � 1 = 2
z
��
�
�
�N� ------------------------------------------------------------------------
�@�        THE PROCEDURE THAT ROTATES THE 8 POINTS OF THE CUBE
�N� ------------------------------------------------------------------------
�
�
�� �edure_Rotate_The_Cube
�
� � point_to_rotate = 1 � 8
�
�J  x_position_of_point = array_for_the_3D_points( point_to_rotate , 1 )
J  y_position_of_point = array_for_the_3D_points( point_to_rotate , 2 )
J  z_position_of_point = array_for_the_3D_points( point_to_rotate , 3 )

$@  � *** Formula for rotating the point around the X axis ***
.i  rotated_y_value = y_position_of_point * �( � X_ROTATION ) - z_position_of_point * �( � X_ROTATION )
8i  rotated_z_value = y_position_of_point * �( � X_ROTATION ) + z_position_of_point * �( � X_ROTATION )
B+  y_position_of_point = rotated_y_value
L+  z_position_of_point = rotated_z_value
V
`@  � *** Formula for rotating the point around the Y axis ***
ji  rotated_x_value = x_position_of_point * �( � Y_ROTATION ) + z_position_of_point * �( � Y_ROTATION )
ti  rotated_z_value = z_position_of_point * �( � Y_ROTATION ) - x_position_of_point * �( � Y_ROTATION )
~+  x_position_of_point = rotated_x_value
�+  z_position_of_point = rotated_z_value
�
�@  � *** Formula for rotating the point around the Z axis ***
�i  rotated_x_value = x_position_of_point * �( � Z_ROTATION ) - y_position_of_point * �( � Z_ROTATION )
�i  rotated_y_value = x_position_of_point * �( � Z_ROTATION ) + y_position_of_point * �( � Z_ROTATION )
�+  x_position_of_point = rotated_x_value
�+  y_position_of_point = rotated_y_value
�
�A  � *** Now we've rotated the object about itself we must ***
�A  � *** position it in space relative to where WE are     ***
�<  x_position_of_point = x_position_of_point + X_POSITION
�<  y_position_of_point = y_position_of_point + Y_POSITION
<  z_position_of_point = z_position_of_point + Z_POSITION


I  � *** Convert from the rotated 3D position into the relevant    ***
I  � *** 2D position. Don't forget that this involves dividing     ***
(I  � *** X and Y by Z, and apllying a perspective factor (eg. 800) ***
2j  array_for_the_2D_points( point_to_rotate , 1 ) = ( 800 * x_position_of_point ) / z_position_of_point
<j  array_for_the_2D_points( point_to_rotate , 2 ) = ( 800 * y_position_of_point ) / z_position_of_point
F
P � point_to_rotate
Z
d�
n
x
�N� ------------------------------------------------------------------------
�D�      THE PROCEDURE THAT DRAWS THE FACETS THAT MAKE UP THE CUBE
�N� ------------------------------------------------------------------------
�
�
�� �edure_Draw_The_Cube
�
� � facet = 1 � 12
�
�9     point_1      = array_for_the_facets( facet , 1 )
�9     point_2      = array_for_the_facets( facet , 2 )
�9     point_3      = array_for_the_facets( facet , 3 )
�9     facet_colour = array_for_the_facets( facet , 4 )

D     first_x_position   = array_for_the_2D_points( point_1 , 1 )
D     first_y_position   = array_for_the_2D_points( point_1 , 2 )
"
,D     second_x_position  = array_for_the_2D_points( point_2 , 1 )
6D     second_y_position  = array_for_the_2D_points( point_2 , 2 )
@
JD     third_x_position   = array_for_the_2D_points( point_3 , 1 )
TD     third_y_position   = array_for_the_2D_points( point_3 , 2 )
^
hF     � *** The following lines implement the algorithm for     ***
rF     � *** determining whether or not the facet is currently   ***
|F     � *** visible. It's easy to read, and some users may      ***
�F     � *** evenh like to discover how it works in more detail. ***
�F     � *** Others are welcome to extract any part of this      ***
�F     � *** program for their own advantage!                    ***
�
�2     r0 = second_x_position - first_x_position
�A     r1 = third_y_position  - first_y_position : r2 = r0 * r1
�
�2     r0 = third_x_position  - first_x_position
�A     r1 = second_y_position - first_y_position : r3 = r0 * r1
�
�     � r2 - r3 > 0 �
�      � 0 , facet_colour
�5      �      first_x_position  , first_y_position
6      �      second_x_position , second_y_position
5      � 85 , third_x_position  , third_y_position

     �
&
0 � facet
:
D�
N
X
bN� ------------------------------------------------------------------------
lH�  PROCEDURE TO SWAP OUR SCREENS, KEEPING THE ANIMATION FLICKER FREE
vN� ------------------------------------------------------------------------
�
�
�"� �edure_Swap_The_Screen_Banks
�
� Ȗ
� BANK = BANK � 3
� ș 6,112,BANK
� ș 6,113,BANK � 3
� �
�
��
�
�
N� ------------------------------------------------------------------------
H�  THE PROCEDURE THAT READS THE 8 POINTS INTO THE ARRAY WE'VE SET UP
N� ------------------------------------------------------------------------
 
*
4)� �edure_Read_Points_Into_Their_Array
>
H � �d|H
R
\ � point = 1 � 8
f
p/     � X_POSITION , Y_POSITION , Z_POSITION
z
�:     array_for_the_3D_points( point , 1 ) = X_POSITION
�:     array_for_the_3D_points( point , 2 ) = Y_POSITION
�:     array_for_the_3D_points( point , 3 ) = Z_POSITION
�
� � point
�
��
�
�
�3� *** The data for the 8 points of the cube ***
�
�
�@� -10,+10 , +10 : REM The 4 points for the front of the cube
	� +10,+10 , +10
	� +10,-10 , +10
	� -10,-10 , +10
	$
	.@� -10,+10 , -10 : REM The 4 points for the back  of the cube
	8� +10,+10 , -10
	B� +10,-10 , -10
	L� -10,-10 , -10
	V
	`
	jN� ------------------------------------------------------------------------
	tI�  THE PROCEDURE THAT READS THE 12 FACETS INTO THE ARRAY WE'VE SET UP
	~N� ------------------------------------------------------------------------
	�
	�
	�)� �edure_Read_Facets_Into_Their_Array
	�
	� � �DnJ
	�
	� � facet = 1 � 12
	�
	�2     � JOIN_1 , JOIN_2 , JOIN_3 , FACET_COLOUR
	�
	�3     array_for_the_facets( facet , 1 ) = JOIN_1
	�3     array_for_the_facets( facet , 2 ) = JOIN_2
3     array_for_the_facets( facet , 3 ) = JOIN_3

9     array_for_the_facets( facet , 4 ) = FACET_COLOUR

 � facet
(
2�
<
F
P<� *** The data for the 12 facets to make up the cube ***
Z
d
n>� 1 , 2 , 3 ,  1 : REM The links to join up the front face
x� 1 , 3 , 4 ,  1
�
�=� 6 , 5 , 7 ,  3 : REM The links to join up the back face
�� 5 , 8 , 7 ,  3
�
�<� 2 , 6 , 7 ,  5 : REM The links to join up the RHS face
�� 2 , 7 , 3 ,  5
�
�<� 5 , 1 , 4 ,  7 : REM The links to join up the LHS face
�� 5 , 4 , 8 ,  7
�
�<� 5 , 6 , 2 ,  9 : REM The links to join up the top face
�� 5 , 2 , 1 ,  9
�
?� 4 , 3 , 8 , 11 : REM The links to join up the bottom face
� 3 , 7 , 8 , 11
�
00000000  0d 00 0a 0f f4 20 3e 48  41 52 2d 43 75 62 65 0d  |..... >HAR-Cube.|
00000010  00 14 18 f4 20 50 72 6f  67 72 61 6d 20 3a 20 48  |.... Program : H|
00000020  41 52 2d 43 75 62 65 0d  00 1e 2d f4 20 20 20 20  |AR-Cube...-.    |
00000030  20 20 20 20 20 20 20 41  20 73 69 6d 70 6c 65 20  |       A simple |
00000040  33 44 20 63 75 62 65 20  69 6e 20 42 42 43 20 42  |3D cube in BBC B|
00000050  41 53 49 43 0d 00 28 1f  f4 20 41 75 74 68 6f 72  |ASIC..(.. Author|
00000060  20 20 3a 20 4b 65 76 69  6e 20 4a 20 53 77 69 6e  |  : Kevin J Swin|
00000070  74 6f 6e 0d 00 32 20 f4  20 56 65 72 73 69 6f 6e  |ton..2 . Version|
00000080  20 3a 20 41 63 6f 72 6e  20 41 35 30 30 30 2e 31  | : Acorn A5000.1|
00000090  2e 30 30 0d 00 3c 25 f4  20 44 61 74 65 20 20 20  |.00..<%. Date   |
000000a0  20 3a 20 54 68 75 72 73  64 61 79 20 35 74 68 20  | : Thursday 5th |
000000b0  4d 61 79 20 31 39 39 34  0d 00 46 04 0d 00 50 04  |May 1994..F...P.|
000000c0  0d 00 5a 23 ee 20 85 20  eb 20 eb 20 3a 20 f6 20  |..Z#. . . . : . |
000000d0  3a 20 f1 20 22 20 61 74  20 4c 69 6e 65 20 22 3b  |: . " at Line ";|
000000e0  9e 3a e0 0d 00 64 04 0d  00 6e 04 0d 00 78 4e f4  |.:...d...n...xN.|
000000f0  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
00000100  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000130  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 00 82 2f f4 20 20  |---------.../.  |
00000140  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000150  20 20 20 20 20 20 20 20  20 20 20 20 4d 41 49 4e  |            MAIN|
00000160  20 50 52 4f 47 52 41 4d  0d 00 8c 4e f4 20 2d 2d  | PROGRAM...N. --|
00000170  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000001b0  2d 2d 2d 2d 2d 2d 0d 00  96 04 0d 00 a0 04 0d 00  |------..........|
000001c0  aa 10 eb 20 31 32 2b 31  32 38 20 3a 20 87 0d 00  |... 12+128 : ...|
000001d0  b4 04 0d 00 be 16 20 f2  65 64 75 72 65 5f 49 6e  |...... .edure_In|
000001e0  69 74 69 61 6c 69 73 65  0d 00 c8 10 20 f2 65 64  |itialise.... .ed|
000001f0  75 72 65 5f 43 75 62 65  0d 00 d2 04 0d 00 dc 05  |ure_Cube........|
00000200  e0 0d 00 e6 04 0d 00 f0  04 0d 00 fa 4e f4 20 2d  |............N. -|
00000210  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000250  2d 2d 2d 2d 2d 2d 2d 0d  01 04 40 f4 20 20 20 20  |-------...@.    |
00000260  20 20 20 20 20 50 52 4f  43 45 44 55 52 45 20 54  |     PROCEDURE T|
00000270  4f 20 49 4e 49 54 49 41  4c 49 53 45 20 45 56 45  |O INITIALISE EVE|
00000280  52 59 54 48 49 4e 47 20  57 45 20 4e 45 45 44 20  |RYTHING WE NEED |
00000290  54 4f 20 4b 4e 4f 57 0d  01 0e 4e f4 20 2d 2d 2d  |TO KNOW...N. ---|
000002a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000002e0  2d 2d 2d 2d 2d 0d 01 18  04 0d 01 22 04 0d 01 2c  |-----......"...,|
000002f0  17 dd 20 f2 65 64 75 72  65 5f 49 6e 69 74 69 61  |.. .edure_Initia|
00000300  6c 69 73 65 0d 01 36 04  0d 01 40 3b 20 f4 20 2a  |lise..6...@; . *|
00000310  2a 2a 20 50 6c 61 63 65  20 6f 75 72 20 6f 72 69  |** Place our ori|
00000320  67 69 6e 20 69 6e 20 74  68 65 20 6d 69 64 64 6c  |gin in the middl|
00000330  65 20 6f 66 20 74 68 65  20 73 63 72 65 65 6e 20  |e of the screen |
00000340  2a 2a 2a 0d 01 4a 11 20  c8 91 20 36 34 30 20 2c  |***..J. .. 640 ,|
00000350  20 35 31 32 0d 01 54 04  0d 01 5e 39 20 f4 20 2a  | 512..T...^9 . *|
00000360  2a 2a 20 44 69 6d 65 6e  73 69 6f 6e 20 61 6c 6c  |** Dimension all|
00000370  20 74 68 65 20 61 72 72  61 79 73 20 74 68 61 74  | the arrays that|
00000380  20 77 65 20 77 69 6c 6c  20 6e 65 65 64 20 2a 2a  | we will need **|
00000390  2a 0d 01 68 4e 20 de 20  61 72 72 61 79 5f 66 6f  |*..hN . array_fo|
000003a0  72 5f 74 68 65 5f 33 44  5f 70 6f 69 6e 74 73 28  |r_the_3D_points(|
000003b0  20 38 20 2c 20 33 20 29  20 3a 20 f4 20 38 20 70  | 8 , 3 ) : . 8 p|
000003c0  6f 69 6e 74 73 2c 20 65  61 63 68 20 62 65 69 6e  |oints, each bein|
000003d0  67 20 61 6e 20 58 2c 59  2c 5a 20 28 33 44 29 0d  |g an X,Y,Z (3D).|
000003e0  01 72 4e 20 de 20 61 72  72 61 79 5f 66 6f 72 5f  |.rN . array_for_|
000003f0  74 68 65 5f 32 44 5f 70  6f 69 6e 74 73 28 20 38  |the_2D_points( 8|
00000400  20 2c 20 32 20 29 20 3a  20 f4 20 38 20 70 6f 69  | , 2 ) : . 8 poi|
00000410  6e 74 73 2c 20 65 61 63  68 20 62 65 69 6e 67 20  |nts, each being |
00000420  61 6e 20 58 2c 59 20 20  20 28 32 44 29 0d 01 7c  |an X,Y   (2D)..||
00000430  62 20 de 20 61 72 72 61  79 5f 66 6f 72 5f 74 68  |b . array_for_th|
00000440  65 5f 66 61 63 65 74 73  28 20 31 32 20 2c 20 34  |e_facets( 12 , 4|
00000450  20 29 20 20 20 20 3a 20  f4 20 31 32 20 66 61 63  | )    : . 12 fac|
00000460  65 74 73 2c 20 65 61 63  68 20 62 65 69 6e 67 20  |ets, each being |
00000470  33 20 70 6f 69 6e 74 20  72 65 66 65 72 65 6e 63  |3 point referenc|
00000480  65 73 20 61 6e 64 20 61  20 63 6f 6c 6f 75 72 0d  |es and a colour.|
00000490  01 86 04 0d 01 90 49 20  f4 20 2a 2a 2a 20 52 65  |......I . *** Re|
000004a0  61 64 20 61 6c 6c 20 74  68 65 20 69 6e 66 6f 72  |ad all the infor|
000004b0  6d 61 74 69 6f 6e 20 77  65 20 6e 65 65 64 20 69  |mation we need i|
000004c0  6e 74 6f 20 6f 75 72 20  61 72 72 61 79 73 2e 20  |nto our arrays. |
000004d0  46 69 72 73 74 6c 79 2c  20 2a 2a 2a 0d 01 9a 49  |Firstly, ***...I|
000004e0  20 f4 20 2a 2a 2a 20 72  65 61 64 20 69 6e 20 61  | . *** read in a|
000004f0  6c 6c 20 6f 75 72 20 70  6f 69 6e 74 73 20 74 68  |ll our points th|
00000500  61 74 20 6d 61 6b 65 20  75 70 20 74 68 65 20 63  |at make up the c|
00000510  75 62 65 2c 20 61 6e 64  20 74 68 65 6e 20 20 20  |ube, and then   |
00000520  20 20 2a 2a 2a 0d 01 a4  49 20 f4 20 2a 2a 2a 20  |  ***...I . *** |
00000530  72 65 61 64 20 69 6e 20  61 6c 6c 20 74 68 65 20  |read in all the |
00000540  66 61 63 65 74 73 20 74  68 61 74 20 6a 6f 69 6e  |facets that join|
00000550  20 74 68 65 20 70 6f 69  6e 74 73 20 74 6f 67 65  | the points toge|
00000560  74 68 65 72 2e 20 20 20  20 20 20 2a 2a 2a 0d 01  |ther.      ***..|
00000570  ae 28 20 f2 65 64 75 72  65 5f 52 65 61 64 5f 50  |.( .edure_Read_P|
00000580  6f 69 6e 74 73 5f 49 6e  74 6f 5f 54 68 65 69 72  |oints_Into_Their|
00000590  5f 41 72 72 61 79 0d 01  b8 28 20 f2 65 64 75 72  |_Array...( .edur|
000005a0  65 5f 52 65 61 64 5f 46  61 63 65 74 73 5f 49 6e  |e_Read_Facets_In|
000005b0  74 6f 5f 54 68 65 69 72  5f 41 72 72 61 79 0d 01  |to_Their_Array..|
000005c0  c2 04 0d 01 cc 0d 20 42  41 4e 4b 20 3d 20 31 0d  |...... BANK = 1.|
000005d0  01 d6 25 20 f2 65 64 75  72 65 5f 53 77 61 70 5f  |..% .edure_Swap_|
000005e0  54 68 65 5f 53 63 72 65  65 6e 5f 42 61 6e 6b 73  |The_Screen_Banks|
000005f0  20 3a 20 db 0d 01 e0 25  20 f2 65 64 75 72 65 5f  | : ....% .edure_|
00000600  53 77 61 70 5f 54 68 65  5f 53 63 72 65 65 6e 5f  |Swap_The_Screen_|
00000610  42 61 6e 6b 73 20 3a 20  db 0d 01 ea 04 0d 01 f4  |Banks : ........|
00000620  3d 20 f4 20 2a 2a 2a 20  49 6e 69 74 69 61 6c 69  |= . *** Initiali|
00000630  73 65 20 74 68 65 20 72  6f 74 61 74 69 6f 6e 20  |se the rotation |
00000640  6f 66 20 74 68 65 20 6f  62 6a 65 63 74 20 69 6e  |of the object in|
00000650  20 73 70 61 63 65 20 2a  2a 2a 0d 01 fe 13 20 58  | space ***.... X|
00000660  5f 52 4f 54 41 54 49 4f  4e 20 3d 20 30 0d 02 08  |_ROTATION = 0...|
00000670  13 20 59 5f 52 4f 54 41  54 49 4f 4e 20 3d 20 30  |. Y_ROTATION = 0|
00000680  0d 02 12 13 20 5a 5f 52  4f 54 41 54 49 4f 4e 20  |.... Z_ROTATION |
00000690  3d 20 30 0d 02 1c 04 0d  02 26 3d 20 f4 20 2a 2a  |= 0......&= . **|
000006a0  2a 20 49 6e 69 74 69 61  6c 69 73 65 20 74 68 65  |* Initialise the|
000006b0  20 70 6f 73 69 74 69 6f  6e 20 6f 66 20 74 68 65  | position of the|
000006c0  20 6f 62 6a 65 63 74 20  69 6e 20 73 70 61 63 65  | object in space|
000006d0  20 2a 2a 2a 0d 02 30 3d  20 f4 20 2a 2a 2a 20 73  | ***..0= . *** s|
000006e0  6f 20 74 68 61 74 20 69  74 20 69 73 20 71 75 69  |o that it is qui|
000006f0  74 65 20 66 61 72 20 61  77 61 79 20 66 72 6f 6d  |te far away from|
00000700  20 75 73 20 20 20 20 20  20 20 20 20 20 20 2a 2a  | us           **|
00000710  2a 0d 02 3a 15 20 58 5f  50 4f 53 49 54 49 4f 4e  |*..:. X_POSITION|
00000720  20 3d 20 2b 20 30 0d 02  44 15 20 59 5f 50 4f 53  | = + 0..D. Y_POS|
00000730  49 54 49 4f 4e 20 3d 20  2b 20 30 0d 02 4e 15 20  |ITION = + 0..N. |
00000740  5a 5f 50 4f 53 49 54 49  4f 4e 20 3d 20 2b 35 30  |Z_POSITION = +50|
00000750  0d 02 58 04 0d 02 62 15  20 e3 20 73 63 61 6c 65  |..X...b. . scale|
00000760  20 3d 20 31 20 b8 20 31  35 0d 02 6c 14 20 20 72  | = 1 . 15..l.  r|
00000770  20 3d 20 73 63 61 6c 65  20 2a 20 31 36 0d 02 76  | = scale * 16..v|
00000780  0c 20 20 67 20 3d 20 39  36 0d 02 80 19 20 20 62  |.  g = 96....  b|
00000790  20 3d 20 31 32 38 20 2b  20 73 63 61 6c 65 20 2a  | = 128 + scale *|
000007a0  20 34 0d 02 8a 19 20 20  fb 20 73 63 61 6c 65 20  | 4....  . scale |
000007b0  2c 20 72 20 2c 20 67 20  2c 20 62 0d 02 94 0c 20  |, r , g , b.... |
000007c0  ed 20 73 63 61 6c 65 0d  02 9e 04 0d 02 a8 05 e1  |. scale.........|
000007d0  0d 02 b2 04 0d 02 bc 04  0d 02 c6 4e f4 20 2d 2d  |...........N. --|
000007e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000820  2d 2d 2d 2d 2d 2d 0d 02  d0 44 f4 20 20 20 20 20  |------...D.     |
00000830  20 4d 41 49 4e 20 50 52  4f 43 45 44 55 52 45 20  | MAIN PROCEDURE |
00000840  54 4f 20 43 4f 4e 54 52  4f 4c 20 54 48 45 20 53  |TO CONTROL THE S|
00000850  50 49 4e 4e 49 4e 47 20  43 55 42 45 20 4f 4e 20  |PINNING CUBE ON |
00000860  54 48 45 20 53 43 52 45  45 4e 0d 02 da 4e f4 20  |THE SCREEN...N. |
00000870  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000008b0  2d 2d 2d 2d 2d 2d 2d 2d  0d 02 e4 04 0d 02 ee 04  |--------........|
000008c0  0d 02 f8 11 dd 20 f2 65  64 75 72 65 5f 43 75 62  |..... .edure_Cub|
000008d0  65 0d 03 02 04 0d 03 0c  06 20 f5 0d 03 16 04 0d  |e........ ......|
000008e0  03 20 1e 20 20 20 20 f2  65 64 75 72 65 5f 52 6f  |. .    .edure_Ro|
000008f0  74 61 74 65 5f 54 68 65  5f 43 75 62 65 0d 03 2a  |tate_The_Cube..*|
00000900  1c 20 20 20 20 f2 65 64  75 72 65 5f 44 72 61 77  |.    .edure_Draw|
00000910  5f 54 68 65 5f 43 75 62  65 0d 03 34 24 20 20 20  |_The_Cube..4$   |
00000920  20 f2 65 64 75 72 65 5f  53 77 61 70 5f 54 68 65  | .edure_Swap_The|
00000930  5f 53 63 72 65 65 6e 5f  42 61 6e 6b 73 0d 03 3e  |_Screen_Banks..>|
00000940  04 0d 03 48 59 20 20 20  20 58 5f 52 4f 54 41 54  |...HY    X_ROTAT|
00000950  49 4f 4e 20 3d 20 58 5f  52 4f 54 41 54 49 4f 4e  |ION = X_ROTATION|
00000960  20 2b 20 31 20 3a 20 e7  20 58 5f 52 4f 54 41 54  | + 1 : . X_ROTAT|
00000970  49 4f 4e 20 3e 3d 20 33  36 30 20 8c 20 58 5f 52  |ION >= 360 . X_R|
00000980  4f 54 41 54 49 4f 4e 20  3d 20 58 5f 52 4f 54 41  |OTATION = X_ROTA|
00000990  54 49 4f 4e 20 2d 20 33  36 30 0d 03 52 59 20 20  |TION - 360..RY  |
000009a0  20 20 59 5f 52 4f 54 41  54 49 4f 4e 20 3d 20 59  |  Y_ROTATION = Y|
000009b0  5f 52 4f 54 41 54 49 4f  4e 20 2b 20 31 20 3a 20  |_ROTATION + 1 : |
000009c0  e7 20 59 5f 52 4f 54 41  54 49 4f 4e 20 3e 3d 20  |. Y_ROTATION >= |
000009d0  33 36 30 20 8c 20 59 5f  52 4f 54 41 54 49 4f 4e  |360 . Y_ROTATION|
000009e0  20 3d 20 59 5f 52 4f 54  41 54 49 4f 4e 20 2d 20  | = Y_ROTATION - |
000009f0  33 36 30 0d 03 5c 59 20  20 20 20 5a 5f 52 4f 54  |360..\Y    Z_ROT|
00000a00  41 54 49 4f 4e 20 3d 20  5a 5f 52 4f 54 41 54 49  |ATION = Z_ROTATI|
00000a10  4f 4e 20 2b 20 31 20 3a  20 e7 20 5a 5f 52 4f 54  |ON + 1 : . Z_ROT|
00000a20  41 54 49 4f 4e 20 3e 3d  20 33 36 30 20 8c 20 5a  |ATION >= 360 . Z|
00000a30  5f 52 4f 54 41 54 49 4f  4e 20 3d 20 5a 5f 52 4f  |_ROTATION = Z_RO|
00000a40  54 41 54 49 4f 4e 20 2d  20 33 36 30 0d 03 66 04  |TATION - 360..f.|
00000a50  0d 03 70 0c 20 fd 20 31  20 3d 20 32 0d 03 7a 04  |..p. . 1 = 2..z.|
00000a60  0d 03 84 05 e1 0d 03 8e  04 0d 03 98 04 0d 03 a2  |................|
00000a70  4e f4 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |N. -------------|
00000a80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000ab0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 03 ac 40 f4  |-----------...@.|
00000ac0  20 20 20 20 20 20 20 20  54 48 45 20 50 52 4f 43  |        THE PROC|
00000ad0  45 44 55 52 45 20 54 48  41 54 20 52 4f 54 41 54  |EDURE THAT ROTAT|
00000ae0  45 53 20 54 48 45 20 38  20 50 4f 49 4e 54 53 20  |ES THE 8 POINTS |
00000af0  4f 46 20 54 48 45 20 43  55 42 45 0d 03 b6 4e f4  |OF THE CUBE...N.|
00000b00  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
00000b10  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000b40  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 03 c0 04 0d 03 ca  |---------.......|
00000b50  04 0d 03 d4 1c dd 20 f2  65 64 75 72 65 5f 52 6f  |...... .edure_Ro|
00000b60  74 61 74 65 5f 54 68 65  5f 43 75 62 65 0d 03 de  |tate_The_Cube...|
00000b70  04 0d 03 e8 1e 20 e3 20  70 6f 69 6e 74 5f 74 6f  |..... . point_to|
00000b80  5f 72 6f 74 61 74 65 20  3d 20 31 20 b8 20 38 0d  |_rotate = 1 . 8.|
00000b90  03 f2 04 0d 03 fc 4a 20  20 78 5f 70 6f 73 69 74  |......J  x_posit|
00000ba0  69 6f 6e 5f 6f 66 5f 70  6f 69 6e 74 20 3d 20 61  |ion_of_point = a|
00000bb0  72 72 61 79 5f 66 6f 72  5f 74 68 65 5f 33 44 5f  |rray_for_the_3D_|
00000bc0  70 6f 69 6e 74 73 28 20  70 6f 69 6e 74 5f 74 6f  |points( point_to|
00000bd0  5f 72 6f 74 61 74 65 20  2c 20 31 20 29 0d 04 06  |_rotate , 1 )...|
00000be0  4a 20 20 79 5f 70 6f 73  69 74 69 6f 6e 5f 6f 66  |J  y_position_of|
00000bf0  5f 70 6f 69 6e 74 20 3d  20 61 72 72 61 79 5f 66  |_point = array_f|
00000c00  6f 72 5f 74 68 65 5f 33  44 5f 70 6f 69 6e 74 73  |or_the_3D_points|
00000c10  28 20 70 6f 69 6e 74 5f  74 6f 5f 72 6f 74 61 74  |( point_to_rotat|
00000c20  65 20 2c 20 32 20 29 0d  04 10 4a 20 20 7a 5f 70  |e , 2 )...J  z_p|
00000c30  6f 73 69 74 69 6f 6e 5f  6f 66 5f 70 6f 69 6e 74  |osition_of_point|
00000c40  20 3d 20 61 72 72 61 79  5f 66 6f 72 5f 74 68 65  | = array_for_the|
00000c50  5f 33 44 5f 70 6f 69 6e  74 73 28 20 70 6f 69 6e  |_3D_points( poin|
00000c60  74 5f 74 6f 5f 72 6f 74  61 74 65 20 2c 20 33 20  |t_to_rotate , 3 |
00000c70  29 0d 04 1a 04 0d 04 24  40 20 20 f4 20 2a 2a 2a  |)......$@  . ***|
00000c80  20 46 6f 72 6d 75 6c 61  20 66 6f 72 20 72 6f 74  | Formula for rot|
00000c90  61 74 69 6e 67 20 74 68  65 20 70 6f 69 6e 74 20  |ating the point |
00000ca0  61 72 6f 75 6e 64 20 74  68 65 20 58 20 61 78 69  |around the X axi|
00000cb0  73 20 2a 2a 2a 0d 04 2e  69 20 20 72 6f 74 61 74  |s ***...i  rotat|
00000cc0  65 64 5f 79 5f 76 61 6c  75 65 20 3d 20 79 5f 70  |ed_y_value = y_p|
00000cd0  6f 73 69 74 69 6f 6e 5f  6f 66 5f 70 6f 69 6e 74  |osition_of_point|
00000ce0  20 2a 20 9b 28 20 b2 20  58 5f 52 4f 54 41 54 49  | * .( . X_ROTATI|
00000cf0  4f 4e 20 29 20 2d 20 7a  5f 70 6f 73 69 74 69 6f  |ON ) - z_positio|
00000d00  6e 5f 6f 66 5f 70 6f 69  6e 74 20 2a 20 b5 28 20  |n_of_point * .( |
00000d10  b2 20 58 5f 52 4f 54 41  54 49 4f 4e 20 29 0d 04  |. X_ROTATION )..|
00000d20  38 69 20 20 72 6f 74 61  74 65 64 5f 7a 5f 76 61  |8i  rotated_z_va|
00000d30  6c 75 65 20 3d 20 79 5f  70 6f 73 69 74 69 6f 6e  |lue = y_position|
00000d40  5f 6f 66 5f 70 6f 69 6e  74 20 2a 20 b5 28 20 b2  |_of_point * .( .|
00000d50  20 58 5f 52 4f 54 41 54  49 4f 4e 20 29 20 2b 20  | X_ROTATION ) + |
00000d60  7a 5f 70 6f 73 69 74 69  6f 6e 5f 6f 66 5f 70 6f  |z_position_of_po|
00000d70  69 6e 74 20 2a 20 9b 28  20 b2 20 58 5f 52 4f 54  |int * .( . X_ROT|
00000d80  41 54 49 4f 4e 20 29 0d  04 42 2b 20 20 79 5f 70  |ATION )..B+  y_p|
00000d90  6f 73 69 74 69 6f 6e 5f  6f 66 5f 70 6f 69 6e 74  |osition_of_point|
00000da0  20 3d 20 72 6f 74 61 74  65 64 5f 79 5f 76 61 6c  | = rotated_y_val|
00000db0  75 65 0d 04 4c 2b 20 20  7a 5f 70 6f 73 69 74 69  |ue..L+  z_positi|
00000dc0  6f 6e 5f 6f 66 5f 70 6f  69 6e 74 20 3d 20 72 6f  |on_of_point = ro|
00000dd0  74 61 74 65 64 5f 7a 5f  76 61 6c 75 65 0d 04 56  |tated_z_value..V|
00000de0  04 0d 04 60 40 20 20 f4  20 2a 2a 2a 20 46 6f 72  |...`@  . *** For|
00000df0  6d 75 6c 61 20 66 6f 72  20 72 6f 74 61 74 69 6e  |mula for rotatin|
00000e00  67 20 74 68 65 20 70 6f  69 6e 74 20 61 72 6f 75  |g the point arou|
00000e10  6e 64 20 74 68 65 20 59  20 61 78 69 73 20 2a 2a  |nd the Y axis **|
00000e20  2a 0d 04 6a 69 20 20 72  6f 74 61 74 65 64 5f 78  |*..ji  rotated_x|
00000e30  5f 76 61 6c 75 65 20 3d  20 78 5f 70 6f 73 69 74  |_value = x_posit|
00000e40  69 6f 6e 5f 6f 66 5f 70  6f 69 6e 74 20 2a 20 9b  |ion_of_point * .|
00000e50  28 20 b2 20 59 5f 52 4f  54 41 54 49 4f 4e 20 29  |( . Y_ROTATION )|
00000e60  20 2b 20 7a 5f 70 6f 73  69 74 69 6f 6e 5f 6f 66  | + z_position_of|
00000e70  5f 70 6f 69 6e 74 20 2a  20 b5 28 20 b2 20 59 5f  |_point * .( . Y_|
00000e80  52 4f 54 41 54 49 4f 4e  20 29 0d 04 74 69 20 20  |ROTATION )..ti  |
00000e90  72 6f 74 61 74 65 64 5f  7a 5f 76 61 6c 75 65 20  |rotated_z_value |
00000ea0  3d 20 7a 5f 70 6f 73 69  74 69 6f 6e 5f 6f 66 5f  |= z_position_of_|
00000eb0  70 6f 69 6e 74 20 2a 20  9b 28 20 b2 20 59 5f 52  |point * .( . Y_R|
00000ec0  4f 54 41 54 49 4f 4e 20  29 20 2d 20 78 5f 70 6f  |OTATION ) - x_po|
00000ed0  73 69 74 69 6f 6e 5f 6f  66 5f 70 6f 69 6e 74 20  |sition_of_point |
00000ee0  2a 20 b5 28 20 b2 20 59  5f 52 4f 54 41 54 49 4f  |* .( . Y_ROTATIO|
00000ef0  4e 20 29 0d 04 7e 2b 20  20 78 5f 70 6f 73 69 74  |N )..~+  x_posit|
00000f00  69 6f 6e 5f 6f 66 5f 70  6f 69 6e 74 20 3d 20 72  |ion_of_point = r|
00000f10  6f 74 61 74 65 64 5f 78  5f 76 61 6c 75 65 0d 04  |otated_x_value..|
00000f20  88 2b 20 20 7a 5f 70 6f  73 69 74 69 6f 6e 5f 6f  |.+  z_position_o|
00000f30  66 5f 70 6f 69 6e 74 20  3d 20 72 6f 74 61 74 65  |f_point = rotate|
00000f40  64 5f 7a 5f 76 61 6c 75  65 0d 04 92 04 0d 04 9c  |d_z_value.......|
00000f50  40 20 20 f4 20 2a 2a 2a  20 46 6f 72 6d 75 6c 61  |@  . *** Formula|
00000f60  20 66 6f 72 20 72 6f 74  61 74 69 6e 67 20 74 68  | for rotating th|
00000f70  65 20 70 6f 69 6e 74 20  61 72 6f 75 6e 64 20 74  |e point around t|
00000f80  68 65 20 5a 20 61 78 69  73 20 2a 2a 2a 0d 04 a6  |he Z axis ***...|
00000f90  69 20 20 72 6f 74 61 74  65 64 5f 78 5f 76 61 6c  |i  rotated_x_val|
00000fa0  75 65 20 3d 20 78 5f 70  6f 73 69 74 69 6f 6e 5f  |ue = x_position_|
00000fb0  6f 66 5f 70 6f 69 6e 74  20 2a 20 9b 28 20 b2 20  |of_point * .( . |
00000fc0  5a 5f 52 4f 54 41 54 49  4f 4e 20 29 20 2d 20 79  |Z_ROTATION ) - y|
00000fd0  5f 70 6f 73 69 74 69 6f  6e 5f 6f 66 5f 70 6f 69  |_position_of_poi|
00000fe0  6e 74 20 2a 20 b5 28 20  b2 20 5a 5f 52 4f 54 41  |nt * .( . Z_ROTA|
00000ff0  54 49 4f 4e 20 29 0d 04  b0 69 20 20 72 6f 74 61  |TION )...i  rota|
00001000  74 65 64 5f 79 5f 76 61  6c 75 65 20 3d 20 78 5f  |ted_y_value = x_|
00001010  70 6f 73 69 74 69 6f 6e  5f 6f 66 5f 70 6f 69 6e  |position_of_poin|
00001020  74 20 2a 20 b5 28 20 b2  20 5a 5f 52 4f 54 41 54  |t * .( . Z_ROTAT|
00001030  49 4f 4e 20 29 20 2b 20  79 5f 70 6f 73 69 74 69  |ION ) + y_positi|
00001040  6f 6e 5f 6f 66 5f 70 6f  69 6e 74 20 2a 20 9b 28  |on_of_point * .(|
00001050  20 b2 20 5a 5f 52 4f 54  41 54 49 4f 4e 20 29 0d  | . Z_ROTATION ).|
00001060  04 ba 2b 20 20 78 5f 70  6f 73 69 74 69 6f 6e 5f  |..+  x_position_|
00001070  6f 66 5f 70 6f 69 6e 74  20 3d 20 72 6f 74 61 74  |of_point = rotat|
00001080  65 64 5f 78 5f 76 61 6c  75 65 0d 04 c4 2b 20 20  |ed_x_value...+  |
00001090  79 5f 70 6f 73 69 74 69  6f 6e 5f 6f 66 5f 70 6f  |y_position_of_po|
000010a0  69 6e 74 20 3d 20 72 6f  74 61 74 65 64 5f 79 5f  |int = rotated_y_|
000010b0  76 61 6c 75 65 0d 04 ce  04 0d 04 d8 41 20 20 f4  |value.......A  .|
000010c0  20 2a 2a 2a 20 4e 6f 77  20 77 65 27 76 65 20 72  | *** Now we've r|
000010d0  6f 74 61 74 65 64 20 74  68 65 20 6f 62 6a 65 63  |otated the objec|
000010e0  74 20 61 62 6f 75 74 20  69 74 73 65 6c 66 20 77  |t about itself w|
000010f0  65 20 6d 75 73 74 20 2a  2a 2a 0d 04 e2 41 20 20  |e must ***...A  |
00001100  f4 20 2a 2a 2a 20 70 6f  73 69 74 69 6f 6e 20 69  |. *** position i|
00001110  74 20 69 6e 20 73 70 61  63 65 20 72 65 6c 61 74  |t in space relat|
00001120  69 76 65 20 74 6f 20 77  68 65 72 65 20 57 45 20  |ive to where WE |
00001130  61 72 65 20 20 20 20 20  2a 2a 2a 0d 04 ec 3c 20  |are     ***...< |
00001140  20 78 5f 70 6f 73 69 74  69 6f 6e 5f 6f 66 5f 70  | x_position_of_p|
00001150  6f 69 6e 74 20 3d 20 78  5f 70 6f 73 69 74 69 6f  |oint = x_positio|
00001160  6e 5f 6f 66 5f 70 6f 69  6e 74 20 2b 20 58 5f 50  |n_of_point + X_P|
00001170  4f 53 49 54 49 4f 4e 0d  04 f6 3c 20 20 79 5f 70  |OSITION...<  y_p|
00001180  6f 73 69 74 69 6f 6e 5f  6f 66 5f 70 6f 69 6e 74  |osition_of_point|
00001190  20 3d 20 79 5f 70 6f 73  69 74 69 6f 6e 5f 6f 66  | = y_position_of|
000011a0  5f 70 6f 69 6e 74 20 2b  20 59 5f 50 4f 53 49 54  |_point + Y_POSIT|
000011b0  49 4f 4e 0d 05 00 3c 20  20 7a 5f 70 6f 73 69 74  |ION...<  z_posit|
000011c0  69 6f 6e 5f 6f 66 5f 70  6f 69 6e 74 20 3d 20 7a  |ion_of_point = z|
000011d0  5f 70 6f 73 69 74 69 6f  6e 5f 6f 66 5f 70 6f 69  |_position_of_poi|
000011e0  6e 74 20 2b 20 5a 5f 50  4f 53 49 54 49 4f 4e 0d  |nt + Z_POSITION.|
000011f0  05 0a 04 0d 05 14 49 20  20 f4 20 2a 2a 2a 20 43  |......I  . *** C|
00001200  6f 6e 76 65 72 74 20 66  72 6f 6d 20 74 68 65 20  |onvert from the |
00001210  72 6f 74 61 74 65 64 20  33 44 20 70 6f 73 69 74  |rotated 3D posit|
00001220  69 6f 6e 20 69 6e 74 6f  20 74 68 65 20 72 65 6c  |ion into the rel|
00001230  65 76 61 6e 74 20 20 20  20 2a 2a 2a 0d 05 1e 49  |evant    ***...I|
00001240  20 20 f4 20 2a 2a 2a 20  32 44 20 70 6f 73 69 74  |  . *** 2D posit|
00001250  69 6f 6e 2e 20 44 6f 6e  27 74 20 66 6f 72 67 65  |ion. Don't forge|
00001260  74 20 74 68 61 74 20 74  68 69 73 20 69 6e 76 6f  |t that this invo|
00001270  6c 76 65 73 20 64 69 76  69 64 69 6e 67 20 20 20  |lves dividing   |
00001280  20 20 2a 2a 2a 0d 05 28  49 20 20 f4 20 2a 2a 2a  |  ***..(I  . ***|
00001290  20 58 20 61 6e 64 20 59  20 62 79 20 5a 2c 20 61  | X and Y by Z, a|
000012a0  6e 64 20 61 70 6c 6c 79  69 6e 67 20 61 20 70 65  |nd apllying a pe|
000012b0  72 73 70 65 63 74 69 76  65 20 66 61 63 74 6f 72  |rspective factor|
000012c0  20 28 65 67 2e 20 38 30  30 29 20 2a 2a 2a 0d 05  | (eg. 800) ***..|
000012d0  32 6a 20 20 61 72 72 61  79 5f 66 6f 72 5f 74 68  |2j  array_for_th|
000012e0  65 5f 32 44 5f 70 6f 69  6e 74 73 28 20 70 6f 69  |e_2D_points( poi|
000012f0  6e 74 5f 74 6f 5f 72 6f  74 61 74 65 20 2c 20 31  |nt_to_rotate , 1|
00001300  20 29 20 3d 20 28 20 38  30 30 20 2a 20 78 5f 70  | ) = ( 800 * x_p|
00001310  6f 73 69 74 69 6f 6e 5f  6f 66 5f 70 6f 69 6e 74  |osition_of_point|
00001320  20 29 20 2f 20 7a 5f 70  6f 73 69 74 69 6f 6e 5f  | ) / z_position_|
00001330  6f 66 5f 70 6f 69 6e 74  0d 05 3c 6a 20 20 61 72  |of_point..<j  ar|
00001340  72 61 79 5f 66 6f 72 5f  74 68 65 5f 32 44 5f 70  |ray_for_the_2D_p|
00001350  6f 69 6e 74 73 28 20 70  6f 69 6e 74 5f 74 6f 5f  |oints( point_to_|
00001360  72 6f 74 61 74 65 20 2c  20 32 20 29 20 3d 20 28  |rotate , 2 ) = (|
00001370  20 38 30 30 20 2a 20 79  5f 70 6f 73 69 74 69 6f  | 800 * y_positio|
00001380  6e 5f 6f 66 5f 70 6f 69  6e 74 20 29 20 2f 20 7a  |n_of_point ) / z|
00001390  5f 70 6f 73 69 74 69 6f  6e 5f 6f 66 5f 70 6f 69  |_position_of_poi|
000013a0  6e 74 0d 05 46 04 0d 05  50 16 20 ed 20 70 6f 69  |nt..F...P. . poi|
000013b0  6e 74 5f 74 6f 5f 72 6f  74 61 74 65 0d 05 5a 04  |nt_to_rotate..Z.|
000013c0  0d 05 64 05 e1 0d 05 6e  04 0d 05 78 04 0d 05 82  |..d....n...x....|
000013d0  4e f4 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |N. -------------|
000013e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001410  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 05 8c 44 f4  |-----------...D.|
00001420  20 20 20 20 20 20 54 48  45 20 50 52 4f 43 45 44  |      THE PROCED|
00001430  55 52 45 20 54 48 41 54  20 44 52 41 57 53 20 54  |URE THAT DRAWS T|
00001440  48 45 20 46 41 43 45 54  53 20 54 48 41 54 20 4d  |HE FACETS THAT M|
00001450  41 4b 45 20 55 50 20 54  48 45 20 43 55 42 45 0d  |AKE UP THE CUBE.|
00001460  05 96 4e f4 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..N. -----------|
00001470  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000014a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0d 05 a0  |-------------...|
000014b0  04 0d 05 aa 04 0d 05 b4  1a dd 20 f2 65 64 75 72  |.......... .edur|
000014c0  65 5f 44 72 61 77 5f 54  68 65 5f 43 75 62 65 0d  |e_Draw_The_Cube.|
000014d0  05 be 04 0d 05 c8 15 20  e3 20 66 61 63 65 74 20  |....... . facet |
000014e0  3d 20 31 20 b8 20 31 32  0d 05 d2 04 0d 05 dc 39  |= 1 . 12.......9|
000014f0  20 20 20 20 20 70 6f 69  6e 74 5f 31 20 20 20 20  |     point_1    |
00001500  20 20 3d 20 61 72 72 61  79 5f 66 6f 72 5f 74 68  |  = array_for_th|
00001510  65 5f 66 61 63 65 74 73  28 20 66 61 63 65 74 20  |e_facets( facet |
00001520  2c 20 31 20 29 0d 05 e6  39 20 20 20 20 20 70 6f  |, 1 )...9     po|
00001530  69 6e 74 5f 32 20 20 20  20 20 20 3d 20 61 72 72  |int_2      = arr|
00001540  61 79 5f 66 6f 72 5f 74  68 65 5f 66 61 63 65 74  |ay_for_the_facet|
00001550  73 28 20 66 61 63 65 74  20 2c 20 32 20 29 0d 05  |s( facet , 2 )..|
00001560  f0 39 20 20 20 20 20 70  6f 69 6e 74 5f 33 20 20  |.9     point_3  |
00001570  20 20 20 20 3d 20 61 72  72 61 79 5f 66 6f 72 5f  |    = array_for_|
00001580  74 68 65 5f 66 61 63 65  74 73 28 20 66 61 63 65  |the_facets( face|
00001590  74 20 2c 20 33 20 29 0d  05 fa 39 20 20 20 20 20  |t , 3 )...9     |
000015a0  66 61 63 65 74 5f 63 6f  6c 6f 75 72 20 3d 20 61  |facet_colour = a|
000015b0  72 72 61 79 5f 66 6f 72  5f 74 68 65 5f 66 61 63  |rray_for_the_fac|
000015c0  65 74 73 28 20 66 61 63  65 74 20 2c 20 34 20 29  |ets( facet , 4 )|
000015d0  0d 06 04 04 0d 06 0e 44  20 20 20 20 20 66 69 72  |.......D     fir|
000015e0  73 74 5f 78 5f 70 6f 73  69 74 69 6f 6e 20 20 20  |st_x_position   |
000015f0  3d 20 61 72 72 61 79 5f  66 6f 72 5f 74 68 65 5f  |= array_for_the_|
00001600  32 44 5f 70 6f 69 6e 74  73 28 20 70 6f 69 6e 74  |2D_points( point|
00001610  5f 31 20 2c 20 31 20 29  0d 06 18 44 20 20 20 20  |_1 , 1 )...D    |
00001620  20 66 69 72 73 74 5f 79  5f 70 6f 73 69 74 69 6f  | first_y_positio|
00001630  6e 20 20 20 3d 20 61 72  72 61 79 5f 66 6f 72 5f  |n   = array_for_|
00001640  74 68 65 5f 32 44 5f 70  6f 69 6e 74 73 28 20 70  |the_2D_points( p|
00001650  6f 69 6e 74 5f 31 20 2c  20 32 20 29 0d 06 22 04  |oint_1 , 2 )..".|
00001660  0d 06 2c 44 20 20 20 20  20 73 65 63 6f 6e 64 5f  |..,D     second_|
00001670  78 5f 70 6f 73 69 74 69  6f 6e 20 20 3d 20 61 72  |x_position  = ar|
00001680  72 61 79 5f 66 6f 72 5f  74 68 65 5f 32 44 5f 70  |ray_for_the_2D_p|
00001690  6f 69 6e 74 73 28 20 70  6f 69 6e 74 5f 32 20 2c  |oints( point_2 ,|
000016a0  20 31 20 29 0d 06 36 44  20 20 20 20 20 73 65 63  | 1 )..6D     sec|
000016b0  6f 6e 64 5f 79 5f 70 6f  73 69 74 69 6f 6e 20 20  |ond_y_position  |
000016c0  3d 20 61 72 72 61 79 5f  66 6f 72 5f 74 68 65 5f  |= array_for_the_|
000016d0  32 44 5f 70 6f 69 6e 74  73 28 20 70 6f 69 6e 74  |2D_points( point|
000016e0  5f 32 20 2c 20 32 20 29  0d 06 40 04 0d 06 4a 44  |_2 , 2 )..@...JD|
000016f0  20 20 20 20 20 74 68 69  72 64 5f 78 5f 70 6f 73  |     third_x_pos|
00001700  69 74 69 6f 6e 20 20 20  3d 20 61 72 72 61 79 5f  |ition   = array_|
00001710  66 6f 72 5f 74 68 65 5f  32 44 5f 70 6f 69 6e 74  |for_the_2D_point|
00001720  73 28 20 70 6f 69 6e 74  5f 33 20 2c 20 31 20 29  |s( point_3 , 1 )|
00001730  0d 06 54 44 20 20 20 20  20 74 68 69 72 64 5f 79  |..TD     third_y|
00001740  5f 70 6f 73 69 74 69 6f  6e 20 20 20 3d 20 61 72  |_position   = ar|
00001750  72 61 79 5f 66 6f 72 5f  74 68 65 5f 32 44 5f 70  |ray_for_the_2D_p|
00001760  6f 69 6e 74 73 28 20 70  6f 69 6e 74 5f 33 20 2c  |oints( point_3 ,|
00001770  20 32 20 29 0d 06 5e 04  0d 06 68 46 20 20 20 20  | 2 )..^...hF    |
00001780  20 f4 20 2a 2a 2a 20 54  68 65 20 66 6f 6c 6c 6f  | . *** The follo|
00001790  77 69 6e 67 20 6c 69 6e  65 73 20 69 6d 70 6c 65  |wing lines imple|
000017a0  6d 65 6e 74 20 74 68 65  20 61 6c 67 6f 72 69 74  |ment the algorit|
000017b0  68 6d 20 66 6f 72 20 20  20 20 20 2a 2a 2a 0d 06  |hm for     ***..|
000017c0  72 46 20 20 20 20 20 f4  20 2a 2a 2a 20 64 65 74  |rF     . *** det|
000017d0  65 72 6d 69 6e 69 6e 67  20 77 68 65 74 68 65 72  |ermining whether|
000017e0  20 6f 72 20 6e 6f 74 20  74 68 65 20 66 61 63 65  | or not the face|
000017f0  74 20 69 73 20 63 75 72  72 65 6e 74 6c 79 20 20  |t is currently  |
00001800  20 2a 2a 2a 0d 06 7c 46  20 20 20 20 20 f4 20 2a  | ***..|F     . *|
00001810  2a 2a 20 76 69 73 69 62  6c 65 2e 20 49 74 27 73  |** visible. It's|
00001820  20 65 61 73 79 20 74 6f  20 72 65 61 64 2c 20 61  | easy to read, a|
00001830  6e 64 20 73 6f 6d 65 20  75 73 65 72 73 20 6d 61  |nd some users ma|
00001840  79 20 20 20 20 20 20 2a  2a 2a 0d 06 86 46 20 20  |y      ***...F  |
00001850  20 20 20 f4 20 2a 2a 2a  20 65 76 65 6e 68 20 6c  |   . *** evenh l|
00001860  69 6b 65 20 74 6f 20 64  69 73 63 6f 76 65 72 20  |ike to discover |
00001870  68 6f 77 20 69 74 20 77  6f 72 6b 73 20 69 6e 20  |how it works in |
00001880  6d 6f 72 65 20 64 65 74  61 69 6c 2e 20 2a 2a 2a  |more detail. ***|
00001890  0d 06 90 46 20 20 20 20  20 f4 20 2a 2a 2a 20 4f  |...F     . *** O|
000018a0  74 68 65 72 73 20 61 72  65 20 77 65 6c 63 6f 6d  |thers are welcom|
000018b0  65 20 74 6f 20 65 78 74  72 61 63 74 20 61 6e 79  |e to extract any|
000018c0  20 70 61 72 74 20 6f 66  20 74 68 69 73 20 20 20  | part of this   |
000018d0  20 20 20 2a 2a 2a 0d 06  9a 46 20 20 20 20 20 f4  |   ***...F     .|
000018e0  20 2a 2a 2a 20 70 72 6f  67 72 61 6d 20 66 6f 72  | *** program for|
000018f0  20 74 68 65 69 72 20 6f  77 6e 20 61 64 76 61 6e  | their own advan|
00001900  74 61 67 65 21 20 20 20  20 20 20 20 20 20 20 20  |tage!           |
00001910  20 20 20 20 20 20 20 20  20 2a 2a 2a 0d 06 a4 04  |         ***....|
00001920  0d 06 ae 32 20 20 20 20  20 72 30 20 3d 20 73 65  |...2     r0 = se|
00001930  63 6f 6e 64 5f 78 5f 70  6f 73 69 74 69 6f 6e 20  |cond_x_position |
00001940  2d 20 66 69 72 73 74 5f  78 5f 70 6f 73 69 74 69  |- first_x_positi|
00001950  6f 6e 0d 06 b8 41 20 20  20 20 20 72 31 20 3d 20  |on...A     r1 = |
00001960  74 68 69 72 64 5f 79 5f  70 6f 73 69 74 69 6f 6e  |third_y_position|
00001970  20 20 2d 20 66 69 72 73  74 5f 79 5f 70 6f 73 69  |  - first_y_posi|
00001980  74 69 6f 6e 20 3a 20 72  32 20 3d 20 72 30 20 2a  |tion : r2 = r0 *|
00001990  20 72 31 0d 06 c2 04 0d  06 cc 32 20 20 20 20 20  | r1.......2     |
000019a0  72 30 20 3d 20 74 68 69  72 64 5f 78 5f 70 6f 73  |r0 = third_x_pos|
000019b0  69 74 69 6f 6e 20 20 2d  20 66 69 72 73 74 5f 78  |ition  - first_x|
000019c0  5f 70 6f 73 69 74 69 6f  6e 0d 06 d6 41 20 20 20  |_position...A   |
000019d0  20 20 72 31 20 3d 20 73  65 63 6f 6e 64 5f 79 5f  |  r1 = second_y_|
000019e0  70 6f 73 69 74 69 6f 6e  20 2d 20 66 69 72 73 74  |position - first|
000019f0  5f 79 5f 70 6f 73 69 74  69 6f 6e 20 3a 20 72 33  |_y_position : r3|
00001a00  20 3d 20 72 30 20 2a 20  72 31 0d 06 e0 04 0d 06  | = r0 * r1......|
00001a10  ea 18 20 20 20 20 20 e7  20 72 32 20 2d 20 72 33  |..     . r2 - r3|
00001a20  20 3e 20 30 20 8c 0d 06  f4 1c 20 20 20 20 20 20  | > 0 .....      |
00001a30  e6 20 30 20 2c 20 66 61  63 65 74 5f 63 6f 6c 6f  |. 0 , facet_colo|
00001a40  75 72 0d 06 fe 35 20 20  20 20 20 20 ec 20 20 20  |ur...5      .   |
00001a50  20 20 20 66 69 72 73 74  5f 78 5f 70 6f 73 69 74  |   first_x_posit|
00001a60  69 6f 6e 20 20 2c 20 66  69 72 73 74 5f 79 5f 70  |ion  , first_y_p|
00001a70  6f 73 69 74 69 6f 6e 0d  07 08 36 20 20 20 20 20  |osition...6     |
00001a80  20 df 20 20 20 20 20 20  73 65 63 6f 6e 64 5f 78  | .      second_x|
00001a90  5f 70 6f 73 69 74 69 6f  6e 20 2c 20 73 65 63 6f  |_position , seco|
00001aa0  6e 64 5f 79 5f 70 6f 73  69 74 69 6f 6e 0d 07 12  |nd_y_position...|
00001ab0  35 20 20 20 20 20 20 f0  20 38 35 20 2c 20 74 68  |5      . 85 , th|
00001ac0  69 72 64 5f 78 5f 70 6f  73 69 74 69 6f 6e 20 20  |ird_x_position  |
00001ad0  2c 20 74 68 69 72 64 5f  79 5f 70 6f 73 69 74 69  |, third_y_positi|
00001ae0  6f 6e 0d 07 1c 0a 20 20  20 20 20 cd 0d 07 26 04  |on....     ...&.|
00001af0  0d 07 30 0c 20 ed 20 66  61 63 65 74 0d 07 3a 04  |..0. . facet..:.|
00001b00  0d 07 44 05 e1 0d 07 4e  04 0d 07 58 04 0d 07 62  |..D....N...X...b|
00001b10  4e f4 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |N. -------------|
00001b20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001b50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 07 6c 48 f4  |-----------..lH.|
00001b60  20 20 50 52 4f 43 45 44  55 52 45 20 54 4f 20 53  |  PROCEDURE TO S|
00001b70  57 41 50 20 4f 55 52 20  53 43 52 45 45 4e 53 2c  |WAP OUR SCREENS,|
00001b80  20 4b 45 45 50 49 4e 47  20 54 48 45 20 41 4e 49  | KEEPING THE ANI|
00001b90  4d 41 54 49 4f 4e 20 46  4c 49 43 4b 45 52 20 46  |MATION FLICKER F|
00001ba0  52 45 45 0d 07 76 4e f4  20 2d 2d 2d 2d 2d 2d 2d  |REE..vN. -------|
00001bb0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001bf0  2d 0d 07 80 04 0d 07 8a  04 0d 07 94 22 dd 20 f2  |-...........". .|
00001c00  65 64 75 72 65 5f 53 77  61 70 5f 54 68 65 5f 53  |edure_Swap_The_S|
00001c10  63 72 65 65 6e 5f 42 61  6e 6b 73 0d 07 9e 04 0d  |creen_Banks.....|
00001c20  07 a8 07 20 c8 96 0d 07  b2 14 20 42 41 4e 4b 20  |... ...... BANK |
00001c30  3d 20 42 41 4e 4b 20 82  20 33 0d 07 bc 12 20 c8  |= BANK . 3.... .|
00001c40  99 20 36 2c 31 31 32 2c  42 41 4e 4b 0d 07 c6 16  |. 6,112,BANK....|
00001c50  20 c8 99 20 36 2c 31 31  33 2c 42 41 4e 4b 20 82  | .. 6,113,BANK .|
00001c60  20 33 0d 07 d0 06 20 db  0d 07 da 04 0d 07 e4 05  | 3.... .........|
00001c70  e1 0d 07 ee 04 0d 07 f8  04 0d 08 02 4e f4 20 2d  |............N. -|
00001c80  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001cc0  2d 2d 2d 2d 2d 2d 2d 0d  08 0c 48 f4 20 20 54 48  |-------...H.  TH|
00001cd0  45 20 50 52 4f 43 45 44  55 52 45 20 54 48 41 54  |E PROCEDURE THAT|
00001ce0  20 52 45 41 44 53 20 54  48 45 20 38 20 50 4f 49  | READS THE 8 POI|
00001cf0  4e 54 53 20 49 4e 54 4f  20 54 48 45 20 41 52 52  |NTS INTO THE ARR|
00001d00  41 59 20 57 45 27 56 45  20 53 45 54 20 55 50 0d  |AY WE'VE SET UP.|
00001d10  08 16 4e f4 20 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |..N. -----------|
00001d20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001d50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 0d 08 20  |-------------.. |
00001d60  04 0d 08 2a 04 0d 08 34  29 dd 20 f2 65 64 75 72  |...*...4). .edur|
00001d70  65 5f 52 65 61 64 5f 50  6f 69 6e 74 73 5f 49 6e  |e_Read_Points_In|
00001d80  74 6f 5f 54 68 65 69 72  5f 41 72 72 61 79 0d 08  |to_Their_Array..|
00001d90  3e 04 0d 08 48 0b 20 f7  20 8d 64 7c 48 0d 08 52  |>...H. . .d|H..R|
00001da0  04 0d 08 5c 14 20 e3 20  70 6f 69 6e 74 20 3d 20  |...\. . point = |
00001db0  31 20 b8 20 38 0d 08 66  04 0d 08 70 2f 20 20 20  |1 . 8..f...p/   |
00001dc0  20 20 f3 20 58 5f 50 4f  53 49 54 49 4f 4e 20 2c  |  . X_POSITION ,|
00001dd0  20 59 5f 50 4f 53 49 54  49 4f 4e 20 2c 20 5a 5f  | Y_POSITION , Z_|
00001de0  50 4f 53 49 54 49 4f 4e  0d 08 7a 04 0d 08 84 3a  |POSITION..z....:|
00001df0  20 20 20 20 20 61 72 72  61 79 5f 66 6f 72 5f 74  |     array_for_t|
00001e00  68 65 5f 33 44 5f 70 6f  69 6e 74 73 28 20 70 6f  |he_3D_points( po|
00001e10  69 6e 74 20 2c 20 31 20  29 20 3d 20 58 5f 50 4f  |int , 1 ) = X_PO|
00001e20  53 49 54 49 4f 4e 0d 08  8e 3a 20 20 20 20 20 61  |SITION...:     a|
00001e30  72 72 61 79 5f 66 6f 72  5f 74 68 65 5f 33 44 5f  |rray_for_the_3D_|
00001e40  70 6f 69 6e 74 73 28 20  70 6f 69 6e 74 20 2c 20  |points( point , |
00001e50  32 20 29 20 3d 20 59 5f  50 4f 53 49 54 49 4f 4e  |2 ) = Y_POSITION|
00001e60  0d 08 98 3a 20 20 20 20  20 61 72 72 61 79 5f 66  |...:     array_f|
00001e70  6f 72 5f 74 68 65 5f 33  44 5f 70 6f 69 6e 74 73  |or_the_3D_points|
00001e80  28 20 70 6f 69 6e 74 20  2c 20 33 20 29 20 3d 20  |( point , 3 ) = |
00001e90  5a 5f 50 4f 53 49 54 49  4f 4e 0d 08 a2 04 0d 08  |Z_POSITION......|
00001ea0  ac 0c 20 ed 20 70 6f 69  6e 74 0d 08 b6 04 0d 08  |.. . point......|
00001eb0  c0 05 e1 0d 08 ca 04 0d  08 d4 04 0d 08 de 33 f4  |..............3.|
00001ec0  20 2a 2a 2a 20 54 68 65  20 64 61 74 61 20 66 6f  | *** The data fo|
00001ed0  72 20 74 68 65 20 38 20  70 6f 69 6e 74 73 20 6f  |r the 8 points o|
00001ee0  66 20 74 68 65 20 63 75  62 65 20 2a 2a 2a 0d 08  |f the cube ***..|
00001ef0  e8 04 0d 08 f2 04 0d 08  fc 40 dc 20 2d 31 30 2c  |.........@. -10,|
00001f00  2b 31 30 20 2c 20 2b 31  30 20 3a 20 52 45 4d 20  |+10 , +10 : REM |
00001f10  54 68 65 20 34 20 70 6f  69 6e 74 73 20 66 6f 72  |The 4 points for|
00001f20  20 74 68 65 20 66 72 6f  6e 74 20 6f 66 20 74 68  | the front of th|
00001f30  65 20 63 75 62 65 0d 09  06 13 dc 20 2b 31 30 2c  |e cube..... +10,|
00001f40  2b 31 30 20 2c 20 2b 31  30 0d 09 10 13 dc 20 2b  |+10 , +10..... +|
00001f50  31 30 2c 2d 31 30 20 2c  20 2b 31 30 0d 09 1a 13  |10,-10 , +10....|
00001f60  dc 20 2d 31 30 2c 2d 31  30 20 2c 20 2b 31 30 0d  |. -10,-10 , +10.|
00001f70  09 24 04 0d 09 2e 40 dc  20 2d 31 30 2c 2b 31 30  |.$....@. -10,+10|
00001f80  20 2c 20 2d 31 30 20 3a  20 52 45 4d 20 54 68 65  | , -10 : REM The|
00001f90  20 34 20 70 6f 69 6e 74  73 20 66 6f 72 20 74 68  | 4 points for th|
00001fa0  65 20 62 61 63 6b 20 20  6f 66 20 74 68 65 20 63  |e back  of the c|
00001fb0  75 62 65 0d 09 38 13 dc  20 2b 31 30 2c 2b 31 30  |ube..8.. +10,+10|
00001fc0  20 2c 20 2d 31 30 0d 09  42 13 dc 20 2b 31 30 2c  | , -10..B.. +10,|
00001fd0  2d 31 30 20 2c 20 2d 31  30 0d 09 4c 13 dc 20 2d  |-10 , -10..L.. -|
00001fe0  31 30 2c 2d 31 30 20 2c  20 2d 31 30 0d 09 56 04  |10,-10 , -10..V.|
00001ff0  0d 09 60 04 0d 09 6a 4e  f4 20 2d 2d 2d 2d 2d 2d  |..`...jN. ------|
00002000  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002040  2d 2d 0d 09 74 49 f4 20  20 54 48 45 20 50 52 4f  |--..tI.  THE PRO|
00002050  43 45 44 55 52 45 20 54  48 41 54 20 52 45 41 44  |CEDURE THAT READ|
00002060  53 20 54 48 45 20 31 32  20 46 41 43 45 54 53 20  |S THE 12 FACETS |
00002070  49 4e 54 4f 20 54 48 45  20 41 52 52 41 59 20 57  |INTO THE ARRAY W|
00002080  45 27 56 45 20 53 45 54  20 55 50 0d 09 7e 4e f4  |E'VE SET UP..~N.|
00002090  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
000020a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000020d0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 09 88 04 0d 09 92  |---------.......|
000020e0  04 0d 09 9c 29 dd 20 f2  65 64 75 72 65 5f 52 65  |....). .edure_Re|
000020f0  61 64 5f 46 61 63 65 74  73 5f 49 6e 74 6f 5f 54  |ad_Facets_Into_T|
00002100  68 65 69 72 5f 41 72 72  61 79 0d 09 a6 04 0d 09  |heir_Array......|
00002110  b0 0b 20 f7 20 8d 44 6e  4a 0d 09 ba 04 0d 09 c4  |.. . .DnJ.......|
00002120  15 20 e3 20 66 61 63 65  74 20 3d 20 31 20 b8 20  |. . facet = 1 . |
00002130  31 32 0d 09 ce 04 0d 09  d8 32 20 20 20 20 20 f3  |12.......2     .|
00002140  20 4a 4f 49 4e 5f 31 20  2c 20 4a 4f 49 4e 5f 32  | JOIN_1 , JOIN_2|
00002150  20 2c 20 4a 4f 49 4e 5f  33 20 2c 20 46 41 43 45  | , JOIN_3 , FACE|
00002160  54 5f 43 4f 4c 4f 55 52  0d 09 e2 04 0d 09 ec 33  |T_COLOUR.......3|
00002170  20 20 20 20 20 61 72 72  61 79 5f 66 6f 72 5f 74  |     array_for_t|
00002180  68 65 5f 66 61 63 65 74  73 28 20 66 61 63 65 74  |he_facets( facet|
00002190  20 2c 20 31 20 29 20 3d  20 4a 4f 49 4e 5f 31 0d  | , 1 ) = JOIN_1.|
000021a0  09 f6 33 20 20 20 20 20  61 72 72 61 79 5f 66 6f  |..3     array_fo|
000021b0  72 5f 74 68 65 5f 66 61  63 65 74 73 28 20 66 61  |r_the_facets( fa|
000021c0  63 65 74 20 2c 20 32 20  29 20 3d 20 4a 4f 49 4e  |cet , 2 ) = JOIN|
000021d0  5f 32 0d 0a 00 33 20 20  20 20 20 61 72 72 61 79  |_2...3     array|
000021e0  5f 66 6f 72 5f 74 68 65  5f 66 61 63 65 74 73 28  |_for_the_facets(|
000021f0  20 66 61 63 65 74 20 2c  20 33 20 29 20 3d 20 4a  | facet , 3 ) = J|
00002200  4f 49 4e 5f 33 0d 0a 0a  39 20 20 20 20 20 61 72  |OIN_3...9     ar|
00002210  72 61 79 5f 66 6f 72 5f  74 68 65 5f 66 61 63 65  |ray_for_the_face|
00002220  74 73 28 20 66 61 63 65  74 20 2c 20 34 20 29 20  |ts( facet , 4 ) |
00002230  3d 20 46 41 43 45 54 5f  43 4f 4c 4f 55 52 0d 0a  |= FACET_COLOUR..|
00002240  14 04 0d 0a 1e 0c 20 ed  20 66 61 63 65 74 0d 0a  |...... . facet..|
00002250  28 04 0d 0a 32 05 e1 0d  0a 3c 04 0d 0a 46 04 0d  |(...2....<...F..|
00002260  0a 50 3c f4 20 2a 2a 2a  20 54 68 65 20 64 61 74  |.P<. *** The dat|
00002270  61 20 66 6f 72 20 74 68  65 20 31 32 20 66 61 63  |a for the 12 fac|
00002280  65 74 73 20 74 6f 20 6d  61 6b 65 20 75 70 20 74  |ets to make up t|
00002290  68 65 20 63 75 62 65 20  2a 2a 2a 0d 0a 5a 04 0d  |he cube ***..Z..|
000022a0  0a 64 04 0d 0a 6e 3e dc  20 31 20 2c 20 32 20 2c  |.d...n>. 1 , 2 ,|
000022b0  20 33 20 2c 20 20 31 20  3a 20 52 45 4d 20 54 68  | 3 ,  1 : REM Th|
000022c0  65 20 6c 69 6e 6b 73 20  74 6f 20 6a 6f 69 6e 20  |e links to join |
000022d0  75 70 20 74 68 65 20 66  72 6f 6e 74 20 66 61 63  |up the front fac|
000022e0  65 0d 0a 78 14 dc 20 31  20 2c 20 33 20 2c 20 34  |e..x.. 1 , 3 , 4|
000022f0  20 2c 20 20 31 0d 0a 82  04 0d 0a 8c 3d dc 20 36  | ,  1.......=. 6|
00002300  20 2c 20 35 20 2c 20 37  20 2c 20 20 33 20 3a 20  | , 5 , 7 ,  3 : |
00002310  52 45 4d 20 54 68 65 20  6c 69 6e 6b 73 20 74 6f  |REM The links to|
00002320  20 6a 6f 69 6e 20 75 70  20 74 68 65 20 62 61 63  | join up the bac|
00002330  6b 20 66 61 63 65 0d 0a  96 14 dc 20 35 20 2c 20  |k face..... 5 , |
00002340  38 20 2c 20 37 20 2c 20  20 33 0d 0a a0 04 0d 0a  |8 , 7 ,  3......|
00002350  aa 3c dc 20 32 20 2c 20  36 20 2c 20 37 20 2c 20  |.<. 2 , 6 , 7 , |
00002360  20 35 20 3a 20 52 45 4d  20 54 68 65 20 6c 69 6e  | 5 : REM The lin|
00002370  6b 73 20 74 6f 20 6a 6f  69 6e 20 75 70 20 74 68  |ks to join up th|
00002380  65 20 52 48 53 20 66 61  63 65 0d 0a b4 14 dc 20  |e RHS face..... |
00002390  32 20 2c 20 37 20 2c 20  33 20 2c 20 20 35 0d 0a  |2 , 7 , 3 ,  5..|
000023a0  be 04 0d 0a c8 3c dc 20  35 20 2c 20 31 20 2c 20  |.....<. 5 , 1 , |
000023b0  34 20 2c 20 20 37 20 3a  20 52 45 4d 20 54 68 65  |4 ,  7 : REM The|
000023c0  20 6c 69 6e 6b 73 20 74  6f 20 6a 6f 69 6e 20 75  | links to join u|
000023d0  70 20 74 68 65 20 4c 48  53 20 66 61 63 65 0d 0a  |p the LHS face..|
000023e0  d2 14 dc 20 35 20 2c 20  34 20 2c 20 38 20 2c 20  |... 5 , 4 , 8 , |
000023f0  20 37 0d 0a dc 04 0d 0a  e6 3c dc 20 35 20 2c 20  | 7.......<. 5 , |
00002400  36 20 2c 20 32 20 2c 20  20 39 20 3a 20 52 45 4d  |6 , 2 ,  9 : REM|
00002410  20 54 68 65 20 6c 69 6e  6b 73 20 74 6f 20 6a 6f  | The links to jo|
00002420  69 6e 20 75 70 20 74 68  65 20 74 6f 70 20 66 61  |in up the top fa|
00002430  63 65 0d 0a f0 14 dc 20  35 20 2c 20 32 20 2c 20  |ce..... 5 , 2 , |
00002440  31 20 2c 20 20 39 0d 0a  fa 04 0d 0b 04 3f dc 20  |1 ,  9.......?. |
00002450  34 20 2c 20 33 20 2c 20  38 20 2c 20 31 31 20 3a  |4 , 3 , 8 , 11 :|
00002460  20 52 45 4d 20 54 68 65  20 6c 69 6e 6b 73 20 74  | REM The links t|
00002470  6f 20 6a 6f 69 6e 20 75  70 20 74 68 65 20 62 6f  |o join up the bo|
00002480  74 74 6f 6d 20 66 61 63  65 0d 0b 0e 14 dc 20 33  |ttom face..... 3|
00002490  20 2c 20 37 20 2c 20 38  20 2c 20 31 31 0d ff     | , 7 , 8 , 11..|
0000249f