Home » Archimedes archive » Archimedes World » AW-1994-01.adf » AWJan94 » !AWJan94/Goodies/Disc/Example_3/Rotate

!AWJan94/Goodies/Disc/Example_3/Rotate

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-01.adf » AWJan94
Filename: !AWJan94/Goodies/Disc/Example_3/Rotate
Read OK:
File size: 0535 bytes
Load address: 0000
Exec address: 0000
File contents
    1PROCList
    2LIBRARY "PathLib:OS_units.Paths"
    3LIBRARY "PathLib:OS_units.Transforms"
    4ORIGIN 640,512
    5square%=FNPath_CreateSquare(0,0,400)
    6PROCCreateTransform
    7PROCDrawObjects
    8END
    9
   10DEF PROCCreateTransform
   11 INPUT '"Number of rotations";n%
   12 PROCPath_CreateTransform(rotate%)
   13 PROCPath_Rotation(rotate%,PI/(2*n%))
   14ENDPROC
   15
   16DEF PROCDrawObjects  
   17 col%=0
   18 REPEAT
   19  FOR i%=1 TO n%
   20   SYS "Draw_Fill",square%
   21   PROCPath_Transform(square%,rotate%)
   22   x$=GET$
   23  NEXT
   24  col%+=1 : GCOL 1+col% MOD 6
   25  UNTIL FALSE      
   26ENDPROC
   27
   28DEF PROCList
   29MODE MODE
   30COLOUR 2
   31PRINT "EXAMPLE 3: ROTATING A SQUARE" : PRINT
   32DATA LIBRARY "PathLib:OS_units.Paths"
   33DATA LIBRARY "PathLib:OS_units.Transforms"
   34DATA "ORIGIN 640,512"
   35DATA "square%=FNPath_CreateSquare(0,0,400)"
   36DATA "PROCCreateTransform"
   37DATA "PROCDrawObjects"
   38DATA "END"
   39DATA ""
   40DATA "DEF PROCCreateTransform"
   41DATA " INPUT "Number of rotations?";n%"
   42DATA " PROCPath_CreateTransform(rotate%)"
   43DATA " PROCPath_Rotation(rotate%,PI/(2*n%))"
   44DATA "ENDPROC"
   45DATA ""
   46DATA "DEF PROCDrawObjects"  
   47DATA " col%=0"
   48DATA " REPEAT"
   49DATA "  FOR i%=1 TO n%"
   50DATA "   SYS ""Draw_Fill"",square%"
   51DATA "   PROCPath_Transform(square%,rotate%)"
   52DATA "   x$=GET$"
   53DATA "  NEXT"
   54DATA "  col%+=1 : GCOL 1+col% MOD 6"
   55DATA "  UNTIL FALSE"
   56DATA "ENDPROC"
   57COLOUR 1
   58FOR i%=1 TO  25 : READ x$ : PRINT x$ :NEXT
   59COLOUR 7
   60PRINT '"Press space bar! (ESC to finish)."
   61ENDPROC
   62
	�List
ț "PathLib:OS_units.Paths"
$ț "PathLib:OS_units.Transforms"
ȑ 640,512
'square%=�Path_CreateSquare(0,0,400)
�CreateTransform
�DrawObjects
�
	

� �CreateTransform
  � '"Number of rotations";n%
# �Path_CreateTransform(rotate%)

% �Path_Rotation(rotate%,�/(2*n%))
�

� �DrawObjects  
 col%=0
 �
  � i%=1 � n%
   ș "Draw_Fill",square%
'   �Path_Transform(square%,rotate%)
   x$=�
  �
  col%+=1 : � 1+col% � 6
  � �      
�

� �List
� �
� 2
(� "EXAMPLE 3: ROTATING A SQUARE" : �
 &� LIBRARY "PathLib:OS_units.Paths"
!+� LIBRARY "PathLib:OS_units.Transforms"
"� "ORIGIN 640,512"
#,� "square%=FNPath_CreateSquare(0,0,400)"
$� "PROCCreateTransform"
%� "PROCDrawObjects"
&� "END"
'� ""
(� "DEF PROCCreateTransform"
)(� " INPUT "Number of rotations?";n%"
**� " PROCPath_CreateTransform(rotate%)"
+-� " PROCPath_Rotation(rotate%,PI/(2*n%))"
,� "ENDPROC"
-� ""
.� "DEF PROCDrawObjects"  
/� " col%=0"
0� " REPEAT"
1� "  FOR i%=1 TO n%"
2$� "   SYS ""Draw_Fill"",square%"
3.� "   PROCPath_Transform(square%,rotate%)"
4� "   x$=GET$"
5� "  NEXT"
6%� "  col%+=1 : GCOL 1+col% MOD 6"
7� "  UNTIL FALSE"
8� "ENDPROC"
9� 1
:!� i%=1 �  25 : � x$ : � x$ :�
;� 7
<*� '"Press space bar! (ESC to finish)."
=�
>
�
00000000  0d 00 01 09 f2 4c 69 73  74 0d 00 02 1f c8 9b 20  |.....List...... |
00000010  22 50 61 74 68 4c 69 62  3a 4f 53 5f 75 6e 69 74  |"PathLib:OS_unit|
00000020  73 2e 50 61 74 68 73 22  0d 00 03 24 c8 9b 20 22  |s.Paths"...$.. "|
00000030  50 61 74 68 4c 69 62 3a  4f 53 5f 75 6e 69 74 73  |PathLib:OS_units|
00000040  2e 54 72 61 6e 73 66 6f  72 6d 73 22 0d 00 04 0e  |.Transforms"....|
00000050  c8 91 20 36 34 30 2c 35  31 32 0d 00 05 27 73 71  |.. 640,512...'sq|
00000060  75 61 72 65 25 3d a4 50  61 74 68 5f 43 72 65 61  |uare%=.Path_Crea|
00000070  74 65 53 71 75 61 72 65  28 30 2c 30 2c 34 30 30  |teSquare(0,0,400|
00000080  29 0d 00 06 14 f2 43 72  65 61 74 65 54 72 61 6e  |).....CreateTran|
00000090  73 66 6f 72 6d 0d 00 07  10 f2 44 72 61 77 4f 62  |sform.....DrawOb|
000000a0  6a 65 63 74 73 0d 00 08  05 e0 0d 00 09 04 0d 00  |jects...........|
000000b0  0a 16 dd 20 f2 43 72 65  61 74 65 54 72 61 6e 73  |... .CreateTrans|
000000c0  66 6f 72 6d 0d 00 0b 20  20 e8 20 27 22 4e 75 6d  |form...  . '"Num|
000000d0  62 65 72 20 6f 66 20 72  6f 74 61 74 69 6f 6e 73  |ber of rotations|
000000e0  22 3b 6e 25 0d 00 0c 23  20 f2 50 61 74 68 5f 43  |";n%...# .Path_C|
000000f0  72 65 61 74 65 54 72 61  6e 73 66 6f 72 6d 28 72  |reateTransform(r|
00000100  6f 74 61 74 65 25 29 0d  00 0d 25 20 f2 50 61 74  |otate%)...% .Pat|
00000110  68 5f 52 6f 74 61 74 69  6f 6e 28 72 6f 74 61 74  |h_Rotation(rotat|
00000120  65 25 2c af 2f 28 32 2a  6e 25 29 29 0d 00 0e 05  |e%,./(2*n%))....|
00000130  e1 0d 00 0f 04 0d 00 10  14 dd 20 f2 44 72 61 77  |.......... .Draw|
00000140  4f 62 6a 65 63 74 73 20  20 0d 00 11 0b 20 63 6f  |Objects  .... co|
00000150  6c 25 3d 30 0d 00 12 06  20 f5 0d 00 13 11 20 20  |l%=0.... .....  |
00000160  e3 20 69 25 3d 31 20 b8  20 6e 25 0d 00 14 1d 20  |. i%=1 . n%.... |
00000170  20 20 c8 99 20 22 44 72  61 77 5f 46 69 6c 6c 22  |  .. "Draw_Fill"|
00000180  2c 73 71 75 61 72 65 25  0d 00 15 27 20 20 20 f2  |,square%...'   .|
00000190  50 61 74 68 5f 54 72 61  6e 73 66 6f 72 6d 28 73  |Path_Transform(s|
000001a0  71 75 61 72 65 25 2c 72  6f 74 61 74 65 25 29 0d  |quare%,rotate%).|
000001b0  00 16 0b 20 20 20 78 24  3d be 0d 00 17 07 20 20  |...   x$=.....  |
000001c0  ed 0d 00 18 1c 20 20 63  6f 6c 25 2b 3d 31 20 3a  |.....  col%+=1 :|
000001d0  20 e6 20 31 2b 63 6f 6c  25 20 83 20 36 0d 00 19  | . 1+col% . 6...|
000001e0  0f 20 20 fd 20 a3 20 20  20 20 20 20 0d 00 1a 05  |.  . .      ....|
000001f0  e1 0d 00 1b 04 0d 00 1c  0b dd 20 f2 4c 69 73 74  |.......... .List|
00000200  0d 00 1d 07 eb 20 eb 0d  00 1e 07 fb 20 32 0d 00  |..... ...... 2..|
00000210  1f 28 f1 20 22 45 58 41  4d 50 4c 45 20 33 3a 20  |.(. "EXAMPLE 3: |
00000220  52 4f 54 41 54 49 4e 47  20 41 20 53 51 55 41 52  |ROTATING A SQUAR|
00000230  45 22 20 3a 20 f1 0d 00  20 26 dc 20 4c 49 42 52  |E" : ... &. LIBR|
00000240  41 52 59 20 22 50 61 74  68 4c 69 62 3a 4f 53 5f  |ARY "PathLib:OS_|
00000250  75 6e 69 74 73 2e 50 61  74 68 73 22 0d 00 21 2b  |units.Paths"..!+|
00000260  dc 20 4c 49 42 52 41 52  59 20 22 50 61 74 68 4c  |. LIBRARY "PathL|
00000270  69 62 3a 4f 53 5f 75 6e  69 74 73 2e 54 72 61 6e  |ib:OS_units.Tran|
00000280  73 66 6f 72 6d 73 22 0d  00 22 16 dc 20 22 4f 52  |sforms"..".. "OR|
00000290  49 47 49 4e 20 36 34 30  2c 35 31 32 22 0d 00 23  |IGIN 640,512"..#|
000002a0  2c dc 20 22 73 71 75 61  72 65 25 3d 46 4e 50 61  |,. "square%=FNPa|
000002b0  74 68 5f 43 72 65 61 74  65 53 71 75 61 72 65 28  |th_CreateSquare(|
000002c0  30 2c 30 2c 34 30 30 29  22 0d 00 24 1b dc 20 22  |0,0,400)"..$.. "|
000002d0  50 52 4f 43 43 72 65 61  74 65 54 72 61 6e 73 66  |PROCCreateTransf|
000002e0  6f 72 6d 22 0d 00 25 17  dc 20 22 50 52 4f 43 44  |orm"..%.. "PROCD|
000002f0  72 61 77 4f 62 6a 65 63  74 73 22 0d 00 26 0b dc  |rawObjects"..&..|
00000300  20 22 45 4e 44 22 0d 00  27 08 dc 20 22 22 0d 00  | "END"..'.. ""..|
00000310  28 1f dc 20 22 44 45 46  20 50 52 4f 43 43 72 65  |(.. "DEF PROCCre|
00000320  61 74 65 54 72 61 6e 73  66 6f 72 6d 22 0d 00 29  |ateTransform"..)|
00000330  28 dc 20 22 20 49 4e 50  55 54 20 22 4e 75 6d 62  |(. " INPUT "Numb|
00000340  65 72 20 6f 66 20 72 6f  74 61 74 69 6f 6e 73 3f  |er of rotations?|
00000350  22 3b 6e 25 22 0d 00 2a  2a dc 20 22 20 50 52 4f  |";n%"..**. " PRO|
00000360  43 50 61 74 68 5f 43 72  65 61 74 65 54 72 61 6e  |CPath_CreateTran|
00000370  73 66 6f 72 6d 28 72 6f  74 61 74 65 25 29 22 0d  |sform(rotate%)".|
00000380  00 2b 2d dc 20 22 20 50  52 4f 43 50 61 74 68 5f  |.+-. " PROCPath_|
00000390  52 6f 74 61 74 69 6f 6e  28 72 6f 74 61 74 65 25  |Rotation(rotate%|
000003a0  2c 50 49 2f 28 32 2a 6e  25 29 29 22 0d 00 2c 0f  |,PI/(2*n%))"..,.|
000003b0  dc 20 22 45 4e 44 50 52  4f 43 22 0d 00 2d 08 dc  |. "ENDPROC"..-..|
000003c0  20 22 22 0d 00 2e 1d dc  20 22 44 45 46 20 50 52  | ""..... "DEF PR|
000003d0  4f 43 44 72 61 77 4f 62  6a 65 63 74 73 22 20 20  |OCDrawObjects"  |
000003e0  0d 00 2f 0f dc 20 22 20  63 6f 6c 25 3d 30 22 0d  |../.. " col%=0".|
000003f0  00 30 0f dc 20 22 20 52  45 50 45 41 54 22 0d 00  |.0.. " REPEAT"..|
00000400  31 18 dc 20 22 20 20 46  4f 52 20 69 25 3d 31 20  |1.. "  FOR i%=1 |
00000410  54 4f 20 6e 25 22 0d 00  32 24 dc 20 22 20 20 20  |TO n%"..2$. "   |
00000420  53 59 53 20 22 22 44 72  61 77 5f 46 69 6c 6c 22  |SYS ""Draw_Fill"|
00000430  22 2c 73 71 75 61 72 65  25 22 0d 00 33 2e dc 20  |",square%"..3.. |
00000440  22 20 20 20 50 52 4f 43  50 61 74 68 5f 54 72 61  |"   PROCPath_Tra|
00000450  6e 73 66 6f 72 6d 28 73  71 75 61 72 65 25 2c 72  |nsform(square%,r|
00000460  6f 74 61 74 65 25 29 22  0d 00 34 12 dc 20 22 20  |otate%)"..4.. " |
00000470  20 20 78 24 3d 47 45 54  24 22 0d 00 35 0e dc 20  |  x$=GET$"..5.. |
00000480  22 20 20 4e 45 58 54 22  0d 00 36 25 dc 20 22 20  |"  NEXT"..6%. " |
00000490  20 63 6f 6c 25 2b 3d 31  20 3a 20 47 43 4f 4c 20  | col%+=1 : GCOL |
000004a0  31 2b 63 6f 6c 25 20 4d  4f 44 20 36 22 0d 00 37  |1+col% MOD 6"..7|
000004b0  15 dc 20 22 20 20 55 4e  54 49 4c 20 46 41 4c 53  |.. "  UNTIL FALS|
000004c0  45 22 0d 00 38 0f dc 20  22 45 4e 44 50 52 4f 43  |E"..8.. "ENDPROC|
000004d0  22 0d 00 39 07 fb 20 31  0d 00 3a 21 e3 20 69 25  |"..9.. 1..:!. i%|
000004e0  3d 31 20 b8 20 20 32 35  20 3a 20 f3 20 78 24 20  |=1 .  25 : . x$ |
000004f0  3a 20 f1 20 78 24 20 3a  ed 0d 00 3b 07 fb 20 37  |: . x$ :...;.. 7|
00000500  0d 00 3c 2a f1 20 27 22  50 72 65 73 73 20 73 70  |..<*. '"Press sp|
00000510  61 63 65 20 62 61 72 21  20 28 45 53 43 20 74 6f  |ace bar! (ESC to|
00000520  20 66 69 6e 69 73 68 29  2e 22 0d 00 3d 05 e1 0d  | finish)."..=...|
00000530  00 3e 04 0d ff                                    |.>...|
00000535