home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
adaptor
/
examples
/
fractal
/
mandel1.f
< prev
next >
Wrap
Text File
|
1993-06-28
|
2KB
|
73 lines
program mandel
real xmin, xmax, ymin, ymax
integer width, height
integer bild (:,:), hostbild (:,:)
cmf$ layout hostbild (:host)
logical done
integer hx1, hx2, hy1, hy2
integer maxtiefe
parameter (maxtiefe = 256)
real valmax
parameter (valmax = 40.0)
real xp, yp, x, y, xalt
print *, 'Input Width - Height '
print *, 'should always be a multiple of 4 '
read *, width, height
allocate (bild(1:height,1:width))
allocate (hostbild(1:height,1:width))
call x_display_init (width, height)
xmin = -2.0
xmax = 1.0
ymin = -1.0
ymax = 1.0
done = .false.
do while (.not. done )
!HPF$ INDEPENDENT, LOCAL_ACCESS
do j=1,width
!HPF$ INDEPENDENT, LOCAL_ACCESS
do i=1,height
xp = j
xp = (xmax - xmin) * xp
xp = xp /width + xmin
yp = i
yp = (ymax - ymin) * yp
yp = yp /height + ymin
x = 0.0
y = 0.0
bild(i,j) = 0
K = 0
DO WHILE ((K .lt. MAXTIEFE) .and. ((X*X+Y*Y) .lt. VALMAX))
XALT = X
X = (X*X-Y*Y) + XP
Y = (2*XALT*Y) + YP
BILD(i,j) = BILD(i,j) + 1
K = K + 1
END DO
END DO
END DO
hostbild = bild
call x_show_bild (hostbild,width,height)
call x_new_action (hx1,hx2,hy1,hy2)
if ((hx1 .eq. 0) .or. (hx2 .eq. 0)) then
done = .true.
else
diffx = xmax - xmin
diffy = ymax - ymin
xmax = (diffx * hx2) / (width - 1) + xmin
ymax = (diffy * hy2) / (height - 1) + ymin
xmin = (diffx * hx1) / (width - 1) + xmin
ymin = (diffy * hy1) / (height - 1) + ymin
end if
end do
call x_display_exit ()
deallocate (hostbild, bild)
end