From c6f6ed48a479c4e8d87093397c9e54c3ff6f47e9 Mon Sep 17 00:00:00 2001 From: tTh Date: Tue, 27 Dec 2022 01:29:04 +0100 Subject: [PATCH] a running color mandelbrot --- Fraktalism/.gitignore | 1 + Fraktalism/Makefile | 2 +- Fraktalism/mkmandel.f90 | 52 +++++++++++++++++++---------------------- 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/Fraktalism/.gitignore b/Fraktalism/.gitignore index e69b8b9..597b4b3 100644 --- a/Fraktalism/.gitignore +++ b/Fraktalism/.gitignore @@ -2,6 +2,7 @@ julia pickover lorentz +mkmandel voxelize evolvopick henon diff --git a/Fraktalism/Makefile b/Fraktalism/Makefile index 9be6a97..64c4f63 100644 --- a/Fraktalism/Makefile +++ b/Fraktalism/Makefile @@ -17,7 +17,7 @@ fraktals.o: fraktals.f90 Makefile gfortran $(GFOPT) -c $< OBJDEP = mods/points3d.o mods/xperiment.o fraktals.o mods/fractcolmap.o -OBJS = $(OBJDEP) ../Modules/spitpgm.o +OBJS = $(OBJDEP) ../Modules/pixrgb.o ../Modules/spitpgm.o # --------------------------------------------- diff --git a/Fraktalism/mkmandel.f90 b/Fraktalism/mkmandel.f90 index c43c4bf..7676cb8 100644 --- a/Fraktalism/mkmandel.f90 +++ b/Fraktalism/mkmandel.f90 @@ -3,15 +3,16 @@ !----------------------------------------------------- !----------------------------------------------------- -subroutine plotsomething(pic, start, cz) +subroutine plotsomething(pic, start) ! use cmplxmath ! use imagetools + use pixrgb implicit none - integer, intent(inout), dimension (:,:) :: pic - complex, intent(in) :: start - type (CenterMag), intent(in) :: cz + type(t_pixrgb), intent(inout), dimension (:,:) :: pic + complex, intent(in) :: start + ! type (CenterMag), intent(in) :: cz integer :: ix, iy, width, height real :: fx, fy, mod2 @@ -25,7 +26,7 @@ subroutine plotsomething(pic, start, cz) height = ubound(pic, 2) print *, " pic size ", width, height print *, " start ", start - call print_centermag(cz) + ! call print_centermag(cz) ! initialise constants ! @@ -61,11 +62,11 @@ subroutine plotsomething(pic, start, cz) enddo if (escape) then - pic(ix, iy) = mod(iter, 333) + pic(ix, iy)%r = mod(iter, 255) + pic(ix, iy)%b = mod(iter*7, 255) else - ! esoteric computation here - ! pic(ix, iy) = mod(8*floor(mod2*11.11), 24) - pic(ix, iy) = mod(iter, 222) + pic(ix, iy)%g = mod(iter, 255) + pic(ix, iy)%b = mod(iter*11, 255) endif !------------------------------------- end do ! fin boucle sur X @@ -79,51 +80,46 @@ end ! this is the main programm ! program mkmandel - - use imagetools + use pixrgb implicit none interface - subroutine plotsomething (pic, start, cz) - use imagetools - integer, intent(inout), dimension (:,:) :: pic - complex, intent(in) :: start - type (CenterMag), intent(in) :: cz + subroutine plotsomething (pic, start) + use pixrgb + type(t_pixrgb), intent(inout), dimension (:,:) :: pic + complex, intent(in) :: start end subroutine plotsomething end interface - integer, dimension(512, 512) :: picz - type (CenterMag) :: cm + type(t_pixrgb), allocatable :: pic(:,:) integer :: angle real :: radangle, radius real :: stx, sty character (len=80) :: filename - cm%cx = 0.0 ; cm%cy = 0.0 ; cm%mag = 3.0 - picz = 0 ! clear screen - print *, "-------- making some mandelbrot -------" - do angle = 0, 1800 + allocate(pic(512, 342)) + + do angle = 0, 600 + call rgbpix_set_to_zero(pic) radangle = float(angle) * 0.017453292522222 radius = float(angle) / 2000.0 - write (filename, "(a, i5.5, a)") "img/", angle, ".pnm" + write (filename, "(a, i5.5, a)") "frames/mandel/", angle, ".pnm" ! filename = trim(filename) print *, "#### passe ", angle, radangle, trim(filename) stx = radius * sin(radangle*4.0) sty = radius * cos(radangle*3.0) - call plotsomething (picz, complex(stx, sty), cm) - call spitaspnm (picz, trim(filename)) - + call plotsomething (pic, complex(stx, sty)) + call rgbpix_spit_as_pnm_8 (pic, trim(filename)) print * - enddo - print *, "[DONE]" + print *, " [DONE]" end