home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / games / new / 920104.2 < prev    next >
Encoding:
Internet Message Format  |  1992-01-03  |  2.0 KB

  1. Path: uunet!think.com!samsung!munnari.oz.au!news.hawaii.edu!jach.hawaii.edu!JOEL
  2. From: joel@jach.hawaii.edu
  3. Newsgroups: vmsnet.sources.games
  4. Subject: MANDELPRINT source
  5. Message-ID: <1992Jan4.061305.14470@news.Hawaii.Edu>
  6. Date: 4 Jan 92 06:13:05 GMT
  7. Sender: root@news.Hawaii.Edu (News Service)
  8. Reply-To: joel@jach.hawaii.edu
  9. Organization: UK/Canada/Netherlands Joint Astronomy Centre, Hilo, HI
  10. Lines: 82
  11. Nntp-Posting-Host: maikai.jach.hawaii.edu
  12.  
  13. c    MANDELBROT in VAX/VMS Fortran/PGPLOT, output to POSTSCRIPT file
  14. c
  15. c        MANDELPRINT: REAL*8 variables for speed
  16. c
  17. c    Dec '91        Joel Aycock (JOEL@JACH.HAWAII.EDU)
  18. c            UK Infrared Telescope
  19. c            Joint Astronomy Centre, Hawaii
  20.  
  21. c        must be linked with PGPLOT library: GRPSHR.OLB
  22.  
  23.     integer        iter
  24.     real        r,i,rstart,rend,istart,iend,size,step
  25.     real        pistart,piend
  26.     real        r16,i16,zr,zi,newzr,newzi
  27.     character    title*38,stp*6,itr*5
  28.  
  29.     write (5,10)
  30. 10    format (//'$   start (real,imaginary) ')
  31.     read (5,*) rstart,istart
  32.  
  33.     write (5,15)
  34. 15    format (//'$        extent, step size ')
  35.     read (5,*) size,step
  36.  
  37.     rend = rstart + size
  38.     iend = istart + size
  39.  
  40.     pistart = istart
  41.     piend   = iend
  42.  
  43.     write (5,20)
  44. 20    format (//'$               iterations ')
  45.     read (5,*) iter
  46.  
  47. c    decode STEP and ITER to character STP and ITR
  48. c    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  49.     encode (8,110,stp) step
  50. 110    format (f8.5)
  51.     encode (5,120,itr) iter
  52. 120    format (i5)
  53.  
  54.     title = 'step size: '//stp//'   iterations: '//itr
  55.     type *,'title = ',title
  56.  
  57.     if ((istart.lt.0.).and.(iend.gt.0.)) then
  58.         if (abs(istart).gt.iend) then
  59.             iend=0.
  60.           else
  61.             istart=0.
  62.         endif
  63.     endif
  64.  
  65.     call pgbegin(0,'POSTSCRIPT_L',1,1)
  66.     call pgenv(rstart,rend,pistart,piend,0,1)
  67.  
  68.     call pglabel ('REAL','IMAGINARY',title)
  69.  
  70.     do r=rstart,rend,step
  71.         do i=istart,iend,step
  72.           r16=r
  73.           i16=i
  74.           zr=0.
  75.           zi=0.
  76.           do n=1,iter
  77.             newzr = zr*zr-zi*zi+r16
  78.             newzi = 2.*zr*zi+i16
  79.             if ((newzr.eq.zr).and.(newzi.eq.zi)) goto 100
  80.             zr = newzr
  81.             zi = newzi
  82.             if ((zr*zr+zi*zi).gt.4.) goto 200
  83.           enddo
  84.  
  85. 100          call pgpoint(1,r,i,-1)
  86.           call pgpoint(1,r,-i,-1)
  87.  
  88. 200        enddo
  89.     enddo
  90.  
  91.     call pgend
  92.  
  93.     stop
  94.     end
  95.