Home » Archimedes archive » Acorn User » AU 1994-03.adf » !StarInfo_StarInfo » Turnbull/!Pyramid/Library/Transform

Turnbull/!Pyramid/Library/Transform

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 » Acorn User » AU 1994-03.adf » !StarInfo_StarInfo
Filename: Turnbull/!Pyramid/Library/Transform
Read OK:
File size: 0428 bytes
Load address: 0000
Exec address: 0000
File contents
   10DEFPROCgoto
   20LOCALerr$:err$="Transform"
   30T%=ABS(TA%-A%):D%=ABS(DA%):E%=D%*(D%+1)>>1
   40IFE%>T%THENDA%-=SGN(TA%-A%)ELSEIFE%+D%+1<=T%THENDA%+=SGN(TA%-A%)
   50A%+=DA%
   60ENDPROC
   70:
   80DEFPROCidentity
   90LOCALerr$:err$="Transfrom"
  100XX=1:XY=0:XZ=0:YX=0:YY=1:YZ=0:ZX=0:ZY=0:ZZ=1
  110ENDPROC
  120:
  130DEFPROCxrot(A%)
  140LOCALerr$:err$="Transfrom"
  150C=C(A%):S=S(A%)
  160OY=XY:XY=XY*C+XZ*S:XZ=XZ*C-OY*S
  170OY=YY:YY=YY*C+YZ*S:YZ=YZ*C-OY*S
  180OY=ZY:ZY=ZY*C+ZZ*S:ZZ=ZZ*C-OY*S
  190ENDPROC
  200:
  210DEFPROCyrot(A%)
  220LOCALerr$:err$="Transfrom"
  230C=C(A%):S=S(A%)
  240OX=XX:XX=XX*C+XZ*S:XZ=XZ*C-OX*S
  250OX=YX:YX=YX*C+YZ*S:YZ=YZ*C-OX*S
  260OX=ZX:ZX=ZX*C+ZZ*S:ZZ=ZZ*C-OX*S
  270ENDPROC
  280:
  290DEFPROCzrot(A%)
  300LOCALerr$:err$="Transfrom"
  310C=C(A%):S=S(A%)
  320OX=XX:XX=XX*C+XY*S:XY=XY*C-OX*S
  330OX=YX:YX=YX*C+YY*S:YY=YY*C-OX*S
  340OX=ZX:ZX=ZX*C+ZY*S:ZY=ZY*C-OX*S
  350ENDPROC
  360:
  370DEFPROCfill(N%)
  380LOCALerr$:err$="Transfrom"
  390SX=128.5:SY=128.5
  400J%!0=SX+YF*YX:J%!4=SY-YF*YY:SX+=YG*YX:SY-=YG*YY
  410J%!8=SX+XF*XX:J%!12=SY-XF*XY:SX+=XG*XX:SY-=XG*XY
  420J%!16=SX+ZF*ZX:J%!20=SY-ZF*ZY
  430J%!24=SX-ZF*ZX:J%!28=SY+ZF*ZY
  440J%+=32
  450WHILEN%>1:FORT%=0TO7:!J%=J%!-32:J%+=4:NEXT:N%-=1:ENDWHILE
  460ENDPROC


��goto
�err$:err$="Transform"
*T%=�(TA%-A%):D%=�(DA%):E%=D%*(D%+1)>>1
(5�E%>T%�DA%-=�(TA%-A%)��E%+D%+1<=T%�DA%+=�(TA%-A%)
2A%+=DA%
<�
F:
P��identity
Z�err$:err$="Transfrom"
d0XX=1:XY=0:XZ=0:YX=0:YY=1:YZ=0:ZX=0:ZY=0:ZZ=1
n�
x:
���xrot(A%)
��err$:err$="Transfrom"
�C=C(A%):S=S(A%)
�#OY=XY:XY=XY*C+XZ*S:XZ=XZ*C-OY*S
�#OY=YY:YY=YY*C+YZ*S:YZ=YZ*C-OY*S
�#OY=ZY:ZY=ZY*C+ZZ*S:ZZ=ZZ*C-OY*S
��
�:
���yrot(A%)
��err$:err$="Transfrom"
�C=C(A%):S=S(A%)
�#OX=XX:XX=XX*C+XZ*S:XZ=XZ*C-OX*S
�#OX=YX:YX=YX*C+YZ*S:YZ=YZ*C-OX*S
#OX=ZX:ZX=ZX*C+ZZ*S:ZZ=ZZ*C-OX*S
�
:
"��zrot(A%)
,�err$:err$="Transfrom"
6C=C(A%):S=S(A%)
@#OX=XX:XX=XX*C+XY*S:XY=XY*C-OX*S
J#OX=YX:YX=YX*C+YY*S:YY=YY*C-OX*S
T#OX=ZX:ZX=ZX*C+ZY*S:ZY=ZY*C-OX*S
^�
h:
r��fill(N%)
|�err$:err$="Transfrom"
�SX=128.5:SY=128.5
�3J%!0=SX+YF*YX:J%!4=SY-YF*YY:SX+=YG*YX:SY-=YG*YY
�4J%!8=SX+XF*XX:J%!12=SY-XF*XY:SX+=XG*XX:SY-=XG*XY
�!J%!16=SX+ZF*ZX:J%!20=SY-ZF*ZY
�!J%!24=SX-ZF*ZX:J%!28=SY+ZF*ZY
�
J%+=32
�-ȕN%>1:�T%=0�7:!J%=J%!-32:J%+=4:�:N%-=1:�
��
�
00000000  0d 00 0a 0a dd f2 67 6f  74 6f 0d 00 14 1a ea 65  |......goto.....e|
00000010  72 72 24 3a 65 72 72 24  3d 22 54 72 61 6e 73 66  |rr$:err$="Transf|
00000020  6f 72 6d 22 0d 00 1e 2a  54 25 3d 94 28 54 41 25  |orm"...*T%=.(TA%|
00000030  2d 41 25 29 3a 44 25 3d  94 28 44 41 25 29 3a 45  |-A%):D%=.(DA%):E|
00000040  25 3d 44 25 2a 28 44 25  2b 31 29 3e 3e 31 0d 00  |%=D%*(D%+1)>>1..|
00000050  28 35 e7 45 25 3e 54 25  8c 44 41 25 2d 3d b4 28  |(5.E%>T%.DA%-=.(|
00000060  54 41 25 2d 41 25 29 8b  e7 45 25 2b 44 25 2b 31  |TA%-A%)..E%+D%+1|
00000070  3c 3d 54 25 8c 44 41 25  2b 3d b4 28 54 41 25 2d  |<=T%.DA%+=.(TA%-|
00000080  41 25 29 0d 00 32 0b 41  25 2b 3d 44 41 25 0d 00  |A%)..2.A%+=DA%..|
00000090  3c 05 e1 0d 00 46 05 3a  0d 00 50 0e dd f2 69 64  |<....F.:..P...id|
000000a0  65 6e 74 69 74 79 0d 00  5a 1a ea 65 72 72 24 3a  |entity..Z..err$:|
000000b0  65 72 72 24 3d 22 54 72  61 6e 73 66 72 6f 6d 22  |err$="Transfrom"|
000000c0  0d 00 64 30 58 58 3d 31  3a 58 59 3d 30 3a 58 5a  |..d0XX=1:XY=0:XZ|
000000d0  3d 30 3a 59 58 3d 30 3a  59 59 3d 31 3a 59 5a 3d  |=0:YX=0:YY=1:YZ=|
000000e0  30 3a 5a 58 3d 30 3a 5a  59 3d 30 3a 5a 5a 3d 31  |0:ZX=0:ZY=0:ZZ=1|
000000f0  0d 00 6e 05 e1 0d 00 78  05 3a 0d 00 82 0e dd f2  |..n....x.:......|
00000100  78 72 6f 74 28 41 25 29  0d 00 8c 1a ea 65 72 72  |xrot(A%).....err|
00000110  24 3a 65 72 72 24 3d 22  54 72 61 6e 73 66 72 6f  |$:err$="Transfro|
00000120  6d 22 0d 00 96 13 43 3d  43 28 41 25 29 3a 53 3d  |m"....C=C(A%):S=|
00000130  53 28 41 25 29 0d 00 a0  23 4f 59 3d 58 59 3a 58  |S(A%)...#OY=XY:X|
00000140  59 3d 58 59 2a 43 2b 58  5a 2a 53 3a 58 5a 3d 58  |Y=XY*C+XZ*S:XZ=X|
00000150  5a 2a 43 2d 4f 59 2a 53  0d 00 aa 23 4f 59 3d 59  |Z*C-OY*S...#OY=Y|
00000160  59 3a 59 59 3d 59 59 2a  43 2b 59 5a 2a 53 3a 59  |Y:YY=YY*C+YZ*S:Y|
00000170  5a 3d 59 5a 2a 43 2d 4f  59 2a 53 0d 00 b4 23 4f  |Z=YZ*C-OY*S...#O|
00000180  59 3d 5a 59 3a 5a 59 3d  5a 59 2a 43 2b 5a 5a 2a  |Y=ZY:ZY=ZY*C+ZZ*|
00000190  53 3a 5a 5a 3d 5a 5a 2a  43 2d 4f 59 2a 53 0d 00  |S:ZZ=ZZ*C-OY*S..|
000001a0  be 05 e1 0d 00 c8 05 3a  0d 00 d2 0e dd f2 79 72  |.......:......yr|
000001b0  6f 74 28 41 25 29 0d 00  dc 1a ea 65 72 72 24 3a  |ot(A%).....err$:|
000001c0  65 72 72 24 3d 22 54 72  61 6e 73 66 72 6f 6d 22  |err$="Transfrom"|
000001d0  0d 00 e6 13 43 3d 43 28  41 25 29 3a 53 3d 53 28  |....C=C(A%):S=S(|
000001e0  41 25 29 0d 00 f0 23 4f  58 3d 58 58 3a 58 58 3d  |A%)...#OX=XX:XX=|
000001f0  58 58 2a 43 2b 58 5a 2a  53 3a 58 5a 3d 58 5a 2a  |XX*C+XZ*S:XZ=XZ*|
00000200  43 2d 4f 58 2a 53 0d 00  fa 23 4f 58 3d 59 58 3a  |C-OX*S...#OX=YX:|
00000210  59 58 3d 59 58 2a 43 2b  59 5a 2a 53 3a 59 5a 3d  |YX=YX*C+YZ*S:YZ=|
00000220  59 5a 2a 43 2d 4f 58 2a  53 0d 01 04 23 4f 58 3d  |YZ*C-OX*S...#OX=|
00000230  5a 58 3a 5a 58 3d 5a 58  2a 43 2b 5a 5a 2a 53 3a  |ZX:ZX=ZX*C+ZZ*S:|
00000240  5a 5a 3d 5a 5a 2a 43 2d  4f 58 2a 53 0d 01 0e 05  |ZZ=ZZ*C-OX*S....|
00000250  e1 0d 01 18 05 3a 0d 01  22 0e dd f2 7a 72 6f 74  |.....:.."...zrot|
00000260  28 41 25 29 0d 01 2c 1a  ea 65 72 72 24 3a 65 72  |(A%)..,..err$:er|
00000270  72 24 3d 22 54 72 61 6e  73 66 72 6f 6d 22 0d 01  |r$="Transfrom"..|
00000280  36 13 43 3d 43 28 41 25  29 3a 53 3d 53 28 41 25  |6.C=C(A%):S=S(A%|
00000290  29 0d 01 40 23 4f 58 3d  58 58 3a 58 58 3d 58 58  |)..@#OX=XX:XX=XX|
000002a0  2a 43 2b 58 59 2a 53 3a  58 59 3d 58 59 2a 43 2d  |*C+XY*S:XY=XY*C-|
000002b0  4f 58 2a 53 0d 01 4a 23  4f 58 3d 59 58 3a 59 58  |OX*S..J#OX=YX:YX|
000002c0  3d 59 58 2a 43 2b 59 59  2a 53 3a 59 59 3d 59 59  |=YX*C+YY*S:YY=YY|
000002d0  2a 43 2d 4f 58 2a 53 0d  01 54 23 4f 58 3d 5a 58  |*C-OX*S..T#OX=ZX|
000002e0  3a 5a 58 3d 5a 58 2a 43  2b 5a 59 2a 53 3a 5a 59  |:ZX=ZX*C+ZY*S:ZY|
000002f0  3d 5a 59 2a 43 2d 4f 58  2a 53 0d 01 5e 05 e1 0d  |=ZY*C-OX*S..^...|
00000300  01 68 05 3a 0d 01 72 0e  dd f2 66 69 6c 6c 28 4e  |.h.:..r...fill(N|
00000310  25 29 0d 01 7c 1a ea 65  72 72 24 3a 65 72 72 24  |%)..|..err$:err$|
00000320  3d 22 54 72 61 6e 73 66  72 6f 6d 22 0d 01 86 15  |="Transfrom"....|
00000330  53 58 3d 31 32 38 2e 35  3a 53 59 3d 31 32 38 2e  |SX=128.5:SY=128.|
00000340  35 0d 01 90 33 4a 25 21  30 3d 53 58 2b 59 46 2a  |5...3J%!0=SX+YF*|
00000350  59 58 3a 4a 25 21 34 3d  53 59 2d 59 46 2a 59 59  |YX:J%!4=SY-YF*YY|
00000360  3a 53 58 2b 3d 59 47 2a  59 58 3a 53 59 2d 3d 59  |:SX+=YG*YX:SY-=Y|
00000370  47 2a 59 59 0d 01 9a 34  4a 25 21 38 3d 53 58 2b  |G*YY...4J%!8=SX+|
00000380  58 46 2a 58 58 3a 4a 25  21 31 32 3d 53 59 2d 58  |XF*XX:J%!12=SY-X|
00000390  46 2a 58 59 3a 53 58 2b  3d 58 47 2a 58 58 3a 53  |F*XY:SX+=XG*XX:S|
000003a0  59 2d 3d 58 47 2a 58 59  0d 01 a4 21 4a 25 21 31  |Y-=XG*XY...!J%!1|
000003b0  36 3d 53 58 2b 5a 46 2a  5a 58 3a 4a 25 21 32 30  |6=SX+ZF*ZX:J%!20|
000003c0  3d 53 59 2d 5a 46 2a 5a  59 0d 01 ae 21 4a 25 21  |=SY-ZF*ZY...!J%!|
000003d0  32 34 3d 53 58 2d 5a 46  2a 5a 58 3a 4a 25 21 32  |24=SX-ZF*ZX:J%!2|
000003e0  38 3d 53 59 2b 5a 46 2a  5a 59 0d 01 b8 0a 4a 25  |8=SY+ZF*ZY....J%|
000003f0  2b 3d 33 32 0d 01 c2 2d  c8 95 4e 25 3e 31 3a e3  |+=32...-..N%>1:.|
00000400  54 25 3d 30 b8 37 3a 21  4a 25 3d 4a 25 21 2d 33  |T%=0.7:!J%=J%!-3|
00000410  32 3a 4a 25 2b 3d 34 3a  ed 3a 4e 25 2d 3d 31 3a  |2:J%+=4:.:N%-=1:|
00000420  ce 0d 01 cc 05 e1 0d ff                           |........|
00000428