better flashy mandelbrot set

This commit is contained in:
tTh
2022-12-30 02:06:00 +01:00
parent e099b398f3
commit 77ea714b19
2 changed files with 29 additions and 38 deletions

View File

@@ -1,5 +1,8 @@
!-----------------------------------------------------
! IMAGE PROCESSING
! MANDELBROT SET
!-
! refactored Thu 29 Dec 2022 03:21:16 PM CET
!-
!-----------------------------------------------------
!-
subroutine plotsomething(pic, start)
@@ -14,7 +17,7 @@ subroutine plotsomething(pic, start)
! type (CenterMag), intent(in) :: cz
integer :: ix, iy, width, height
real :: fx, fy, mod2
real :: fx, fy, mod2, rval
complex :: za, zb, cste
integer :: iter, maxiter
logical :: escape
@@ -28,7 +31,7 @@ subroutine plotsomething(pic, start)
! initialise constants
!
maxiter = 2500;
maxiter = 1984
! enter megaloop
!
@@ -37,8 +40,6 @@ subroutine plotsomething(pic, start)
!! print *, "line ", iy, fy
do ix = 1, width
fx = (float(ix) / float(width/3)) - 2.0
!! print *, "pixel ", ix, iy, " at ", fx, fy
!-------------------------------------
! working on the current pixel
za = start
@@ -47,7 +48,6 @@ subroutine plotsomething(pic, start)
escape = .FALSE.
do while (iter .lt. maxiter)
zb = (za * za) + cste
! if (modulus2(zb) .gt. 4.0) then
mod2 = real(zb)*real(zb) + aimag(zb)*aimag(zb)
!! print *, "mod2 ", mod2
if (mod2 .GT. 4.0) then
@@ -59,10 +59,11 @@ subroutine plotsomething(pic, start)
!! print *, "ZA ITER ESCAPE", za, iter, escape
enddo
if (escape) then
pic(ix, iy)%r = mod(iter*22, 255)
pic(ix, iy)%b = mod(iter*7, 255)
pic(ix, iy)%r = mod(iter*12, 255)
pic(ix, iy)%b = mod(iter*8, 255)
else
pic(ix, iy)%g = mod(int(mod2 * 555), 200)
rval = (mod2 + abs(real(start)*aimag(start))) * 666.666
pic(ix, iy)%g = mod(int(rval), 180)
! pic(ix, iy)%g = mod(iter, 255)
! pic(ix, iy)%b = mod(iter*11, 255)
endif
@@ -95,21 +96,21 @@ program mkmandel
real :: stx, sty
character (len=80) :: filename
print *, "-------- making some mandelbrot -------"
write(0, *) "-------- making some mandelbrot -------"
allocate(pic(800, 600))
allocate(pic(1152, 900))
do angle = 0, 1200
do angle = 0, 1500
call rgbpix_set_to_zero(pic)
radangle = float(angle) * 0.017453292522222
radius = float(angle) / 2000.0
radangle = float(angle) * 0.01664
radius = float(angle) / 1500.0
write (filename, "(a, i5.5, a)") "frames/mandel/", angle, ".pnm"
! filename = trim(filename)
print *, "#### passe ", angle, radangle, trim(filename)
stx = radius * sin(radangle*3.9)
stx = radius * (sin(radangle*3.9) + sin(radangle*5.36))
sty = radius * cos(radangle*3.3)
call plotsomething (pic, complex(stx, sty))