--- title: "contour_it" id: 81104 type: "computer_media" slug: "contour_it" url: "http://localhost/computer_media/contour_it/" markdown_url: "http://localhost/computer_media/contour_it.md" published_at: "2026-11-26T23:47:35+00:00" modified_at: "2026-11-26T23:47:35+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "Banded colour contours of a function (cloud contours) for the QL." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" model: - name: "Sinclair QL" slug: "sinclair-ql" taxonomy: "model" url: "http://localhost/model/sinclair-ql/" indiv: - name: "Al Boehm" slug: "al-boehm" taxonomy: "indiv" url: "http://localhost/indiv/al-boehm/" genre: - name: "Graphics" slug: "graphics" taxonomy: "genre" url: "http://localhost/type/graphics/" media_type: "Diskette" programmers: - name: "Al Boehm" slug: "al-boehm" taxonomy: "indiv" url: "http://localhost/indiv/al-boehm/" download_url: "https://archive.org/download/timex-sinclair-software-archive/contour_it%20%281988%29%28Boehm%2C%20Al%29%28Sinclair%20QL%29%28US%29%28Program%29.zip" mediadate: "1988" article_media: - id: 58326 title: "Clouds on a QL" type: "article" url: "http://localhost/article/clouds-on-a-ql/" media_type_tags: "Graphics" license: false --- # contour_it Draws banded colour contours of a mathematical function on the Sinclair QL, as used for mean cloud contours: a 7 by 7 grid of values from a sine function is shaded line by line across the screen, each whole-number band in its own INK colour. The procedure contour can be called with any array; line 135 suggests random values instead. The author, at the Air Force Geophysics Laboratory, dated it 20 December 1987. The editor recommends it as a demonstration of SuperBASIC parameter passing and SCALE coordinates; the REMarks advise MODE 8. Published in the BCS Sinclair-Timex User Group Newsletter January 1988 ([Clouds on a QL](https://timexsinclair.com/article/clouds-on-a-ql/)). ## Source Code ``` 1 REMark test of contour using a math function. 2 REMark 20 Dec 1987 3 REMark by A. Boehm 100 nnx=6:nny=6:DIM z(nnx,nny) 110 FOR i=0 TO nnx 120 FOR j=0 TO nny 130 z(i,j)=10*SIN(i/10*2*PI+ j/6*2*PI)+ i*j/2 135 REMark also try z(i,j)=10*RND 140 NEXT j 150 NEXT i 160 contour z,nnx,nny 170 STOP 180 DEFine PROC contour(z,nx,ny) 185 REMark Prints banded contours of the values in z. Use MODE 8 for best results. A contour interval of 1 is assumed. For other contour intervals, let z(i,j)=z(i,j)/contour_interval before calling contour. 190 across=511:down=255:left=0: top=0 200 WINDOW across,down,left,top 210 PAPER 0:CLS 220 SCALE ny,0,0 225 dx=across*.628/down*ny/nx 230 yline=ny/down 240 FOR j=0 TO ny-1 250 x1=0:x2=dx 260 FOR i=0 TO nx-1 270 con_a_block z(i,j),z(i+1,j), z(i,j+1),z(i+1,j+1),j 280 x1=x2:x2=x2+dx 290 NEXT i 300 NEXT j 310 RETurn 320 END DEFine contour 330 DEFine PROCedure con_a_block (a,b,c,d,ystart) 340 LOCal dz,fx,x,i,j 350 aa=a:bb=b 360 da=yline*(c-a) 370 db=yline*(d-b) 380 FOR y=ystart TO ystart+1 STEP yline 390 POINT x1,y 400 i=INT(aa):j=INT(bb) 410 INK i MOD 8 420 IF i=j THEN LINE TO x2,y: GO TO 530 430 dz=ABS(bb-aa):n=ABS(j-i) 440 fx=aa-i:IF ii THEN up=1: ELSE up=-1:fy=1-fy 470 x=dx/dz 480 LINE_R TO fx*x,0 490 FOR k=i+up TO j-up STEP up 500 INK k MOD 8:LINE_R TO x,0 510 END FOR k 520 INK j MOD 8:LINE TO x2,y 530 aa=aa+da:bb=bb+db 540 END FOR y 550 END DEFine con_a_block ```