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

!AWJuly94/Goodies/3D_Demo/Animate

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/Animate
Read OK:
File size: 2676 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM >Animate
   20REM Program : Animate
   30REM           Simple 3D animation 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_Animate
  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( 12 , 3 ) : REM 12 points, each being an X,Y,Z (3D)
  370 DIM array_for_the_2D_points( 12 , 2 ) : REM 12 points, each being an X,Y   (2D)
  380 DIM array_for_the_facets( 14 , 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 = 345
  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 ANIMATED CUBE ON THE SCREEN
  730REM ------------------------------------------------------------------------
  740
  750
  760DEF PROCedure_Animate
  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 + 2 : IF X_ROTATION >= 360 THEN X_ROTATION = X_ROTATION - 360
  850    Y_ROTATION = Y_ROTATION + 2 : IF Y_ROTATION >= 360 THEN Y_ROTATION = Y_ROTATION - 360
  860    Z_ROTATION = Z_ROTATION + 2 : 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 12
 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 *** This part is effectively the kinetic formula which ***
 1070  REM *** acts on points 1-4 to make them move               ***
 1080  IF point_to_rotate <= 4 THEN
 1090   y_position_of_point = y_position_of_point + y_position_of_point * SIN(RAD TIME)
 1100  ENDIF
 1110
 1120  REM *** Formula for rotating the point around the X axis ***
 1130  rotated_y_value = y_position_of_point * COS( RAD X_ROTATION ) - z_position_of_point * SIN( RAD X_ROTATION )
 1140  rotated_z_value = y_position_of_point * SIN( RAD X_ROTATION ) + z_position_of_point * COS( RAD X_ROTATION )
 1150  y_position_of_point = rotated_y_value
 1160  z_position_of_point = rotated_z_value
 1170
 1180  REM *** Formula for rotating the point around the Y axis ***
 1190  rotated_x_value = x_position_of_point * COS( RAD Y_ROTATION ) + z_position_of_point * SIN( RAD Y_ROTATION )
 1200  rotated_z_value = z_position_of_point * COS( RAD Y_ROTATION ) - x_position_of_point * SIN( RAD Y_ROTATION )
 1210  x_position_of_point = rotated_x_value
 1220  z_position_of_point = rotated_z_value
 1230
 1240  REM *** Formula for rotating the point around the Z axis ***
 1250  rotated_x_value = x_position_of_point * COS( RAD Z_ROTATION ) - y_position_of_point * SIN( RAD Z_ROTATION )
 1260  rotated_y_value = x_position_of_point * SIN( RAD Z_ROTATION ) + y_position_of_point * COS( RAD Z_ROTATION )
 1270  x_position_of_point = rotated_x_value
 1280  y_position_of_point = rotated_y_value
 1290
 1300  REM *** Now we've rotated the object about itself we must ***
 1310  REM *** position it in space relative to where WE are     ***
 1320  x_position_of_point = x_position_of_point + X_POSITION
 1330  y_position_of_point = y_position_of_point + Y_POSITION
 1340  z_position_of_point = z_position_of_point + Z_POSITION
 1350
 1360  REM *** Convert from the rotated 3D position into the relevant    ***
 1370  REM *** 2D position. Don't forget that this involves dividing     ***
 1380  REM *** X and Y by Z, and apllying a perspective factor (eg. 800) ***
 1390  array_for_the_2D_points( point_to_rotate , 1 ) = ( 800 * x_position_of_point ) / z_position_of_point
 1400  array_for_the_2D_points( point_to_rotate , 2 ) = ( 800 * y_position_of_point ) / z_position_of_point
 1410
 1420 NEXT point_to_rotate
 1430
 1440ENDPROC
 1450
 1460
 1470REM ------------------------------------------------------------------------
 1480REM      THE PROCEDURE THAT DRAWS THE FACETS THAT MAKE UP THE CUBE
 1490REM ------------------------------------------------------------------------
 1500
 1510
 1520DEF PROCedure_Draw_The_Cube
 1530
 1540 FOR facet = 1 TO 14
 1550
 1560     point_1      = array_for_the_facets( facet , 1 )
 1570     point_2      = array_for_the_facets( facet , 2 )
 1580     point_3      = array_for_the_facets( facet , 3 )
 1590     facet_colour = array_for_the_facets( facet , 4 )
 1600
 1610     first_x_position   = array_for_the_2D_points( point_1 , 1 )
 1620     first_y_position   = array_for_the_2D_points( point_1 , 2 )
 1630
 1640     second_x_position  = array_for_the_2D_points( point_2 , 1 )
 1650     second_y_position  = array_for_the_2D_points( point_2 , 2 )
 1660
 1670     third_x_position   = array_for_the_2D_points( point_3 , 1 )
 1680     third_y_position   = array_for_the_2D_points( point_3 , 2 )
 1690
 1700     REM *** The following lines implement the algorithm for     ***
 1710     REM *** determining whether or not the facet is currently   ***
 1720     REM *** visible. It's easy to read, and some users may      ***
 1730     REM *** evenh like to discover how it works in more detail. ***
 1740     REM *** Others are welcome to extract any part of this      ***
 1750     REM *** program for their own advantage!                    ***
 1760
 1770     r0 = second_x_position - first_x_position
 1780     r1 = third_y_position  - first_y_position : r2 = r0 * r1
 1790
 1800     r0 = third_x_position  - first_x_position
 1810     r1 = second_y_position - first_y_position : r3 = r0 * r1
 1820
 1830     IF r2 - r3 > 0 THEN
 1840      GCOL 0 , facet_colour
 1850      MOVE      first_x_position  , first_y_position
 1860      DRAW      second_x_position , second_y_position
 1870      PLOT 85 , third_x_position  , third_y_position
 1880     ENDIF
 1890
 1900 NEXT facet
 1910
 1920ENDPROC
 1930
 1940
 1950REM ------------------------------------------------------------------------
 1960REM  PROCEDURE TO SWAP OUR SCREENS, KEEPING THE ANIMATION FLICKER FREE
 1970REM ------------------------------------------------------------------------
 1980
 1990
 2000DEF PROCedure_Swap_The_Screen_Banks
 2010
 2020 WAIT
 2030 BANK = BANK EOR 3
 2040 SYS 6,112,BANK
 2050 SYS 6,113,BANK EOR 3
 2060 CLS
 2070
 2080ENDPROC
 2090
 2100
 2110REM ------------------------------------------------------------------------
 2120REM  THE PROCEDURE THAT READS THE 8 POINTS INTO THE ARRAY WE'VE SET UP
 2130REM ------------------------------------------------------------------------
 2140
 2150
 2160DEF PROCedure_Read_Points_Into_Their_Array
 2170
 2180 RESTORE 2350
 2190
 2200 FOR point = 1 TO 12
 2210
 2220     READ X_POSITION , Y_POSITION , Z_POSITION
 2230
 2240     array_for_the_3D_points( point , 1 ) = X_POSITION
 2250     array_for_the_3D_points( point , 2 ) = Y_POSITION
 2260     array_for_the_3D_points( point , 3 ) = Z_POSITION
 2270
 2280 NEXT point
 2290
 2300ENDPROC
 2310
 2320
 2330REM *** The data for the 9 points of the cube ***
 2340
 2350DATA   0,+10 ,   0 : REM The 4 identical points at the top centre
 2360DATA   0,+10 ,   0
 2370DATA   0,+10 ,   0
 2380DATA   0,+10 ,   0
 2390
 2400DATA -10,+10 , +10 : REM The 4 points for the front of the cube
 2410DATA +10,+10 , +10
 2420DATA +10,-10 , +10
 2430DATA -10,-10 , +10
 2440
 2450DATA -10,+10 , -10 : REM The 4 points for the back of the cube
 2460DATA +10,+10 , -10
 2470DATA +10,-10 , -10
 2480DATA -10,-10 , -10
 2490
 2500
 2510REM ------------------------------------------------------------------------
 2520REM  THE PROCEDURE THAT READS THE 12 FACETS INTO THE ARRAY WE'VE SET UP
 2530REM ------------------------------------------------------------------------
 2540
 2550
 2560DEF PROCedure_Read_Facets_Into_Their_Array
 2570
 2580 RESTORE 2770
 2590
 2600 FOR facet = 1 TO 14
 2610
 2620     READ JOIN_1 , JOIN_2 , JOIN_3 , FACET_COLOUR
 2630
 2640     array_for_the_facets( facet , 1 ) = JOIN_1
 2650     array_for_the_facets( facet , 2 ) = JOIN_2
 2660     array_for_the_facets( facet , 3 ) = JOIN_3
 2670     array_for_the_facets( facet , 4 ) = FACET_COLOUR
 2680
 2690 NEXT facet
 2700
 2710ENDPROC
 2720
 2730
 2740REM *** The data for the 12 facets to make up the cube ***
 2750
 2760
 2770DATA  9 ,  1 ,  5 ,  3 : REM The four top pieces that move
 2780DATA  9 , 10 ,  2 ,  5
 2790DATA  6 ,  3 , 10 ,  8
 2800DATA  5 ,  4 ,  6 , 11
 2810
 2820DATA  5 ,  6 ,  7 ,  1 : REM The links to join up the front face
 2830DATA  5 ,  7 ,  8 ,  1
 2840
 2850DATA 10 ,  9 , 11 ,  3 : REM The links to join up the back face
 2860DATA  9 , 12 , 11 ,  3
 2870
 2880DATA  6 , 10 , 11 ,  5 : REM The links to join up the RHS face
 2890DATA  6 , 11 ,  7 ,  5
 2900
 2910DATA  9 ,  5 ,  8 ,  7 : REM The links to join up the LHS face
 2920DATA  9 ,  8 , 12 ,  7
 2930
 2940DATA  8 ,  7 , 12 , 11 : REM The links to join up the bottom face
 2950DATA  7 , 11 , 12 , 11

� >Animate
� Program : Animate
0�           Simple 3D animation 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_Animate
�
��
�
�
�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 ***
hP � array_for_the_3D_points( 12 , 3 ) : � 12 points, each being an X,Y,Z (3D)
rP � array_for_the_2D_points( 12 , 2 ) : � 12 points, each being an X,Y   (2D)
|b � array_for_the_facets( 14 , 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 = 345
 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 ANIMATED CUBE ON THE SCREEN
�N� ------------------------------------------------------------------------
�
�
�� �edure_Animate

 �

     �edure_Rotate_The_Cube
*    �edure_Draw_The_Cube
4$    �edure_Swap_The_Screen_Banks
>
HY    X_ROTATION = X_ROTATION + 2 : � X_ROTATION >= 360 � X_ROTATION = X_ROTATION - 360
RY    Y_ROTATION = Y_ROTATION + 2 : � Y_ROTATION >= 360 � Y_ROTATION = Y_ROTATION - 360
\Y    Z_ROTATION = Z_ROTATION + 2 : � 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 � 12
�
�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 )

$B  � *** This part is effectively the kinetic formula which ***
.B  � *** acts on points 1-4 to make them move               ***
8  � point_to_rotate <= 4 �
BO   y_position_of_point = y_position_of_point + y_position_of_point * �(� �)
L  �
V
`@  � *** Formula for rotating the point around the X axis ***
ji  rotated_y_value = y_position_of_point * �( � X_ROTATION ) - z_position_of_point * �( � X_ROTATION )
ti  rotated_z_value = y_position_of_point * �( � X_ROTATION ) + z_position_of_point * �( � X_ROTATION )
~+  y_position_of_point = rotated_y_value
�+  z_position_of_point = rotated_z_value
�
�@  � *** Formula for rotating the point around the Y axis ***
�i  rotated_x_value = x_position_of_point * �( � Y_ROTATION ) + z_position_of_point * �( � Y_ROTATION )
�i  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
2<  y_position_of_point = y_position_of_point + Y_POSITION
<<  z_position_of_point = z_position_of_point + Z_POSITION
F
PI  � *** Convert from the rotated 3D position into the relevant    ***
ZI  � *** 2D position. Don't forget that this involves dividing     ***
dI  � *** X and Y by Z, and apllying a perspective factor (eg. 800) ***
nj  array_for_the_2D_points( point_to_rotate , 1 ) = ( 800 * x_position_of_point ) / z_position_of_point
xj  array_for_the_2D_points( point_to_rotate , 2 ) = ( 800 * y_position_of_point ) / z_position_of_point
�
� � point_to_rotate
�
��
�
�
�N� ------------------------------------------------------------------------
�D�      THE PROCEDURE THAT DRAWS THE FACETS THAT MAKE UP THE CUBE
�N� ------------------------------------------------------------------------
�
�
�� �edure_Draw_The_Cube
�
 � facet = 1 � 14

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 )
69     facet_colour = array_for_the_facets( facet , 4 )
@
JD     first_x_position   = array_for_the_2D_points( point_1 , 1 )
TD     first_y_position   = array_for_the_2D_points( point_1 , 2 )
^
hD     second_x_position  = array_for_the_2D_points( point_2 , 1 )
rD     second_y_position  = array_for_the_2D_points( point_2 , 2 )
|
�D     third_x_position   = array_for_the_2D_points( point_3 , 1 )
�D     third_y_position   = array_for_the_2D_points( point_3 , 2 )
�
�F     � *** The following lines implement the algorithm for     ***
�F     � *** 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      � 0 , facet_colour
:5      �      first_x_position  , first_y_position
D6      �      second_x_position , second_y_position
N5      � 85 , third_x_position  , third_y_position
X
     �
b
l � facet
v
��
�
�
�N� ------------------------------------------------------------------------
�H�  PROCEDURE TO SWAP OUR SCREENS, KEEPING THE ANIMATION FLICKER FREE
�N� ------------------------------------------------------------------------
�
�
�"� �edure_Swap_The_Screen_Banks
�
� Ȗ
� BANK = BANK � 3
� ș 6,112,BANK
 ș 6,113,BANK � 3
 �

 �
*
4
>N� ------------------------------------------------------------------------
HH�  THE PROCEDURE THAT READS THE 8 POINTS INTO THE ARRAY WE'VE SET UP
RN� ------------------------------------------------------------------------
\
f
p)� �edure_Read_Points_Into_Their_Array
z
� � �TnI
�
� � point = 1 � 12
�
�/     � X_POSITION , Y_POSITION , Z_POSITION
�
�:     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 9 points of the cube ***
	$
	.B�   0,+10 ,   0 : REM The 4 identical points at the top centre
	8�   0,+10 ,   0
	B�   0,+10 ,   0
	L�   0,+10 ,   0
	V
	`@� -10,+10 , +10 : REM The 4 points for the front of the cube
	j� +10,+10 , +10
	t� +10,-10 , +10
	~� -10,-10 , +10
	�
	�?� -10,+10 , -10 : REM The 4 points for the back of the cube
	�� +10,+10 , -10
	�� +10,-10 , -10
	�� -10,-10 , -10
	�
	�
	�N� ------------------------------------------------------------------------
	�I�  THE PROCEDURE THAT READS THE 12 FACETS INTO THE ARRAY WE'VE SET UP
	�N� ------------------------------------------------------------------------
	�
	�
)� �edure_Read_Facets_Into_Their_Array


 � �dRJ

( � facet = 1 � 14
2
<2     � JOIN_1 , JOIN_2 , JOIN_3 , FACET_COLOUR
F
P3     array_for_the_facets( facet , 1 ) = JOIN_1
Z3     array_for_the_facets( facet , 2 ) = JOIN_2
d3     array_for_the_facets( facet , 3 ) = JOIN_3
n9     array_for_the_facets( facet , 4 ) = FACET_COLOUR
x
� � facet
�
��
�
�
�<� *** The data for the 12 facets to make up the cube ***
�
�
�;�  9 ,  1 ,  5 ,  3 : REM The four top pieces that move
��  9 , 10 ,  2 ,  5
��  6 ,  3 , 10 ,  8
��  5 ,  4 ,  6 , 11
�
A�  5 ,  6 ,  7 ,  1 : REM The links to join up the front face
�  5 ,  7 ,  8 ,  1

"@� 10 ,  9 , 11 ,  3 : REM The links to join up the back face
,�  9 , 12 , 11 ,  3
6
@?�  6 , 10 , 11 ,  5 : REM The links to join up the RHS face
J�  6 , 11 ,  7 ,  5
T
^?�  9 ,  5 ,  8 ,  7 : REM The links to join up the LHS face
h�  9 ,  8 , 12 ,  7
r
|B�  8 ,  7 , 12 , 11 : REM The links to join up the bottom face
��  7 , 11 , 12 , 11
�
00000000  0d 00 0a 0e f4 20 3e 41  6e 69 6d 61 74 65 0d 00  |..... >Animate..|
00000010  14 17 f4 20 50 72 6f 67  72 61 6d 20 3a 20 41 6e  |... Program : An|
00000020  69 6d 61 74 65 0d 00 1e  30 f4 20 20 20 20 20 20  |imate...0.      |
00000030  20 20 20 20 20 53 69 6d  70 6c 65 20 33 44 20 61  |     Simple 3D a|
00000040  6e 69 6d 61 74 69 6f 6e  20 69 6e 20 42 42 43 20  |nimation in BBC |
00000050  42 41 53 49 43 0d 00 28  1f f4 20 41 75 74 68 6f  |BASIC..(.. Autho|
00000060  72 20 20 3a 20 4b 65 76  69 6e 20 4a 20 53 77 69  |r  : Kevin J Swi|
00000070  6e 74 6f 6e 0d 00 32 20  f4 20 56 65 72 73 69 6f  |nton..2 . Versio|
00000080  6e 20 3a 20 41 63 6f 72  6e 20 41 35 30 30 30 2e  |n : Acorn A5000.|
00000090  31 2e 30 30 0d 00 3c 25  f4 20 44 61 74 65 20 20  |1.00..<%. Date  |
000000a0  20 20 3a 20 54 68 75 72  73 64 61 79 20 35 74 68  |  : Thursday 5th|
000000b0  20 4d 61 79 20 31 39 39  34 0d 00 46 04 0d 00 50  | May 1994..F...P|
000000c0  04 0d 00 5a 23 ee 20 85  20 eb 20 eb 20 3a 20 f6  |...Z#. . . . : .|
000000d0  20 3a 20 f1 20 22 20 61  74 20 4c 69 6e 65 20 22  | : . " at Line "|
000000e0  3b 9e 3a e0 0d 00 64 04  0d 00 6e 04 0d 00 78 4e  |;.:...d...n...xN|
000000f0  f4 20 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 2d 0d 00 82 2f f4 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 20 4d 41 49  |             MAI|
00000160  4e 20 50 52 4f 47 52 41  4d 0d 00 8c 4e f4 20 2d  |N 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 2d 0d  00 96 04 0d 00 a0 04 0d  |-------.........|
000001c0  00 aa 10 eb 20 31 32 2b  31 32 38 20 3a 20 87 0d  |.... 12+128 : ..|
000001d0  00 b4 04 0d 00 be 16 20  f2 65 64 75 72 65 5f 49  |....... .edure_I|
000001e0  6e 69 74 69 61 6c 69 73  65 0d 00 c8 13 20 f2 65  |nitialise.... .e|
000001f0  64 75 72 65 5f 41 6e 69  6d 61 74 65 0d 00 d2 04  |dure_Animate....|
00000200  0d 00 dc 05 e0 0d 00 e6  04 0d 00 f0 04 0d 00 fa  |................|
00000210  4e f4 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |N. -------------|
00000220  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000250  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 01 04 40 f4  |-----------...@.|
00000260  20 20 20 20 20 20 20 20  20 50 52 4f 43 45 44 55  |         PROCEDU|
00000270  52 45 20 54 4f 20 49 4e  49 54 49 41 4c 49 53 45  |RE TO INITIALISE|
00000280  20 45 56 45 52 59 54 48  49 4e 47 20 57 45 20 4e  | EVERYTHING WE N|
00000290  45 45 44 20 54 4f 20 4b  4e 4f 57 0d 01 0e 4e f4  |EED TO KNOW...N.|
000002a0  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
000002b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000002e0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 01 18 04 0d 01 22  |---------......"|
000002f0  04 0d 01 2c 17 dd 20 f2  65 64 75 72 65 5f 49 6e  |...,.. .edure_In|
00000300  69 74 69 61 6c 69 73 65  0d 01 36 04 0d 01 40 3b  |itialise..6...@;|
00000310  20 f4 20 2a 2a 2a 20 50  6c 61 63 65 20 6f 75 72  | . *** Place our|
00000320  20 6f 72 69 67 69 6e 20  69 6e 20 74 68 65 20 6d  | origin in the m|
00000330  69 64 64 6c 65 20 6f 66  20 74 68 65 20 73 63 72  |iddle of the scr|
00000340  65 65 6e 20 2a 2a 2a 0d  01 4a 11 20 c8 91 20 36  |een ***..J. .. 6|
00000350  34 30 20 2c 20 35 31 32  0d 01 54 04 0d 01 5e 39  |40 , 512..T...^9|
00000360  20 f4 20 2a 2a 2a 20 44  69 6d 65 6e 73 69 6f 6e  | . *** Dimension|
00000370  20 61 6c 6c 20 74 68 65  20 61 72 72 61 79 73 20  | all the arrays |
00000380  74 68 61 74 20 77 65 20  77 69 6c 6c 20 6e 65 65  |that we will nee|
00000390  64 20 2a 2a 2a 0d 01 68  50 20 de 20 61 72 72 61  |d ***..hP . arra|
000003a0  79 5f 66 6f 72 5f 74 68  65 5f 33 44 5f 70 6f 69  |y_for_the_3D_poi|
000003b0  6e 74 73 28 20 31 32 20  2c 20 33 20 29 20 3a 20  |nts( 12 , 3 ) : |
000003c0  f4 20 31 32 20 70 6f 69  6e 74 73 2c 20 65 61 63  |. 12 points, eac|
000003d0  68 20 62 65 69 6e 67 20  61 6e 20 58 2c 59 2c 5a  |h being an X,Y,Z|
000003e0  20 28 33 44 29 0d 01 72  50 20 de 20 61 72 72 61  | (3D)..rP . arra|
000003f0  79 5f 66 6f 72 5f 74 68  65 5f 32 44 5f 70 6f 69  |y_for_the_2D_poi|
00000400  6e 74 73 28 20 31 32 20  2c 20 32 20 29 20 3a 20  |nts( 12 , 2 ) : |
00000410  f4 20 31 32 20 70 6f 69  6e 74 73 2c 20 65 61 63  |. 12 points, eac|
00000420  68 20 62 65 69 6e 67 20  61 6e 20 58 2c 59 20 20  |h being an X,Y  |
00000430  20 28 32 44 29 0d 01 7c  62 20 de 20 61 72 72 61  | (2D)..|b . arra|
00000440  79 5f 66 6f 72 5f 74 68  65 5f 66 61 63 65 74 73  |y_for_the_facets|
00000450  28 20 31 34 20 2c 20 34  20 29 20 20 20 20 3a 20  |( 14 , 4 )    : |
00000460  f4 20 31 32 20 66 61 63  65 74 73 2c 20 65 61 63  |. 12 facets, eac|
00000470  68 20 62 65 69 6e 67 20  33 20 70 6f 69 6e 74 20  |h being 3 point |
00000480  72 65 66 65 72 65 6e 63  65 73 20 61 6e 64 20 61  |references and a|
00000490  20 63 6f 6c 6f 75 72 0d  01 86 04 0d 01 90 49 20  | colour.......I |
000004a0  f4 20 2a 2a 2a 20 52 65  61 64 20 61 6c 6c 20 74  |. *** Read all t|
000004b0  68 65 20 69 6e 66 6f 72  6d 61 74 69 6f 6e 20 77  |he information w|
000004c0  65 20 6e 65 65 64 20 69  6e 74 6f 20 6f 75 72 20  |e need into our |
000004d0  61 72 72 61 79 73 2e 20  46 69 72 73 74 6c 79 2c  |arrays. Firstly,|
000004e0  20 2a 2a 2a 0d 01 9a 49  20 f4 20 2a 2a 2a 20 72  | ***...I . *** r|
000004f0  65 61 64 20 69 6e 20 61  6c 6c 20 6f 75 72 20 70  |ead in all our p|
00000500  6f 69 6e 74 73 20 74 68  61 74 20 6d 61 6b 65 20  |oints that make |
00000510  75 70 20 74 68 65 20 63  75 62 65 2c 20 61 6e 64  |up the cube, and|
00000520  20 74 68 65 6e 20 20 20  20 20 2a 2a 2a 0d 01 a4  | then     ***...|
00000530  49 20 f4 20 2a 2a 2a 20  72 65 61 64 20 69 6e 20  |I . *** read in |
00000540  61 6c 6c 20 74 68 65 20  66 61 63 65 74 73 20 74  |all the facets t|
00000550  68 61 74 20 6a 6f 69 6e  20 74 68 65 20 70 6f 69  |hat join the poi|
00000560  6e 74 73 20 74 6f 67 65  74 68 65 72 2e 20 20 20  |nts together.   |
00000570  20 20 20 2a 2a 2a 0d 01  ae 28 20 f2 65 64 75 72  |   ***...( .edur|
00000580  65 5f 52 65 61 64 5f 50  6f 69 6e 74 73 5f 49 6e  |e_Read_Points_In|
00000590  74 6f 5f 54 68 65 69 72  5f 41 72 72 61 79 0d 01  |to_Their_Array..|
000005a0  b8 28 20 f2 65 64 75 72  65 5f 52 65 61 64 5f 46  |.( .edure_Read_F|
000005b0  61 63 65 74 73 5f 49 6e  74 6f 5f 54 68 65 69 72  |acets_Into_Their|
000005c0  5f 41 72 72 61 79 0d 01  c2 04 0d 01 cc 0d 20 42  |_Array........ B|
000005d0  41 4e 4b 20 3d 20 31 0d  01 d6 25 20 f2 65 64 75  |ANK = 1...% .edu|
000005e0  72 65 5f 53 77 61 70 5f  54 68 65 5f 53 63 72 65  |re_Swap_The_Scre|
000005f0  65 6e 5f 42 61 6e 6b 73  20 3a 20 db 0d 01 e0 25  |en_Banks : ....%|
00000600  20 f2 65 64 75 72 65 5f  53 77 61 70 5f 54 68 65  | .edure_Swap_The|
00000610  5f 53 63 72 65 65 6e 5f  42 61 6e 6b 73 20 3a 20  |_Screen_Banks : |
00000620  db 0d 01 ea 04 0d 01 f4  3d 20 f4 20 2a 2a 2a 20  |........= . *** |
00000630  49 6e 69 74 69 61 6c 69  73 65 20 74 68 65 20 72  |Initialise the r|
00000640  6f 74 61 74 69 6f 6e 20  6f 66 20 74 68 65 20 6f  |otation of the o|
00000650  62 6a 65 63 74 20 69 6e  20 73 70 61 63 65 20 2a  |bject in space *|
00000660  2a 2a 0d 01 fe 15 20 58  5f 52 4f 54 41 54 49 4f  |**.... X_ROTATIO|
00000670  4e 20 3d 20 33 34 35 0d  02 08 15 20 59 5f 52 4f  |N = 345.... Y_RO|
00000680  54 41 54 49 4f 4e 20 3d  20 20 20 30 0d 02 12 15  |TATION =   0....|
00000690  20 5a 5f 52 4f 54 41 54  49 4f 4e 20 3d 20 20 20  | Z_ROTATION =   |
000006a0  30 0d 02 1c 04 0d 02 26  3d 20 f4 20 2a 2a 2a 20  |0......&= . *** |
000006b0  49 6e 69 74 69 61 6c 69  73 65 20 74 68 65 20 70  |Initialise the p|
000006c0  6f 73 69 74 69 6f 6e 20  6f 66 20 74 68 65 20 6f  |osition of the o|
000006d0  62 6a 65 63 74 20 69 6e  20 73 70 61 63 65 20 2a  |bject in space *|
000006e0  2a 2a 0d 02 30 3d 20 f4  20 2a 2a 2a 20 73 6f 20  |**..0= . *** so |
000006f0  74 68 61 74 20 69 74 20  69 73 20 71 75 69 74 65  |that it is quite|
00000700  20 66 61 72 20 61 77 61  79 20 66 72 6f 6d 20 75  | far away from u|
00000710  73 20 20 20 20 20 20 20  20 20 20 20 2a 2a 2a 0d  |s           ***.|
00000720  02 3a 15 20 58 5f 50 4f  53 49 54 49 4f 4e 20 3d  |.:. X_POSITION =|
00000730  20 2b 20 30 0d 02 44 15  20 59 5f 50 4f 53 49 54  | + 0..D. Y_POSIT|
00000740  49 4f 4e 20 3d 20 2b 20  30 0d 02 4e 15 20 5a 5f  |ION = + 0..N. Z_|
00000750  50 4f 53 49 54 49 4f 4e  20 3d 20 2b 35 30 0d 02  |POSITION = +50..|
00000760  58 04 0d 02 62 15 20 e3  20 73 63 61 6c 65 20 3d  |X...b. . scale =|
00000770  20 31 20 b8 20 31 35 0d  02 6c 14 20 20 72 20 3d  | 1 . 15..l.  r =|
00000780  20 73 63 61 6c 65 20 2a  20 31 36 0d 02 76 0c 20  | scale * 16..v. |
00000790  20 67 20 3d 20 39 36 0d  02 80 19 20 20 62 20 3d  | g = 96....  b =|
000007a0  20 31 32 38 20 2b 20 73  63 61 6c 65 20 2a 20 34  | 128 + scale * 4|
000007b0  0d 02 8a 19 20 20 fb 20  73 63 61 6c 65 20 2c 20  |....  . scale , |
000007c0  72 20 2c 20 67 20 2c 20  62 0d 02 94 0c 20 ed 20  |r , g , b.... . |
000007d0  73 63 61 6c 65 0d 02 9e  04 0d 02 a8 05 e1 0d 02  |scale...........|
000007e0  b2 04 0d 02 bc 04 0d 02  c6 4e f4 20 2d 2d 2d 2d  |.........N. ----|
000007f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000830  2d 2d 2d 2d 0d 02 d0 44  f4 20 20 20 20 20 20 4d  |----...D.      M|
00000840  41 49 4e 20 50 52 4f 43  45 44 55 52 45 20 54 4f  |AIN PROCEDURE TO|
00000850  20 43 4f 4e 54 52 4f 4c  20 54 48 45 20 41 4e 49  | CONTROL THE ANI|
00000860  4d 41 54 45 44 20 43 55  42 45 20 4f 4e 20 54 48  |MATED CUBE ON TH|
00000870  45 20 53 43 52 45 45 4e  0d 02 da 4e f4 20 2d 2d  |E SCREEN...N. --|
00000880  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000008c0  2d 2d 2d 2d 2d 2d 0d 02  e4 04 0d 02 ee 04 0d 02  |------..........|
000008d0  f8 14 dd 20 f2 65 64 75  72 65 5f 41 6e 69 6d 61  |... .edure_Anima|
000008e0  74 65 0d 03 02 04 0d 03  0c 06 20 f5 0d 03 16 04  |te........ .....|
000008f0  0d 03 20 1e 20 20 20 20  f2 65 64 75 72 65 5f 52  |.. .    .edure_R|
00000900  6f 74 61 74 65 5f 54 68  65 5f 43 75 62 65 0d 03  |otate_The_Cube..|
00000910  2a 1c 20 20 20 20 f2 65  64 75 72 65 5f 44 72 61  |*.    .edure_Dra|
00000920  77 5f 54 68 65 5f 43 75  62 65 0d 03 34 24 20 20  |w_The_Cube..4$  |
00000930  20 20 f2 65 64 75 72 65  5f 53 77 61 70 5f 54 68  |  .edure_Swap_Th|
00000940  65 5f 53 63 72 65 65 6e  5f 42 61 6e 6b 73 0d 03  |e_Screen_Banks..|
00000950  3e 04 0d 03 48 59 20 20  20 20 58 5f 52 4f 54 41  |>...HY    X_ROTA|
00000960  54 49 4f 4e 20 3d 20 58  5f 52 4f 54 41 54 49 4f  |TION = X_ROTATIO|
00000970  4e 20 2b 20 32 20 3a 20  e7 20 58 5f 52 4f 54 41  |N + 2 : . X_ROTA|
00000980  54 49 4f 4e 20 3e 3d 20  33 36 30 20 8c 20 58 5f  |TION >= 360 . X_|
00000990  52 4f 54 41 54 49 4f 4e  20 3d 20 58 5f 52 4f 54  |ROTATION = X_ROT|
000009a0  41 54 49 4f 4e 20 2d 20  33 36 30 0d 03 52 59 20  |ATION - 360..RY |
000009b0  20 20 20 59 5f 52 4f 54  41 54 49 4f 4e 20 3d 20  |   Y_ROTATION = |
000009c0  59 5f 52 4f 54 41 54 49  4f 4e 20 2b 20 32 20 3a  |Y_ROTATION + 2 :|
000009d0  20 e7 20 59 5f 52 4f 54  41 54 49 4f 4e 20 3e 3d  | . Y_ROTATION >=|
000009e0  20 33 36 30 20 8c 20 59  5f 52 4f 54 41 54 49 4f  | 360 . Y_ROTATIO|
000009f0  4e 20 3d 20 59 5f 52 4f  54 41 54 49 4f 4e 20 2d  |N = Y_ROTATION -|
00000a00  20 33 36 30 0d 03 5c 59  20 20 20 20 5a 5f 52 4f  | 360..\Y    Z_RO|
00000a10  54 41 54 49 4f 4e 20 3d  20 5a 5f 52 4f 54 41 54  |TATION = Z_ROTAT|
00000a20  49 4f 4e 20 2b 20 32 20  3a 20 e7 20 5a 5f 52 4f  |ION + 2 : . Z_RO|
00000a30  54 41 54 49 4f 4e 20 3e  3d 20 33 36 30 20 8c 20  |TATION >= 360 . |
00000a40  5a 5f 52 4f 54 41 54 49  4f 4e 20 3d 20 5a 5f 52  |Z_ROTATION = Z_R|
00000a50  4f 54 41 54 49 4f 4e 20  2d 20 33 36 30 0d 03 66  |OTATION - 360..f|
00000a60  04 0d 03 70 0c 20 fd 20  31 20 3d 20 32 0d 03 7a  |...p. . 1 = 2..z|
00000a70  04 0d 03 84 05 e1 0d 03  8e 04 0d 03 98 04 0d 03  |................|
00000a80  a2 4e f4 20 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |.N. ------------|
00000a90  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000ac0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0d 03 ac 40  |------------...@|
00000ad0  f4 20 20 20 20 20 20 20  20 54 48 45 20 50 52 4f  |.        THE PRO|
00000ae0  43 45 44 55 52 45 20 54  48 41 54 20 52 4f 54 41  |CEDURE THAT ROTA|
00000af0  54 45 53 20 54 48 45 20  38 20 50 4f 49 4e 54 53  |TES THE 8 POINTS|
00000b00  20 4f 46 20 54 48 45 20  43 55 42 45 0d 03 b6 4e  | OF THE CUBE...N|
00000b10  f4 20 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |. --------------|
00000b20  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00000b50  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 0d 03 c0 04 0d 03  |----------......|
00000b60  ca 04 0d 03 d4 1c dd 20  f2 65 64 75 72 65 5f 52  |....... .edure_R|
00000b70  6f 74 61 74 65 5f 54 68  65 5f 43 75 62 65 0d 03  |otate_The_Cube..|
00000b80  de 04 0d 03 e8 1f 20 e3  20 70 6f 69 6e 74 5f 74  |...... . point_t|
00000b90  6f 5f 72 6f 74 61 74 65  20 3d 20 31 20 b8 20 31  |o_rotate = 1 . 1|
00000ba0  32 0d 03 f2 04 0d 03 fc  4a 20 20 78 5f 70 6f 73  |2.......J  x_pos|
00000bb0  69 74 69 6f 6e 5f 6f 66  5f 70 6f 69 6e 74 20 3d  |ition_of_point =|
00000bc0  20 61 72 72 61 79 5f 66  6f 72 5f 74 68 65 5f 33  | array_for_the_3|
00000bd0  44 5f 70 6f 69 6e 74 73  28 20 70 6f 69 6e 74 5f  |D_points( point_|
00000be0  74 6f 5f 72 6f 74 61 74  65 20 2c 20 31 20 29 0d  |to_rotate , 1 ).|
00000bf0  04 06 4a 20 20 79 5f 70  6f 73 69 74 69 6f 6e 5f  |..J  y_position_|
00000c00  6f 66 5f 70 6f 69 6e 74  20 3d 20 61 72 72 61 79  |of_point = array|
00000c10  5f 66 6f 72 5f 74 68 65  5f 33 44 5f 70 6f 69 6e  |_for_the_3D_poin|
00000c20  74 73 28 20 70 6f 69 6e  74 5f 74 6f 5f 72 6f 74  |ts( point_to_rot|
00000c30  61 74 65 20 2c 20 32 20  29 0d 04 10 4a 20 20 7a  |ate , 2 )...J  z|
00000c40  5f 70 6f 73 69 74 69 6f  6e 5f 6f 66 5f 70 6f 69  |_position_of_poi|
00000c50  6e 74 20 3d 20 61 72 72  61 79 5f 66 6f 72 5f 74  |nt = array_for_t|
00000c60  68 65 5f 33 44 5f 70 6f  69 6e 74 73 28 20 70 6f  |he_3D_points( po|
00000c70  69 6e 74 5f 74 6f 5f 72  6f 74 61 74 65 20 2c 20  |int_to_rotate , |
00000c80  33 20 29 0d 04 1a 04 0d  04 24 42 20 20 f4 20 2a  |3 )......$B  . *|
00000c90  2a 2a 20 54 68 69 73 20  70 61 72 74 20 69 73 20  |** This part is |
00000ca0  65 66 66 65 63 74 69 76  65 6c 79 20 74 68 65 20  |effectively the |
00000cb0  6b 69 6e 65 74 69 63 20  66 6f 72 6d 75 6c 61 20  |kinetic formula |
00000cc0  77 68 69 63 68 20 2a 2a  2a 0d 04 2e 42 20 20 f4  |which ***...B  .|
00000cd0  20 2a 2a 2a 20 61 63 74  73 20 6f 6e 20 70 6f 69  | *** acts on poi|
00000ce0  6e 74 73 20 31 2d 34 20  74 6f 20 6d 61 6b 65 20  |nts 1-4 to make |
00000cf0  74 68 65 6d 20 6d 6f 76  65 20 20 20 20 20 20 20  |them move       |
00000d00  20 20 20 20 20 20 20 20  2a 2a 2a 0d 04 38 1e 20  |        ***..8. |
00000d10  20 e7 20 70 6f 69 6e 74  5f 74 6f 5f 72 6f 74 61  | . point_to_rota|
00000d20  74 65 20 3c 3d 20 34 20  8c 0d 04 42 4f 20 20 20  |te <= 4 ...BO   |
00000d30  79 5f 70 6f 73 69 74 69  6f 6e 5f 6f 66 5f 70 6f  |y_position_of_po|
00000d40  69 6e 74 20 3d 20 79 5f  70 6f 73 69 74 69 6f 6e  |int = y_position|
00000d50  5f 6f 66 5f 70 6f 69 6e  74 20 2b 20 79 5f 70 6f  |_of_point + y_po|
00000d60  73 69 74 69 6f 6e 5f 6f  66 5f 70 6f 69 6e 74 20  |sition_of_point |
00000d70  2a 20 b5 28 b2 20 91 29  0d 04 4c 07 20 20 cd 0d  |* .(. .)..L.  ..|
00000d80  04 56 04 0d 04 60 40 20  20 f4 20 2a 2a 2a 20 46  |.V...`@  . *** F|
00000d90  6f 72 6d 75 6c 61 20 66  6f 72 20 72 6f 74 61 74  |ormula for rotat|
00000da0  69 6e 67 20 74 68 65 20  70 6f 69 6e 74 20 61 72  |ing the point ar|
00000db0  6f 75 6e 64 20 74 68 65  20 58 20 61 78 69 73 20  |ound the X axis |
00000dc0  2a 2a 2a 0d 04 6a 69 20  20 72 6f 74 61 74 65 64  |***..ji  rotated|
00000dd0  5f 79 5f 76 61 6c 75 65  20 3d 20 79 5f 70 6f 73  |_y_value = y_pos|
00000de0  69 74 69 6f 6e 5f 6f 66  5f 70 6f 69 6e 74 20 2a  |ition_of_point *|
00000df0  20 9b 28 20 b2 20 58 5f  52 4f 54 41 54 49 4f 4e  | .( . X_ROTATION|
00000e00  20 29 20 2d 20 7a 5f 70  6f 73 69 74 69 6f 6e 5f  | ) - z_position_|
00000e10  6f 66 5f 70 6f 69 6e 74  20 2a 20 b5 28 20 b2 20  |of_point * .( . |
00000e20  58 5f 52 4f 54 41 54 49  4f 4e 20 29 0d 04 74 69  |X_ROTATION )..ti|
00000e30  20 20 72 6f 74 61 74 65  64 5f 7a 5f 76 61 6c 75  |  rotated_z_valu|
00000e40  65 20 3d 20 79 5f 70 6f  73 69 74 69 6f 6e 5f 6f  |e = y_position_o|
00000e50  66 5f 70 6f 69 6e 74 20  2a 20 b5 28 20 b2 20 58  |f_point * .( . X|
00000e60  5f 52 4f 54 41 54 49 4f  4e 20 29 20 2b 20 7a 5f  |_ROTATION ) + z_|
00000e70  70 6f 73 69 74 69 6f 6e  5f 6f 66 5f 70 6f 69 6e  |position_of_poin|
00000e80  74 20 2a 20 9b 28 20 b2  20 58 5f 52 4f 54 41 54  |t * .( . X_ROTAT|
00000e90  49 4f 4e 20 29 0d 04 7e  2b 20 20 79 5f 70 6f 73  |ION )..~+  y_pos|
00000ea0  69 74 69 6f 6e 5f 6f 66  5f 70 6f 69 6e 74 20 3d  |ition_of_point =|
00000eb0  20 72 6f 74 61 74 65 64  5f 79 5f 76 61 6c 75 65  | rotated_y_value|
00000ec0  0d 04 88 2b 20 20 7a 5f  70 6f 73 69 74 69 6f 6e  |...+  z_position|
00000ed0  5f 6f 66 5f 70 6f 69 6e  74 20 3d 20 72 6f 74 61  |_of_point = rota|
00000ee0  74 65 64 5f 7a 5f 76 61  6c 75 65 0d 04 92 04 0d  |ted_z_value.....|
00000ef0  04 9c 40 20 20 f4 20 2a  2a 2a 20 46 6f 72 6d 75  |..@  . *** Formu|
00000f00  6c 61 20 66 6f 72 20 72  6f 74 61 74 69 6e 67 20  |la for rotating |
00000f10  74 68 65 20 70 6f 69 6e  74 20 61 72 6f 75 6e 64  |the point around|
00000f20  20 74 68 65 20 59 20 61  78 69 73 20 2a 2a 2a 0d  | the Y axis ***.|
00000f30  04 a6 69 20 20 72 6f 74  61 74 65 64 5f 78 5f 76  |..i  rotated_x_v|
00000f40  61 6c 75 65 20 3d 20 78  5f 70 6f 73 69 74 69 6f  |alue = x_positio|
00000f50  6e 5f 6f 66 5f 70 6f 69  6e 74 20 2a 20 9b 28 20  |n_of_point * .( |
00000f60  b2 20 59 5f 52 4f 54 41  54 49 4f 4e 20 29 20 2b  |. Y_ROTATION ) +|
00000f70  20 7a 5f 70 6f 73 69 74  69 6f 6e 5f 6f 66 5f 70  | z_position_of_p|
00000f80  6f 69 6e 74 20 2a 20 b5  28 20 b2 20 59 5f 52 4f  |oint * .( . Y_RO|
00000f90  54 41 54 49 4f 4e 20 29  0d 04 b0 69 20 20 72 6f  |TATION )...i  ro|
00000fa0  74 61 74 65 64 5f 7a 5f  76 61 6c 75 65 20 3d 20  |tated_z_value = |
00000fb0  7a 5f 70 6f 73 69 74 69  6f 6e 5f 6f 66 5f 70 6f  |z_position_of_po|
00000fc0  69 6e 74 20 2a 20 9b 28  20 b2 20 59 5f 52 4f 54  |int * .( . Y_ROT|
00000fd0  41 54 49 4f 4e 20 29 20  2d 20 78 5f 70 6f 73 69  |ATION ) - x_posi|
00000fe0  74 69 6f 6e 5f 6f 66 5f  70 6f 69 6e 74 20 2a 20  |tion_of_point * |
00000ff0  b5 28 20 b2 20 59 5f 52  4f 54 41 54 49 4f 4e 20  |.( . Y_ROTATION |
00001000  29 0d 04 ba 2b 20 20 78  5f 70 6f 73 69 74 69 6f  |)...+  x_positio|
00001010  6e 5f 6f 66 5f 70 6f 69  6e 74 20 3d 20 72 6f 74  |n_of_point = rot|
00001020  61 74 65 64 5f 78 5f 76  61 6c 75 65 0d 04 c4 2b  |ated_x_value...+|
00001030  20 20 7a 5f 70 6f 73 69  74 69 6f 6e 5f 6f 66 5f  |  z_position_of_|
00001040  70 6f 69 6e 74 20 3d 20  72 6f 74 61 74 65 64 5f  |point = rotated_|
00001050  7a 5f 76 61 6c 75 65 0d  04 ce 04 0d 04 d8 40 20  |z_value.......@ |
00001060  20 f4 20 2a 2a 2a 20 46  6f 72 6d 75 6c 61 20 66  | . *** Formula f|
00001070  6f 72 20 72 6f 74 61 74  69 6e 67 20 74 68 65 20  |or rotating the |
00001080  70 6f 69 6e 74 20 61 72  6f 75 6e 64 20 74 68 65  |point around the|
00001090  20 5a 20 61 78 69 73 20  2a 2a 2a 0d 04 e2 69 20  | Z axis ***...i |
000010a0  20 72 6f 74 61 74 65 64  5f 78 5f 76 61 6c 75 65  | rotated_x_value|
000010b0  20 3d 20 78 5f 70 6f 73  69 74 69 6f 6e 5f 6f 66  | = x_position_of|
000010c0  5f 70 6f 69 6e 74 20 2a  20 9b 28 20 b2 20 5a 5f  |_point * .( . Z_|
000010d0  52 4f 54 41 54 49 4f 4e  20 29 20 2d 20 79 5f 70  |ROTATION ) - y_p|
000010e0  6f 73 69 74 69 6f 6e 5f  6f 66 5f 70 6f 69 6e 74  |osition_of_point|
000010f0  20 2a 20 b5 28 20 b2 20  5a 5f 52 4f 54 41 54 49  | * .( . Z_ROTATI|
00001100  4f 4e 20 29 0d 04 ec 69  20 20 72 6f 74 61 74 65  |ON )...i  rotate|
00001110  64 5f 79 5f 76 61 6c 75  65 20 3d 20 78 5f 70 6f  |d_y_value = x_po|
00001120  73 69 74 69 6f 6e 5f 6f  66 5f 70 6f 69 6e 74 20  |sition_of_point |
00001130  2a 20 b5 28 20 b2 20 5a  5f 52 4f 54 41 54 49 4f  |* .( . Z_ROTATIO|
00001140  4e 20 29 20 2b 20 79 5f  70 6f 73 69 74 69 6f 6e  |N ) + y_position|
00001150  5f 6f 66 5f 70 6f 69 6e  74 20 2a 20 9b 28 20 b2  |_of_point * .( .|
00001160  20 5a 5f 52 4f 54 41 54  49 4f 4e 20 29 0d 04 f6  | Z_ROTATION )...|
00001170  2b 20 20 78 5f 70 6f 73  69 74 69 6f 6e 5f 6f 66  |+  x_position_of|
00001180  5f 70 6f 69 6e 74 20 3d  20 72 6f 74 61 74 65 64  |_point = rotated|
00001190  5f 78 5f 76 61 6c 75 65  0d 05 00 2b 20 20 79 5f  |_x_value...+  y_|
000011a0  70 6f 73 69 74 69 6f 6e  5f 6f 66 5f 70 6f 69 6e  |position_of_poin|
000011b0  74 20 3d 20 72 6f 74 61  74 65 64 5f 79 5f 76 61  |t = rotated_y_va|
000011c0  6c 75 65 0d 05 0a 04 0d  05 14 41 20 20 f4 20 2a  |lue.......A  . *|
000011d0  2a 2a 20 4e 6f 77 20 77  65 27 76 65 20 72 6f 74  |** Now we've rot|
000011e0  61 74 65 64 20 74 68 65  20 6f 62 6a 65 63 74 20  |ated the object |
000011f0  61 62 6f 75 74 20 69 74  73 65 6c 66 20 77 65 20  |about itself we |
00001200  6d 75 73 74 20 2a 2a 2a  0d 05 1e 41 20 20 f4 20  |must ***...A  . |
00001210  2a 2a 2a 20 70 6f 73 69  74 69 6f 6e 20 69 74 20  |*** position it |
00001220  69 6e 20 73 70 61 63 65  20 72 65 6c 61 74 69 76  |in space relativ|
00001230  65 20 74 6f 20 77 68 65  72 65 20 57 45 20 61 72  |e to where WE ar|
00001240  65 20 20 20 20 20 2a 2a  2a 0d 05 28 3c 20 20 78  |e     ***..(<  x|
00001250  5f 70 6f 73 69 74 69 6f  6e 5f 6f 66 5f 70 6f 69  |_position_of_poi|
00001260  6e 74 20 3d 20 78 5f 70  6f 73 69 74 69 6f 6e 5f  |nt = x_position_|
00001270  6f 66 5f 70 6f 69 6e 74  20 2b 20 58 5f 50 4f 53  |of_point + X_POS|
00001280  49 54 49 4f 4e 0d 05 32  3c 20 20 79 5f 70 6f 73  |ITION..2<  y_pos|
00001290  69 74 69 6f 6e 5f 6f 66  5f 70 6f 69 6e 74 20 3d  |ition_of_point =|
000012a0  20 79 5f 70 6f 73 69 74  69 6f 6e 5f 6f 66 5f 70  | y_position_of_p|
000012b0  6f 69 6e 74 20 2b 20 59  5f 50 4f 53 49 54 49 4f  |oint + Y_POSITIO|
000012c0  4e 0d 05 3c 3c 20 20 7a  5f 70 6f 73 69 74 69 6f  |N..<<  z_positio|
000012d0  6e 5f 6f 66 5f 70 6f 69  6e 74 20 3d 20 7a 5f 70  |n_of_point = z_p|
000012e0  6f 73 69 74 69 6f 6e 5f  6f 66 5f 70 6f 69 6e 74  |osition_of_point|
000012f0  20 2b 20 5a 5f 50 4f 53  49 54 49 4f 4e 0d 05 46  | + Z_POSITION..F|
00001300  04 0d 05 50 49 20 20 f4  20 2a 2a 2a 20 43 6f 6e  |...PI  . *** Con|
00001310  76 65 72 74 20 66 72 6f  6d 20 74 68 65 20 72 6f  |vert from the ro|
00001320  74 61 74 65 64 20 33 44  20 70 6f 73 69 74 69 6f  |tated 3D positio|
00001330  6e 20 69 6e 74 6f 20 74  68 65 20 72 65 6c 65 76  |n into the relev|
00001340  61 6e 74 20 20 20 20 2a  2a 2a 0d 05 5a 49 20 20  |ant    ***..ZI  |
00001350  f4 20 2a 2a 2a 20 32 44  20 70 6f 73 69 74 69 6f  |. *** 2D positio|
00001360  6e 2e 20 44 6f 6e 27 74  20 66 6f 72 67 65 74 20  |n. Don't forget |
00001370  74 68 61 74 20 74 68 69  73 20 69 6e 76 6f 6c 76  |that this involv|
00001380  65 73 20 64 69 76 69 64  69 6e 67 20 20 20 20 20  |es dividing     |
00001390  2a 2a 2a 0d 05 64 49 20  20 f4 20 2a 2a 2a 20 58  |***..dI  . *** X|
000013a0  20 61 6e 64 20 59 20 62  79 20 5a 2c 20 61 6e 64  | and Y by Z, and|
000013b0  20 61 70 6c 6c 79 69 6e  67 20 61 20 70 65 72 73  | apllying a pers|
000013c0  70 65 63 74 69 76 65 20  66 61 63 74 6f 72 20 28  |pective factor (|
000013d0  65 67 2e 20 38 30 30 29  20 2a 2a 2a 0d 05 6e 6a  |eg. 800) ***..nj|
000013e0  20 20 61 72 72 61 79 5f  66 6f 72 5f 74 68 65 5f  |  array_for_the_|
000013f0  32 44 5f 70 6f 69 6e 74  73 28 20 70 6f 69 6e 74  |2D_points( point|
00001400  5f 74 6f 5f 72 6f 74 61  74 65 20 2c 20 31 20 29  |_to_rotate , 1 )|
00001410  20 3d 20 28 20 38 30 30  20 2a 20 78 5f 70 6f 73  | = ( 800 * x_pos|
00001420  69 74 69 6f 6e 5f 6f 66  5f 70 6f 69 6e 74 20 29  |ition_of_point )|
00001430  20 2f 20 7a 5f 70 6f 73  69 74 69 6f 6e 5f 6f 66  | / z_position_of|
00001440  5f 70 6f 69 6e 74 0d 05  78 6a 20 20 61 72 72 61  |_point..xj  arra|
00001450  79 5f 66 6f 72 5f 74 68  65 5f 32 44 5f 70 6f 69  |y_for_the_2D_poi|
00001460  6e 74 73 28 20 70 6f 69  6e 74 5f 74 6f 5f 72 6f  |nts( point_to_ro|
00001470  74 61 74 65 20 2c 20 32  20 29 20 3d 20 28 20 38  |tate , 2 ) = ( 8|
00001480  30 30 20 2a 20 79 5f 70  6f 73 69 74 69 6f 6e 5f  |00 * y_position_|
00001490  6f 66 5f 70 6f 69 6e 74  20 29 20 2f 20 7a 5f 70  |of_point ) / z_p|
000014a0  6f 73 69 74 69 6f 6e 5f  6f 66 5f 70 6f 69 6e 74  |osition_of_point|
000014b0  0d 05 82 04 0d 05 8c 16  20 ed 20 70 6f 69 6e 74  |........ . point|
000014c0  5f 74 6f 5f 72 6f 74 61  74 65 0d 05 96 04 0d 05  |_to_rotate......|
000014d0  a0 05 e1 0d 05 aa 04 0d  05 b4 04 0d 05 be 4e f4  |..............N.|
000014e0  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
000014f0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001520  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 05 c8 44 f4 20 20  |---------...D.  |
00001530  20 20 20 20 54 48 45 20  50 52 4f 43 45 44 55 52  |    THE PROCEDUR|
00001540  45 20 54 48 41 54 20 44  52 41 57 53 20 54 48 45  |E THAT DRAWS THE|
00001550  20 46 41 43 45 54 53 20  54 48 41 54 20 4d 41 4b  | FACETS THAT MAK|
00001560  45 20 55 50 20 54 48 45  20 43 55 42 45 0d 05 d2  |E UP THE CUBE...|
00001570  4e f4 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |N. -------------|
00001580  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000015b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 05 dc 04 0d  |-----------.....|
000015c0  05 e6 04 0d 05 f0 1a dd  20 f2 65 64 75 72 65 5f  |........ .edure_|
000015d0  44 72 61 77 5f 54 68 65  5f 43 75 62 65 0d 05 fa  |Draw_The_Cube...|
000015e0  04 0d 06 04 15 20 e3 20  66 61 63 65 74 20 3d 20  |..... . facet = |
000015f0  31 20 b8 20 31 34 0d 06  0e 04 0d 06 18 39 20 20  |1 . 14.......9  |
00001600  20 20 20 70 6f 69 6e 74  5f 31 20 20 20 20 20 20  |   point_1      |
00001610  3d 20 61 72 72 61 79 5f  66 6f 72 5f 74 68 65 5f  |= array_for_the_|
00001620  66 61 63 65 74 73 28 20  66 61 63 65 74 20 2c 20  |facets( facet , |
00001630  31 20 29 0d 06 22 39 20  20 20 20 20 70 6f 69 6e  |1 ).."9     poin|
00001640  74 5f 32 20 20 20 20 20  20 3d 20 61 72 72 61 79  |t_2      = array|
00001650  5f 66 6f 72 5f 74 68 65  5f 66 61 63 65 74 73 28  |_for_the_facets(|
00001660  20 66 61 63 65 74 20 2c  20 32 20 29 0d 06 2c 39  | facet , 2 )..,9|
00001670  20 20 20 20 20 70 6f 69  6e 74 5f 33 20 20 20 20  |     point_3    |
00001680  20 20 3d 20 61 72 72 61  79 5f 66 6f 72 5f 74 68  |  = array_for_th|
00001690  65 5f 66 61 63 65 74 73  28 20 66 61 63 65 74 20  |e_facets( facet |
000016a0  2c 20 33 20 29 0d 06 36  39 20 20 20 20 20 66 61  |, 3 )..69     fa|
000016b0  63 65 74 5f 63 6f 6c 6f  75 72 20 3d 20 61 72 72  |cet_colour = arr|
000016c0  61 79 5f 66 6f 72 5f 74  68 65 5f 66 61 63 65 74  |ay_for_the_facet|
000016d0  73 28 20 66 61 63 65 74  20 2c 20 34 20 29 0d 06  |s( facet , 4 )..|
000016e0  40 04 0d 06 4a 44 20 20  20 20 20 66 69 72 73 74  |@...JD     first|
000016f0  5f 78 5f 70 6f 73 69 74  69 6f 6e 20 20 20 3d 20  |_x_position   = |
00001700  61 72 72 61 79 5f 66 6f  72 5f 74 68 65 5f 32 44  |array_for_the_2D|
00001710  5f 70 6f 69 6e 74 73 28  20 70 6f 69 6e 74 5f 31  |_points( point_1|
00001720  20 2c 20 31 20 29 0d 06  54 44 20 20 20 20 20 66  | , 1 )..TD     f|
00001730  69 72 73 74 5f 79 5f 70  6f 73 69 74 69 6f 6e 20  |irst_y_position |
00001740  20 20 3d 20 61 72 72 61  79 5f 66 6f 72 5f 74 68  |  = array_for_th|
00001750  65 5f 32 44 5f 70 6f 69  6e 74 73 28 20 70 6f 69  |e_2D_points( poi|
00001760  6e 74 5f 31 20 2c 20 32  20 29 0d 06 5e 04 0d 06  |nt_1 , 2 )..^...|
00001770  68 44 20 20 20 20 20 73  65 63 6f 6e 64 5f 78 5f  |hD     second_x_|
00001780  70 6f 73 69 74 69 6f 6e  20 20 3d 20 61 72 72 61  |position  = arra|
00001790  79 5f 66 6f 72 5f 74 68  65 5f 32 44 5f 70 6f 69  |y_for_the_2D_poi|
000017a0  6e 74 73 28 20 70 6f 69  6e 74 5f 32 20 2c 20 31  |nts( point_2 , 1|
000017b0  20 29 0d 06 72 44 20 20  20 20 20 73 65 63 6f 6e  | )..rD     secon|
000017c0  64 5f 79 5f 70 6f 73 69  74 69 6f 6e 20 20 3d 20  |d_y_position  = |
000017d0  61 72 72 61 79 5f 66 6f  72 5f 74 68 65 5f 32 44  |array_for_the_2D|
000017e0  5f 70 6f 69 6e 74 73 28  20 70 6f 69 6e 74 5f 32  |_points( point_2|
000017f0  20 2c 20 32 20 29 0d 06  7c 04 0d 06 86 44 20 20  | , 2 )..|....D  |
00001800  20 20 20 74 68 69 72 64  5f 78 5f 70 6f 73 69 74  |   third_x_posit|
00001810  69 6f 6e 20 20 20 3d 20  61 72 72 61 79 5f 66 6f  |ion   = array_fo|
00001820  72 5f 74 68 65 5f 32 44  5f 70 6f 69 6e 74 73 28  |r_the_2D_points(|
00001830  20 70 6f 69 6e 74 5f 33  20 2c 20 31 20 29 0d 06  | point_3 , 1 )..|
00001840  90 44 20 20 20 20 20 74  68 69 72 64 5f 79 5f 70  |.D     third_y_p|
00001850  6f 73 69 74 69 6f 6e 20  20 20 3d 20 61 72 72 61  |osition   = arra|
00001860  79 5f 66 6f 72 5f 74 68  65 5f 32 44 5f 70 6f 69  |y_for_the_2D_poi|
00001870  6e 74 73 28 20 70 6f 69  6e 74 5f 33 20 2c 20 32  |nts( point_3 , 2|
00001880  20 29 0d 06 9a 04 0d 06  a4 46 20 20 20 20 20 f4  | ).......F     .|
00001890  20 2a 2a 2a 20 54 68 65  20 66 6f 6c 6c 6f 77 69  | *** The followi|
000018a0  6e 67 20 6c 69 6e 65 73  20 69 6d 70 6c 65 6d 65  |ng lines impleme|
000018b0  6e 74 20 74 68 65 20 61  6c 67 6f 72 69 74 68 6d  |nt the algorithm|
000018c0  20 66 6f 72 20 20 20 20  20 2a 2a 2a 0d 06 ae 46  | for     ***...F|
000018d0  20 20 20 20 20 f4 20 2a  2a 2a 20 64 65 74 65 72  |     . *** deter|
000018e0  6d 69 6e 69 6e 67 20 77  68 65 74 68 65 72 20 6f  |mining whether o|
000018f0  72 20 6e 6f 74 20 74 68  65 20 66 61 63 65 74 20  |r not the facet |
00001900  69 73 20 63 75 72 72 65  6e 74 6c 79 20 20 20 2a  |is currently   *|
00001910  2a 2a 0d 06 b8 46 20 20  20 20 20 f4 20 2a 2a 2a  |**...F     . ***|
00001920  20 76 69 73 69 62 6c 65  2e 20 49 74 27 73 20 65  | visible. It's e|
00001930  61 73 79 20 74 6f 20 72  65 61 64 2c 20 61 6e 64  |asy to read, and|
00001940  20 73 6f 6d 65 20 75 73  65 72 73 20 6d 61 79 20  | some users may |
00001950  20 20 20 20 20 2a 2a 2a  0d 06 c2 46 20 20 20 20  |     ***...F    |
00001960  20 f4 20 2a 2a 2a 20 65  76 65 6e 68 20 6c 69 6b  | . *** evenh lik|
00001970  65 20 74 6f 20 64 69 73  63 6f 76 65 72 20 68 6f  |e to discover ho|
00001980  77 20 69 74 20 77 6f 72  6b 73 20 69 6e 20 6d 6f  |w it works in mo|
00001990  72 65 20 64 65 74 61 69  6c 2e 20 2a 2a 2a 0d 06  |re detail. ***..|
000019a0  cc 46 20 20 20 20 20 f4  20 2a 2a 2a 20 4f 74 68  |.F     . *** Oth|
000019b0  65 72 73 20 61 72 65 20  77 65 6c 63 6f 6d 65 20  |ers are welcome |
000019c0  74 6f 20 65 78 74 72 61  63 74 20 61 6e 79 20 70  |to extract any p|
000019d0  61 72 74 20 6f 66 20 74  68 69 73 20 20 20 20 20  |art of this     |
000019e0  20 2a 2a 2a 0d 06 d6 46  20 20 20 20 20 f4 20 2a  | ***...F     . *|
000019f0  2a 2a 20 70 72 6f 67 72  61 6d 20 66 6f 72 20 74  |** program for t|
00001a00  68 65 69 72 20 6f 77 6e  20 61 64 76 61 6e 74 61  |heir own advanta|
00001a10  67 65 21 20 20 20 20 20  20 20 20 20 20 20 20 20  |ge!             |
00001a20  20 20 20 20 20 20 20 2a  2a 2a 0d 06 e0 04 0d 06  |       ***......|
00001a30  ea 32 20 20 20 20 20 72  30 20 3d 20 73 65 63 6f  |.2     r0 = seco|
00001a40  6e 64 5f 78 5f 70 6f 73  69 74 69 6f 6e 20 2d 20  |nd_x_position - |
00001a50  66 69 72 73 74 5f 78 5f  70 6f 73 69 74 69 6f 6e  |first_x_position|
00001a60  0d 06 f4 41 20 20 20 20  20 72 31 20 3d 20 74 68  |...A     r1 = th|
00001a70  69 72 64 5f 79 5f 70 6f  73 69 74 69 6f 6e 20 20  |ird_y_position  |
00001a80  2d 20 66 69 72 73 74 5f  79 5f 70 6f 73 69 74 69  |- first_y_positi|
00001a90  6f 6e 20 3a 20 72 32 20  3d 20 72 30 20 2a 20 72  |on : r2 = r0 * r|
00001aa0  31 0d 06 fe 04 0d 07 08  32 20 20 20 20 20 72 30  |1.......2     r0|
00001ab0  20 3d 20 74 68 69 72 64  5f 78 5f 70 6f 73 69 74  | = third_x_posit|
00001ac0  69 6f 6e 20 20 2d 20 66  69 72 73 74 5f 78 5f 70  |ion  - first_x_p|
00001ad0  6f 73 69 74 69 6f 6e 0d  07 12 41 20 20 20 20 20  |osition...A     |
00001ae0  72 31 20 3d 20 73 65 63  6f 6e 64 5f 79 5f 70 6f  |r1 = second_y_po|
00001af0  73 69 74 69 6f 6e 20 2d  20 66 69 72 73 74 5f 79  |sition - first_y|
00001b00  5f 70 6f 73 69 74 69 6f  6e 20 3a 20 72 33 20 3d  |_position : r3 =|
00001b10  20 72 30 20 2a 20 72 31  0d 07 1c 04 0d 07 26 18  | r0 * r1......&.|
00001b20  20 20 20 20 20 e7 20 72  32 20 2d 20 72 33 20 3e  |     . r2 - r3 >|
00001b30  20 30 20 8c 0d 07 30 1c  20 20 20 20 20 20 e6 20  | 0 ...0.      . |
00001b40  30 20 2c 20 66 61 63 65  74 5f 63 6f 6c 6f 75 72  |0 , facet_colour|
00001b50  0d 07 3a 35 20 20 20 20  20 20 ec 20 20 20 20 20  |..:5      .     |
00001b60  20 66 69 72 73 74 5f 78  5f 70 6f 73 69 74 69 6f  | first_x_positio|
00001b70  6e 20 20 2c 20 66 69 72  73 74 5f 79 5f 70 6f 73  |n  , first_y_pos|
00001b80  69 74 69 6f 6e 0d 07 44  36 20 20 20 20 20 20 df  |ition..D6      .|
00001b90  20 20 20 20 20 20 73 65  63 6f 6e 64 5f 78 5f 70  |      second_x_p|
00001ba0  6f 73 69 74 69 6f 6e 20  2c 20 73 65 63 6f 6e 64  |osition , second|
00001bb0  5f 79 5f 70 6f 73 69 74  69 6f 6e 0d 07 4e 35 20  |_y_position..N5 |
00001bc0  20 20 20 20 20 f0 20 38  35 20 2c 20 74 68 69 72  |     . 85 , thir|
00001bd0  64 5f 78 5f 70 6f 73 69  74 69 6f 6e 20 20 2c 20  |d_x_position  , |
00001be0  74 68 69 72 64 5f 79 5f  70 6f 73 69 74 69 6f 6e  |third_y_position|
00001bf0  0d 07 58 0a 20 20 20 20  20 cd 0d 07 62 04 0d 07  |..X.     ...b...|
00001c00  6c 0c 20 ed 20 66 61 63  65 74 0d 07 76 04 0d 07  |l. . facet..v...|
00001c10  80 05 e1 0d 07 8a 04 0d  07 94 04 0d 07 9e 4e f4  |..............N.|
00001c20  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  | ---------------|
00001c30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001c60  2d 2d 2d 2d 2d 2d 2d 2d  2d 0d 07 a8 48 f4 20 20  |---------...H.  |
00001c70  50 52 4f 43 45 44 55 52  45 20 54 4f 20 53 57 41  |PROCEDURE TO SWA|
00001c80  50 20 4f 55 52 20 53 43  52 45 45 4e 53 2c 20 4b  |P OUR SCREENS, K|
00001c90  45 45 50 49 4e 47 20 54  48 45 20 41 4e 49 4d 41  |EEPING THE ANIMA|
00001ca0  54 49 4f 4e 20 46 4c 49  43 4b 45 52 20 46 52 45  |TION FLICKER FRE|
00001cb0  45 0d 07 b2 4e f4 20 2d  2d 2d 2d 2d 2d 2d 2d 2d  |E...N. ---------|
00001cc0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001cf0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 0d  |---------------.|
00001d00  07 bc 04 0d 07 c6 04 0d  07 d0 22 dd 20 f2 65 64  |..........". .ed|
00001d10  75 72 65 5f 53 77 61 70  5f 54 68 65 5f 53 63 72  |ure_Swap_The_Scr|
00001d20  65 65 6e 5f 42 61 6e 6b  73 0d 07 da 04 0d 07 e4  |een_Banks.......|
00001d30  07 20 c8 96 0d 07 ee 14  20 42 41 4e 4b 20 3d 20  |. ...... BANK = |
00001d40  42 41 4e 4b 20 82 20 33  0d 07 f8 12 20 c8 99 20  |BANK . 3.... .. |
00001d50  36 2c 31 31 32 2c 42 41  4e 4b 0d 08 02 16 20 c8  |6,112,BANK.... .|
00001d60  99 20 36 2c 31 31 33 2c  42 41 4e 4b 20 82 20 33  |. 6,113,BANK . 3|
00001d70  0d 08 0c 06 20 db 0d 08  16 04 0d 08 20 05 e1 0d  |.... ....... ...|
00001d80  08 2a 04 0d 08 34 04 0d  08 3e 4e f4 20 2d 2d 2d  |.*...4...>N. ---|
00001d90  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001dd0  2d 2d 2d 2d 2d 0d 08 48  48 f4 20 20 54 48 45 20  |-----..HH.  THE |
00001de0  50 52 4f 43 45 44 55 52  45 20 54 48 41 54 20 52  |PROCEDURE THAT R|
00001df0  45 41 44 53 20 54 48 45  20 38 20 50 4f 49 4e 54  |EADS THE 8 POINT|
00001e00  53 20 49 4e 54 4f 20 54  48 45 20 41 52 52 41 59  |S INTO THE ARRAY|
00001e10  20 57 45 27 56 45 20 53  45 54 20 55 50 0d 08 52  | WE'VE SET UP..R|
00001e20  4e f4 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |N. -------------|
00001e30  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001e60  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 08 5c 04 0d  |-----------..\..|
00001e70  08 66 04 0d 08 70 29 dd  20 f2 65 64 75 72 65 5f  |.f...p). .edure_|
00001e80  52 65 61 64 5f 50 6f 69  6e 74 73 5f 49 6e 74 6f  |Read_Points_Into|
00001e90  5f 54 68 65 69 72 5f 41  72 72 61 79 0d 08 7a 04  |_Their_Array..z.|
00001ea0  0d 08 84 0b 20 f7 20 8d  54 6e 49 0d 08 8e 04 0d  |.... . .TnI.....|
00001eb0  08 98 15 20 e3 20 70 6f  69 6e 74 20 3d 20 31 20  |... . point = 1 |
00001ec0  b8 20 31 32 0d 08 a2 04  0d 08 ac 2f 20 20 20 20  |. 12......./    |
00001ed0  20 f3 20 58 5f 50 4f 53  49 54 49 4f 4e 20 2c 20  | . X_POSITION , |
00001ee0  59 5f 50 4f 53 49 54 49  4f 4e 20 2c 20 5a 5f 50  |Y_POSITION , Z_P|
00001ef0  4f 53 49 54 49 4f 4e 0d  08 b6 04 0d 08 c0 3a 20  |OSITION.......: |
00001f00  20 20 20 20 61 72 72 61  79 5f 66 6f 72 5f 74 68  |    array_for_th|
00001f10  65 5f 33 44 5f 70 6f 69  6e 74 73 28 20 70 6f 69  |e_3D_points( poi|
00001f20  6e 74 20 2c 20 31 20 29  20 3d 20 58 5f 50 4f 53  |nt , 1 ) = X_POS|
00001f30  49 54 49 4f 4e 0d 08 ca  3a 20 20 20 20 20 61 72  |ITION...:     ar|
00001f40  72 61 79 5f 66 6f 72 5f  74 68 65 5f 33 44 5f 70  |ray_for_the_3D_p|
00001f50  6f 69 6e 74 73 28 20 70  6f 69 6e 74 20 2c 20 32  |oints( point , 2|
00001f60  20 29 20 3d 20 59 5f 50  4f 53 49 54 49 4f 4e 0d  | ) = Y_POSITION.|
00001f70  08 d4 3a 20 20 20 20 20  61 72 72 61 79 5f 66 6f  |..:     array_fo|
00001f80  72 5f 74 68 65 5f 33 44  5f 70 6f 69 6e 74 73 28  |r_the_3D_points(|
00001f90  20 70 6f 69 6e 74 20 2c  20 33 20 29 20 3d 20 5a  | point , 3 ) = Z|
00001fa0  5f 50 4f 53 49 54 49 4f  4e 0d 08 de 04 0d 08 e8  |_POSITION.......|
00001fb0  0c 20 ed 20 70 6f 69 6e  74 0d 08 f2 04 0d 08 fc  |. . point.......|
00001fc0  05 e1 0d 09 06 04 0d 09  10 04 0d 09 1a 33 f4 20  |.............3. |
00001fd0  2a 2a 2a 20 54 68 65 20  64 61 74 61 20 66 6f 72  |*** The data for|
00001fe0  20 74 68 65 20 39 20 70  6f 69 6e 74 73 20 6f 66  | the 9 points of|
00001ff0  20 74 68 65 20 63 75 62  65 20 2a 2a 2a 0d 09 24  | the cube ***..$|
00002000  04 0d 09 2e 42 dc 20 20  20 30 2c 2b 31 30 20 2c  |....B.   0,+10 ,|
00002010  20 20 20 30 20 3a 20 52  45 4d 20 54 68 65 20 34  |   0 : REM The 4|
00002020  20 69 64 65 6e 74 69 63  61 6c 20 70 6f 69 6e 74  | identical point|
00002030  73 20 61 74 20 74 68 65  20 74 6f 70 20 63 65 6e  |s at the top cen|
00002040  74 72 65 0d 09 38 13 dc  20 20 20 30 2c 2b 31 30  |tre..8..   0,+10|
00002050  20 2c 20 20 20 30 0d 09  42 13 dc 20 20 20 30 2c  | ,   0..B..   0,|
00002060  2b 31 30 20 2c 20 20 20  30 0d 09 4c 13 dc 20 20  |+10 ,   0..L..  |
00002070  20 30 2c 2b 31 30 20 2c  20 20 20 30 0d 09 56 04  | 0,+10 ,   0..V.|
00002080  0d 09 60 40 dc 20 2d 31  30 2c 2b 31 30 20 2c 20  |..`@. -10,+10 , |
00002090  2b 31 30 20 3a 20 52 45  4d 20 54 68 65 20 34 20  |+10 : REM The 4 |
000020a0  70 6f 69 6e 74 73 20 66  6f 72 20 74 68 65 20 66  |points for the f|
000020b0  72 6f 6e 74 20 6f 66 20  74 68 65 20 63 75 62 65  |ront of the cube|
000020c0  0d 09 6a 13 dc 20 2b 31  30 2c 2b 31 30 20 2c 20  |..j.. +10,+10 , |
000020d0  2b 31 30 0d 09 74 13 dc  20 2b 31 30 2c 2d 31 30  |+10..t.. +10,-10|
000020e0  20 2c 20 2b 31 30 0d 09  7e 13 dc 20 2d 31 30 2c  | , +10..~.. -10,|
000020f0  2d 31 30 20 2c 20 2b 31  30 0d 09 88 04 0d 09 92  |-10 , +10.......|
00002100  3f dc 20 2d 31 30 2c 2b  31 30 20 2c 20 2d 31 30  |?. -10,+10 , -10|
00002110  20 3a 20 52 45 4d 20 54  68 65 20 34 20 70 6f 69  | : REM The 4 poi|
00002120  6e 74 73 20 66 6f 72 20  74 68 65 20 62 61 63 6b  |nts for the back|
00002130  20 6f 66 20 74 68 65 20  63 75 62 65 0d 09 9c 13  | of the cube....|
00002140  dc 20 2b 31 30 2c 2b 31  30 20 2c 20 2d 31 30 0d  |. +10,+10 , -10.|
00002150  09 a6 13 dc 20 2b 31 30  2c 2d 31 30 20 2c 20 2d  |.... +10,-10 , -|
00002160  31 30 0d 09 b0 13 dc 20  2d 31 30 2c 2d 31 30 20  |10..... -10,-10 |
00002170  2c 20 2d 31 30 0d 09 ba  04 0d 09 c4 04 0d 09 ce  |, -10...........|
00002180  4e f4 20 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |N. -------------|
00002190  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
000021c0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 0d 09 d8 49 f4  |-----------...I.|
000021d0  20 20 54 48 45 20 50 52  4f 43 45 44 55 52 45 20  |  THE PROCEDURE |
000021e0  54 48 41 54 20 52 45 41  44 53 20 54 48 45 20 31  |THAT READS THE 1|
000021f0  32 20 46 41 43 45 54 53  20 49 4e 54 4f 20 54 48  |2 FACETS INTO TH|
00002200  45 20 41 52 52 41 59 20  57 45 27 56 45 20 53 45  |E ARRAY WE'VE SE|
00002210  54 20 55 50 0d 09 e2 4e  f4 20 2d 2d 2d 2d 2d 2d  |T UP...N. ------|
00002220  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00002260  2d 2d 0d 09 ec 04 0d 09  f6 04 0d 0a 00 29 dd 20  |--...........). |
00002270  f2 65 64 75 72 65 5f 52  65 61 64 5f 46 61 63 65  |.edure_Read_Face|
00002280  74 73 5f 49 6e 74 6f 5f  54 68 65 69 72 5f 41 72  |ts_Into_Their_Ar|
00002290  72 61 79 0d 0a 0a 04 0d  0a 14 0b 20 f7 20 8d 64  |ray........ . .d|
000022a0  52 4a 0d 0a 1e 04 0d 0a  28 15 20 e3 20 66 61 63  |RJ......(. . fac|
000022b0  65 74 20 3d 20 31 20 b8  20 31 34 0d 0a 32 04 0d  |et = 1 . 14..2..|
000022c0  0a 3c 32 20 20 20 20 20  f3 20 4a 4f 49 4e 5f 31  |.<2     . JOIN_1|
000022d0  20 2c 20 4a 4f 49 4e 5f  32 20 2c 20 4a 4f 49 4e  | , JOIN_2 , JOIN|
000022e0  5f 33 20 2c 20 46 41 43  45 54 5f 43 4f 4c 4f 55  |_3 , FACET_COLOU|
000022f0  52 0d 0a 46 04 0d 0a 50  33 20 20 20 20 20 61 72  |R..F...P3     ar|
00002300  72 61 79 5f 66 6f 72 5f  74 68 65 5f 66 61 63 65  |ray_for_the_face|
00002310  74 73 28 20 66 61 63 65  74 20 2c 20 31 20 29 20  |ts( facet , 1 ) |
00002320  3d 20 4a 4f 49 4e 5f 31  0d 0a 5a 33 20 20 20 20  |= JOIN_1..Z3    |
00002330  20 61 72 72 61 79 5f 66  6f 72 5f 74 68 65 5f 66  | array_for_the_f|
00002340  61 63 65 74 73 28 20 66  61 63 65 74 20 2c 20 32  |acets( facet , 2|
00002350  20 29 20 3d 20 4a 4f 49  4e 5f 32 0d 0a 64 33 20  | ) = JOIN_2..d3 |
00002360  20 20 20 20 61 72 72 61  79 5f 66 6f 72 5f 74 68  |    array_for_th|
00002370  65 5f 66 61 63 65 74 73  28 20 66 61 63 65 74 20  |e_facets( facet |
00002380  2c 20 33 20 29 20 3d 20  4a 4f 49 4e 5f 33 0d 0a  |, 3 ) = JOIN_3..|
00002390  6e 39 20 20 20 20 20 61  72 72 61 79 5f 66 6f 72  |n9     array_for|
000023a0  5f 74 68 65 5f 66 61 63  65 74 73 28 20 66 61 63  |_the_facets( fac|
000023b0  65 74 20 2c 20 34 20 29  20 3d 20 46 41 43 45 54  |et , 4 ) = FACET|
000023c0  5f 43 4f 4c 4f 55 52 0d  0a 78 04 0d 0a 82 0c 20  |_COLOUR..x..... |
000023d0  ed 20 66 61 63 65 74 0d  0a 8c 04 0d 0a 96 05 e1  |. facet.........|
000023e0  0d 0a a0 04 0d 0a aa 04  0d 0a b4 3c f4 20 2a 2a  |...........<. **|
000023f0  2a 20 54 68 65 20 64 61  74 61 20 66 6f 72 20 74  |* The data for t|
00002400  68 65 20 31 32 20 66 61  63 65 74 73 20 74 6f 20  |he 12 facets to |
00002410  6d 61 6b 65 20 75 70 20  74 68 65 20 63 75 62 65  |make up the cube|
00002420  20 2a 2a 2a 0d 0a be 04  0d 0a c8 04 0d 0a d2 3b  | ***...........;|
00002430  dc 20 20 39 20 2c 20 20  31 20 2c 20 20 35 20 2c  |.  9 ,  1 ,  5 ,|
00002440  20 20 33 20 3a 20 52 45  4d 20 54 68 65 20 66 6f  |  3 : REM The fo|
00002450  75 72 20 74 6f 70 20 70  69 65 63 65 73 20 74 68  |ur top pieces th|
00002460  61 74 20 6d 6f 76 65 0d  0a dc 17 dc 20 20 39 20  |at move.....  9 |
00002470  2c 20 31 30 20 2c 20 20  32 20 2c 20 20 35 0d 0a  |, 10 ,  2 ,  5..|
00002480  e6 17 dc 20 20 36 20 2c  20 20 33 20 2c 20 31 30  |...  6 ,  3 , 10|
00002490  20 2c 20 20 38 0d 0a f0  17 dc 20 20 35 20 2c 20  | ,  8.....  5 , |
000024a0  20 34 20 2c 20 20 36 20  2c 20 31 31 0d 0a fa 04  | 4 ,  6 , 11....|
000024b0  0d 0b 04 41 dc 20 20 35  20 2c 20 20 36 20 2c 20  |...A.  5 ,  6 , |
000024c0  20 37 20 2c 20 20 31 20  3a 20 52 45 4d 20 54 68  | 7 ,  1 : REM Th|
000024d0  65 20 6c 69 6e 6b 73 20  74 6f 20 6a 6f 69 6e 20  |e links to join |
000024e0  75 70 20 74 68 65 20 66  72 6f 6e 74 20 66 61 63  |up the front fac|
000024f0  65 0d 0b 0e 17 dc 20 20  35 20 2c 20 20 37 20 2c  |e.....  5 ,  7 ,|
00002500  20 20 38 20 2c 20 20 31  0d 0b 18 04 0d 0b 22 40  |  8 ,  1......"@|
00002510  dc 20 31 30 20 2c 20 20  39 20 2c 20 31 31 20 2c  |. 10 ,  9 , 11 ,|
00002520  20 20 33 20 3a 20 52 45  4d 20 54 68 65 20 6c 69  |  3 : REM The li|
00002530  6e 6b 73 20 74 6f 20 6a  6f 69 6e 20 75 70 20 74  |nks to join up t|
00002540  68 65 20 62 61 63 6b 20  66 61 63 65 0d 0b 2c 17  |he back face..,.|
00002550  dc 20 20 39 20 2c 20 31  32 20 2c 20 31 31 20 2c  |.  9 , 12 , 11 ,|
00002560  20 20 33 0d 0b 36 04 0d  0b 40 3f dc 20 20 36 20  |  3..6...@?.  6 |
00002570  2c 20 31 30 20 2c 20 31  31 20 2c 20 20 35 20 3a  |, 10 , 11 ,  5 :|
00002580  20 52 45 4d 20 54 68 65  20 6c 69 6e 6b 73 20 74  | REM The links t|
00002590  6f 20 6a 6f 69 6e 20 75  70 20 74 68 65 20 52 48  |o join up the RH|
000025a0  53 20 66 61 63 65 0d 0b  4a 17 dc 20 20 36 20 2c  |S face..J..  6 ,|
000025b0  20 31 31 20 2c 20 20 37  20 2c 20 20 35 0d 0b 54  | 11 ,  7 ,  5..T|
000025c0  04 0d 0b 5e 3f dc 20 20  39 20 2c 20 20 35 20 2c  |...^?.  9 ,  5 ,|
000025d0  20 20 38 20 2c 20 20 37  20 3a 20 52 45 4d 20 54  |  8 ,  7 : REM T|
000025e0  68 65 20 6c 69 6e 6b 73  20 74 6f 20 6a 6f 69 6e  |he links to join|
000025f0  20 75 70 20 74 68 65 20  4c 48 53 20 66 61 63 65  | up the LHS face|
00002600  0d 0b 68 17 dc 20 20 39  20 2c 20 20 38 20 2c 20  |..h..  9 ,  8 , |
00002610  31 32 20 2c 20 20 37 0d  0b 72 04 0d 0b 7c 42 dc  |12 ,  7..r...|B.|
00002620  20 20 38 20 2c 20 20 37  20 2c 20 31 32 20 2c 20  |  8 ,  7 , 12 , |
00002630  31 31 20 3a 20 52 45 4d  20 54 68 65 20 6c 69 6e  |11 : REM The lin|
00002640  6b 73 20 74 6f 20 6a 6f  69 6e 20 75 70 20 74 68  |ks to join up th|
00002650  65 20 62 6f 74 74 6f 6d  20 66 61 63 65 0d 0b 86  |e bottom face...|
00002660  17 dc 20 20 37 20 2c 20  31 31 20 2c 20 31 32 20  |..  7 , 11 , 12 |
00002670  2c 20 31 31 0d ff                                 |, 11..|
00002676