PROGRAM APFEL3 C 20.11.85 WI/1 C MANDELBROT-GRAPHIC. C C FUNCTIONAL DESCRIPTION : C C The color of an array of points in the complex plane is C evaluated by a special algorithm.The result is drawn as C a picture on the screen with the aid of the CORE-Graphic C System.The Picture-Resolution can be selected from 1...40 C by a special parameter,e.g : C C Resolution = 1 -> X : Y = 18 : 12 C Resolution = 10 -> X : Y = 180 : 120 C Resolution = 40 -> X : Y = 720 : 480 C C The 'color' of the Start-Value SX/SY in the Complex-Plane is C transformed to the origin of a window with the relative size C of SX+DX / SY+DY in the World-Coordinate-System.The dimensions C of this window are given by the selected resolution.The C window's origin is located on the upper-left corner.A special C algorithm is applied to compute the color of every point C (see explanation in subroutine CHAOS2) in the selected part of C the Complex-Plane. C INCLUDE 'LB:[1,5]CGL.FTN' C REAL*4 SX,SY,DX,DY INTEGER*2 SAVE(24),ORIGIN,IFCO,N,IX,IY,FACT,NX,NY REAL*4 VXM,VXP,VYM,VYP,WXM,WXP,WYM,WYP REAL*4 LWX,LWY,LWXO,LWYO LOGICAL YES CHARACTER*1 ESC C DATA ESC/27/ !ASCII-ESC. C 71 FORMAT(1H$,A1,'[2J') !DEFINE ERASE SCREEN. 72 FORMAT(1H$,A1,'[?6l') !DEFINE CURSOR HOME. 73 FORMAT(1H$,A1,'[24;1H',' To continue,press RESUME !') C IFCO=5 !DIALOG-FILECODE. ORIGIN=0 !ORIGIN : BOTTOM LEFT. VXM=0.0 !SELECT - VXP=1.0 ! VYM=0.0 ! VYP=1.0 !VIEWPORT. IX=18 !BASIC X-POINTS. IY=12 !BASIC Y-POINTS. C 55 WRITE(IFCO,71)ESC !CLEAR SCREEN. WRITE(IFCO,72)ESC !CURSOR HOME. C WRITE(IFCO,100) 100 FORMAT(1X,'Graphical Presentation of the Mandelbrot_Set :',//) C 5 WRITE(IFCO,'(1H$,''Number of planned iterations (I5) : '')') READ(IFCO,'(I5)',ERR=5)N C 15 WRITE(IFCO,'(1H$,''Select X-Start Position |...10.0| : '')') READ(IFCO,'(F5.0)',ERR=15)SX IF(SX.LT.-10.0.OR.SX.GT.10.0)GOTO 15 C 25 WRITE(IFCO,'(1H$,''Select Y-Start Position |...10.0| : '')') READ(IFCO,'(F5.0)',ERR=25)SY IF(SY.LT.-10.0.OR.SY.GT.10.0)GOTO 25 C 35 WRITE(IFCO,'(1H$,''Select Window-Edge 0...10.0 : '')') READ(IFCO,'(F5.0)',ERR=35)DX IF(DX.LT.0.0.OR.DX.GT.10.0)GOTO 35 C DY=DX*(FLOAT(IY)/FLOAT(IX)) !COMPUTE WINDOW-HEIGHT. C 65 WRITE(IFCO,'(1H$,''Resolution-Factor (1...40) : '')') READ(IFCO,'(I2)',ERR=65)FACT IF(FACT.LT.1.OR.FACT.GT.40)GOTO 65 C C COMPUTE WINDOW DATA : C WXM=SX !COMPUTE - WXP=SX+DX ! WYM=SY ! WYP=SY+DY !WINDOW. C C INITIALIZE GRAPHIC SYSTEM : C CALL CGL(GIC) !INITIALIZE_CORE. CALL CGL(GNF) !NEW_FRAME. CALL CGL(GSV2,VXM,VXP,VYM,VYP) !SET_VIEWPORT. CALL CGL(GSW,WXM,WXP,WYM,WYP) !SET_WINDOW. CALL CGL(GSO,ORIGIN) !SET_ORIGIN. CALL CGL(GRA2,WXP,WYP) !RECTANGLE_ABS. CALL CGL(GMA2,WXM,WYM) !MOVE_ABS_2. C CALL CGL(GICM,SAVE) !INQUIRE_COLOR_MAP. CALL CGL(GILW,LWXO,LWYO) !INQUIRE_LINEWIDTH. C LWX=(WXP-WXM)/(IX*FACT) !COMPUTE - LWY=2.0*(WYP-WYM)/(IY*FACT) !LINEWIDTH. IF(FACT.GT.20)LWY=LWY*2.0 !DUE TO INTERLACE. C CALL CGL(GSLW,LWX,-LWY) !SET_LINEWIDTH. C C CHAOS COMPUTATION PART : C NX=FACT*IX !X-POINTS. NY=FACT*IY !Y-POINTS. C CALL CHAOS3(NX,NY,SX,SY,DX,DY,N) !EXPLAN. SEE CHAOS3. C WRITE(IFCO,73)ESC !RESUME MESSAGE. C CALL WTRES !WAIT FOR RESUME. C WRITE(IFCO,71)ESC !CLEAR SCREEN. WRITE(IFCO,72)ESC !CURSOR HOME. C WRITE(IFCO,200)N,SX,SY,DX,DY,FACT 200 FORMAT(1X,'Start-Values : ',I6,4F11.4,I6) C WRITE(IFCO,73)ESC !RESUME MESSAGE. C CALL WTRES !WAIT FOR RESUME. C C TERMINATE GRAPHIC SYSTEM : C CALL CGL(GSCM,SAVE) !SET_COLOR_MAP. CALL CGL(GSLW,LWXO,LWYO) !SET_LINEWIDTH. CALL CGL(GNF) !NEW_FRAME. CALL CGL(GTC) !TERMINATE_CORE. C CALL YESNO(IFCO,YES,15,'A new picture ?') IF(YES)GOTO 55 C TYPE *,'APFEL3 : See YOU later !' C CALL EXIT C END