Home » Archimedes archive » Acorn User » AU 1993-09.adf » !Bio_Bio » !Bio/Library/3Dgraph
!Bio/Library/3Dgraph
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 1993-09.adf » !Bio_Bio |
Filename: | !Bio/Library/3Dgraph |
Read OK: | ✔ |
File size: | 05E8 bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Archimedes archive » Acorn User » AU 1993-08.adf » !Bio_Bio » !Bio/Library/3Dgraph
- Archimedes archive » Acorn User » AU 1993-09.adf » !Bio_Bio » !Bio/Library/3Dgraph
File contents
10REM >3dgraph 20REM By dL & DA 30REM For 32-bit machines 40REM (c) BAU August 1993 50: 60DEF FN3dgraph_name="3D Graph plotter" 70: 80DEF FN3dgraph_args="-in text -window" 90: 100DEF FN3dgraph_init 110=0 120: 130DEF FN3dgraph(in$) 140LOCAL a,b,s,x,y,z,zplus,in,table,size,xs,zs,j 150IF FNcreate_window(30,1280,512,"Graph")=0 THEN =TRUE 160IF FNclaim_memory(table,size)=0 PROCwarn("Out of memory"):=TRUE 170in=OPENIN(in$) 180func_3dgraph$=GET$#in 190CLOSE#in 200zplus=30 210s=2000 220a=table 230xs=0.4 240zs=0.4 250FOR z=10 TO -10 STEP -zs 260 j=a 270 PROChourglass(10-z,40) 280 FOR x=-10 TO 10 STEP xs 290 |a=FN3dgraph_eval(func_3dgraph$,x,z)-3 300 a+=5 310 NEXT 320 j=a-j 330NEXT 340b=table 350FOR z=10 TO zs-10 STEP -zs 360 PROChourglass(30-z,40) 370 a=b 380 FOR x=-10 TO 10-xs STEP xs 390 GCOL 2 400 PROC3dgraph_plot(4,x,|a,z) 410 PROC3dgraph_plot(4,x+xs,|(a+5),z) 420 PROC3dgraph_plot(85,x,|(a+j),z-zs) 430 PROC3dgraph_plot(85,x+xs,|(a+j+5),z-zs) 440 GCOL 1 450 PROC3dgraph_plot(5,x,|(a+j),z-zs) 460 PROC3dgraph_plot(5,x,|a,z) 470 PROC3dgraph_plot(5,x+xs,|(a+5),z) 480 PROC3dgraph_plot(5,x+xs,|(a+j+5),z-zs) 490 a+=5 500 NEXT 510 b+=j 520NEXT 530=0 540: 550DEF PROC3dgraph_plot(p,x,y,z) 560PLOT p,640+s*(x/(z+zplus)),400+s*(y/(z+zplus)) 570ENDPROC 580: 590DEF FN3dgraph_eval(f$,x,z) 600LOCAL y 610LOCAL ERROR 620ON ERROR LOCAL RESTORE ERROR:=0 630y=EVAL(f$) 640RESTORE ERROR 650=y 660: 670DEF FN3dgraph_help(window%,icon%) 680LOCAL help$ 690CASE window% OF 700 WHEN -1:help$="Drop a text file describing a graph on this icon. The first line should be a function of the form y=f(x,z) for -10<=x<=+10, -10<=z<=+10" 710 WHEN 1:help$="It is a graph of y="+func_3dgraph$ 720ENDCASE 730=help$
� >3dgraph � By dL & DA � For 32-bit machines (� (c) BAU August 1993 2: <&� �3dgraph_name="3D Graph plotter" F: P&� �3dgraph_args="-in text -window" Z: d� �3dgraph_init n=0 x: �� �3dgraph(in$) �-� a,b,s,x,y,z,zplus,in,table,size,xs,zs,j �0� �create_window(30,1280,512,"Graph")=0 � =� �;� �claim_memory(table,size)=0 �warn("Out of memory"):=� � in=�(in$) �func_3dgraph$=�#in ��#in �zplus=30 � s=2000 �a=table � xs=0.4 � zs=0.4 �� z=10 � -10 � -zs j=a �hourglass(10-z,40) � x=-10 � 10 � xs "+ |a=�3dgraph_eval(func_3dgraph$,x,z)-3 , a+=5 6 � @ j=a-j J� Tb=table ^� z=10 � zs-10 � -zs h �hourglass(30-z,40) r a=b | � x=-10 � 10-xs � xs � � 2 � �3dgraph_plot(4,x,|a,z) �$ �3dgraph_plot(4,x+xs,|(a+5),z) �% �3dgraph_plot(85,x,|(a+j),z-zs) �* �3dgraph_plot(85,x+xs,|(a+j+5),z-zs) � � 1 �$ �3dgraph_plot(5,x,|(a+j),z-zs) � �3dgraph_plot(5,x,|a,z) �$ �3dgraph_plot(5,x+xs,|(a+5),z) �) �3dgraph_plot(5,x+xs,|(a+j+5),z-zs) � a+=5 � � � b+=j � =0 : &� �3dgraph_plot(p,x,y,z) 0/� p,640+s*(x/(z+zplus)),400+s*(y/(z+zplus)) :� D: N� �3dgraph_eval(f$,x,z) X� y b� � l� � � � �:=0 vy=�(f$) �� � �=y �: �"� �3dgraph_help(window%,icon%) �� help$ �Ȏ window% � �� � -1:help$="Drop a text file describing a graph on this icon. The first line should be a function of the form y=f(x,z) for -10<=x<=+10, -10<=z<=+10" �2 � 1:help$="It is a graph of y="+func_3dgraph$ �� � =help$ �
00000000 0d 00 0a 12 f4 20 20 20 20 20 3e 33 64 67 72 61 |..... >3dgra| 00000010 70 68 0d 00 14 11 f4 20 42 79 20 20 64 4c 20 26 |ph..... By dL &| 00000020 20 44 41 0d 00 1e 19 f4 20 46 6f 72 20 33 32 2d | DA..... For 32-| 00000030 62 69 74 20 6d 61 63 68 69 6e 65 73 0d 00 28 19 |bit machines..(.| 00000040 f4 20 28 63 29 20 42 41 55 20 41 75 67 75 73 74 |. (c) BAU August| 00000050 20 31 39 39 33 0d 00 32 05 3a 0d 00 3c 26 dd 20 | 1993..2.:..<&. | 00000060 a4 33 64 67 72 61 70 68 5f 6e 61 6d 65 3d 22 33 |.3dgraph_name="3| 00000070 44 20 47 72 61 70 68 20 70 6c 6f 74 74 65 72 22 |D Graph plotter"| 00000080 0d 00 46 05 3a 0d 00 50 26 dd 20 a4 33 64 67 72 |..F.:..P&. .3dgr| 00000090 61 70 68 5f 61 72 67 73 3d 22 2d 69 6e 20 74 65 |aph_args="-in te| 000000a0 78 74 20 2d 77 69 6e 64 6f 77 22 0d 00 5a 05 3a |xt -window"..Z.:| 000000b0 0d 00 64 13 dd 20 a4 33 64 67 72 61 70 68 5f 69 |..d.. .3dgraph_i| 000000c0 6e 69 74 0d 00 6e 06 3d 30 0d 00 78 05 3a 0d 00 |nit..n.=0..x.:..| 000000d0 82 13 dd 20 a4 33 64 67 72 61 70 68 28 69 6e 24 |... .3dgraph(in$| 000000e0 29 0d 00 8c 2d ea 20 61 2c 62 2c 73 2c 78 2c 79 |)...-. a,b,s,x,y| 000000f0 2c 7a 2c 7a 70 6c 75 73 2c 69 6e 2c 74 61 62 6c |,z,zplus,in,tabl| 00000100 65 2c 73 69 7a 65 2c 78 73 2c 7a 73 2c 6a 0d 00 |e,size,xs,zs,j..| 00000110 96 30 e7 20 a4 63 72 65 61 74 65 5f 77 69 6e 64 |.0. .create_wind| 00000120 6f 77 28 33 30 2c 31 32 38 30 2c 35 31 32 2c 22 |ow(30,1280,512,"| 00000130 47 72 61 70 68 22 29 3d 30 20 8c 20 3d b9 0d 00 |Graph")=0 . =...| 00000140 a0 3b e7 20 a4 63 6c 61 69 6d 5f 6d 65 6d 6f 72 |.;. .claim_memor| 00000150 79 28 74 61 62 6c 65 2c 73 69 7a 65 29 3d 30 20 |y(table,size)=0 | 00000160 f2 77 61 72 6e 28 22 4f 75 74 20 6f 66 20 6d 65 |.warn("Out of me| 00000170 6d 6f 72 79 22 29 3a 3d b9 0d 00 aa 0d 69 6e 3d |mory"):=.....in=| 00000180 8e 28 69 6e 24 29 0d 00 b4 16 66 75 6e 63 5f 33 |.(in$)....func_3| 00000190 64 67 72 61 70 68 24 3d be 23 69 6e 0d 00 be 08 |dgraph$=.#in....| 000001a0 d9 23 69 6e 0d 00 c8 0c 7a 70 6c 75 73 3d 33 30 |.#in....zplus=30| 000001b0 0d 00 d2 0a 73 3d 32 30 30 30 0d 00 dc 0b 61 3d |....s=2000....a=| 000001c0 74 61 62 6c 65 0d 00 e6 0a 78 73 3d 30 2e 34 0d |table....xs=0.4.| 000001d0 00 f0 0a 7a 73 3d 30 2e 34 0d 00 fa 16 e3 20 7a |...zs=0.4..... z| 000001e0 3d 31 30 20 b8 20 2d 31 30 20 88 20 2d 7a 73 0d |=10 . -10 . -zs.| 000001f0 01 04 08 20 6a 3d 61 0d 01 0e 18 20 f2 68 6f 75 |... j=a.... .hou| 00000200 72 67 6c 61 73 73 28 31 30 2d 7a 2c 34 30 29 0d |rglass(10-z,40).| 00000210 01 18 16 20 e3 20 78 3d 2d 31 30 20 b8 20 31 30 |... . x=-10 . 10| 00000220 20 88 20 78 73 0d 01 22 2b 20 20 7c 61 3d a4 33 | . xs.."+ |a=.3| 00000230 64 67 72 61 70 68 5f 65 76 61 6c 28 66 75 6e 63 |dgraph_eval(func| 00000240 5f 33 64 67 72 61 70 68 24 2c 78 2c 7a 29 2d 33 |_3dgraph$,x,z)-3| 00000250 0d 01 2c 0a 20 20 61 2b 3d 35 0d 01 36 06 20 ed |..,. a+=5..6. .| 00000260 0d 01 40 0a 20 6a 3d 61 2d 6a 0d 01 4a 05 ed 0d |..@. j=a-j..J...| 00000270 01 54 0b 62 3d 74 61 62 6c 65 0d 01 5e 18 e3 20 |.T.b=table..^.. | 00000280 7a 3d 31 30 20 b8 20 7a 73 2d 31 30 20 88 20 2d |z=10 . zs-10 . -| 00000290 7a 73 0d 01 68 18 20 f2 68 6f 75 72 67 6c 61 73 |zs..h. .hourglas| 000002a0 73 28 33 30 2d 7a 2c 34 30 29 0d 01 72 08 20 61 |s(30-z,40)..r. a| 000002b0 3d 62 0d 01 7c 19 20 e3 20 78 3d 2d 31 30 20 b8 |=b..|. . x=-10 .| 000002c0 20 31 30 2d 78 73 20 88 20 78 73 0d 01 86 09 20 | 10-xs . xs.... | 000002d0 20 e6 20 32 0d 01 90 1d 20 20 f2 33 64 67 72 61 | . 2.... .3dgra| 000002e0 70 68 5f 70 6c 6f 74 28 34 2c 78 2c 7c 61 2c 7a |ph_plot(4,x,|a,z| 000002f0 29 0d 01 9a 24 20 20 f2 33 64 67 72 61 70 68 5f |)...$ .3dgraph_| 00000300 70 6c 6f 74 28 34 2c 78 2b 78 73 2c 7c 28 61 2b |plot(4,x+xs,|(a+| 00000310 35 29 2c 7a 29 0d 01 a4 25 20 20 f2 33 64 67 72 |5),z)...% .3dgr| 00000320 61 70 68 5f 70 6c 6f 74 28 38 35 2c 78 2c 7c 28 |aph_plot(85,x,|(| 00000330 61 2b 6a 29 2c 7a 2d 7a 73 29 0d 01 ae 2a 20 20 |a+j),z-zs)...* | 00000340 f2 33 64 67 72 61 70 68 5f 70 6c 6f 74 28 38 35 |.3dgraph_plot(85| 00000350 2c 78 2b 78 73 2c 7c 28 61 2b 6a 2b 35 29 2c 7a |,x+xs,|(a+j+5),z| 00000360 2d 7a 73 29 0d 01 b8 09 20 20 e6 20 31 0d 01 c2 |-zs).... . 1...| 00000370 24 20 20 f2 33 64 67 72 61 70 68 5f 70 6c 6f 74 |$ .3dgraph_plot| 00000380 28 35 2c 78 2c 7c 28 61 2b 6a 29 2c 7a 2d 7a 73 |(5,x,|(a+j),z-zs| 00000390 29 0d 01 cc 1d 20 20 f2 33 64 67 72 61 70 68 5f |).... .3dgraph_| 000003a0 70 6c 6f 74 28 35 2c 78 2c 7c 61 2c 7a 29 0d 01 |plot(5,x,|a,z)..| 000003b0 d6 24 20 20 f2 33 64 67 72 61 70 68 5f 70 6c 6f |.$ .3dgraph_plo| 000003c0 74 28 35 2c 78 2b 78 73 2c 7c 28 61 2b 35 29 2c |t(5,x+xs,|(a+5),| 000003d0 7a 29 0d 01 e0 29 20 20 f2 33 64 67 72 61 70 68 |z)...) .3dgraph| 000003e0 5f 70 6c 6f 74 28 35 2c 78 2b 78 73 2c 7c 28 61 |_plot(5,x+xs,|(a| 000003f0 2b 6a 2b 35 29 2c 7a 2d 7a 73 29 0d 01 ea 0a 20 |+j+5),z-zs).... | 00000400 20 61 2b 3d 35 0d 01 f4 06 20 ed 0d 01 fe 09 20 | a+=5.... ..... | 00000410 62 2b 3d 6a 0d 02 08 05 ed 0d 02 12 06 3d 30 0d |b+=j.........=0.| 00000420 02 1c 05 3a 0d 02 26 1c dd 20 f2 33 64 67 72 61 |...:..&.. .3dgra| 00000430 70 68 5f 70 6c 6f 74 28 70 2c 78 2c 79 2c 7a 29 |ph_plot(p,x,y,z)| 00000440 0d 02 30 2f f0 20 70 2c 36 34 30 2b 73 2a 28 78 |..0/. p,640+s*(x| 00000450 2f 28 7a 2b 7a 70 6c 75 73 29 29 2c 34 30 30 2b |/(z+zplus)),400+| 00000460 73 2a 28 79 2f 28 7a 2b 7a 70 6c 75 73 29 29 0d |s*(y/(z+zplus)).| 00000470 02 3a 05 e1 0d 02 44 05 3a 0d 02 4e 1b dd 20 a4 |.:....D.:..N.. .| 00000480 33 64 67 72 61 70 68 5f 65 76 61 6c 28 66 24 2c |3dgraph_eval(f$,| 00000490 78 2c 7a 29 0d 02 58 07 ea 20 79 0d 02 62 07 ea |x,z)..X.. y..b..| 000004a0 20 85 0d 02 6c 10 ee 20 85 20 ea 20 f7 20 85 3a | ...l.. . . . .:| 000004b0 3d 30 0d 02 76 0b 79 3d a0 28 66 24 29 0d 02 80 |=0..v.y=.(f$)...| 000004c0 07 f7 20 85 0d 02 8a 06 3d 79 0d 02 94 05 3a 0d |.. .....=y....:.| 000004d0 02 9e 22 dd 20 a4 33 64 67 72 61 70 68 5f 68 65 |..". .3dgraph_he| 000004e0 6c 70 28 77 69 6e 64 6f 77 25 2c 69 63 6f 6e 25 |lp(window%,icon%| 000004f0 29 0d 02 a8 0b ea 20 68 65 6c 70 24 0d 02 b2 10 |)..... help$....| 00000500 c8 8e 20 77 69 6e 64 6f 77 25 20 ca 0d 02 bc 99 |.. window% .....| 00000510 20 c9 20 2d 31 3a 68 65 6c 70 24 3d 22 44 72 6f | . -1:help$="Dro| 00000520 70 20 61 20 74 65 78 74 20 66 69 6c 65 20 64 65 |p a text file de| 00000530 73 63 72 69 62 69 6e 67 20 61 20 67 72 61 70 68 |scribing a graph| 00000540 20 6f 6e 20 74 68 69 73 20 69 63 6f 6e 2e 20 54 | on this icon. T| 00000550 68 65 20 66 69 72 73 74 20 6c 69 6e 65 20 73 68 |he first line sh| 00000560 6f 75 6c 64 20 62 65 20 61 20 66 75 6e 63 74 69 |ould be a functi| 00000570 6f 6e 20 6f 66 20 74 68 65 20 66 6f 72 6d 20 79 |on of the form y| 00000580 3d 66 28 78 2c 7a 29 20 66 6f 72 20 2d 31 30 3c |=f(x,z) for -10<| 00000590 3d 78 3c 3d 2b 31 30 2c 20 2d 31 30 3c 3d 7a 3c |=x<=+10, -10<=z<| 000005a0 3d 2b 31 30 22 0d 02 c6 32 20 c9 20 31 3a 68 65 |=+10"...2 . 1:he| 000005b0 6c 70 24 3d 22 49 74 20 69 73 20 61 20 67 72 61 |lp$="It is a gra| 000005c0 70 68 20 6f 66 20 79 3d 22 2b 66 75 6e 63 5f 33 |ph of y="+func_3| 000005d0 64 67 72 61 70 68 24 0d 02 d0 05 cb 0d 02 da 0a |dgraph$.........| 000005e0 3d 68 65 6c 70 24 0d ff |=help$..| 000005e8