From 0b94fae700a683da244a4b5b90ae73cb0b1f5a17 Mon Sep 17 00:00:00 2001 From: tth Date: Mon, 14 Feb 2022 14:15:10 +0100 Subject: [PATCH] + pickover --- Fraktalism/.gitignore | 1 + Fraktalism/Makefile | 3 +++ Fraktalism/fraktals.f90 | 60 ++++++++++++++++++++++++++++++++++------- Fraktalism/julia.f90 | 6 ++--- Fraktalism/spitpgm.f90 | 6 ++--- 5 files changed, 60 insertions(+), 16 deletions(-) diff --git a/Fraktalism/.gitignore b/Fraktalism/.gitignore index 2da08a4..f75e05b 100644 --- a/Fraktalism/.gitignore +++ b/Fraktalism/.gitignore @@ -1,5 +1,6 @@ julia +pickover *.pgm *.gif diff --git a/Fraktalism/Makefile b/Fraktalism/Makefile index d61be39..a5bd74b 100644 --- a/Fraktalism/Makefile +++ b/Fraktalism/Makefile @@ -16,4 +16,7 @@ OBJS = spitpgm.o fraktals.o julia: julia.f90 Makefile $(OBJS) gfortran $(GFOPT) $< $(OBJS) -o $@ +pickover: pickover.f90 Makefile $(OBJS) + gfortran $(GFOPT) $< $(OBJS) -o $@ + # --------------------------------------------- diff --git a/Fraktalism/fraktals.f90 b/Fraktalism/fraktals.f90 index 4efcac6..866ec55 100644 --- a/Fraktalism/fraktals.f90 +++ b/Fraktalism/fraktals.f90 @@ -13,14 +13,13 @@ subroutine simple_julia(pic, cx, cy, maxiter) real :: fx, fy complex :: Z, C integer :: iter + logical :: over_iter width = ubound(pic, 1) height = ubound(pic, 2) - ! print *, "image size : ", width, height - ! print *, "constante : ", cx, cy C = complex(cx, cy) - ! print *, "C = ", C + print *, "Const = ", C do ix = 1, width fx = (float(ix) / (float(width)/4.0) - 2.0) @@ -28,24 +27,65 @@ subroutine simple_julia(pic, cx, cy, maxiter) fy = (float(iy) / (float(height)/4.0) - 2.0) ! ------ traitement du pixel - iter = 0 + iter = 0 ; over_iter = .FALSE. Z = complex(fx, fy) - do while ( (modulus2(Z) .LT. 4.0) .AND. & - (iter < maxiter) ) + do while (modulus2(Z) .LT. 4.0) + Z = (Z * Z) + C iter = iter + 1 + if (iter .GE. maxiter) then + over_iter = .TRUE. + exit + endif + end do - pic(ix, iy) = iter - - ! print *, ix, iy, " ", fx, fy, " ", iter + if (over_iter) then + pic(ix, iy) = 0 + else + pic(ix, iy) = iter + endif enddo enddo -end subroutine +end subroutine simple_julia !----------------------------------------------------- +! +! +! +subroutine pickover_0(pic, count) + implicit none + integer, intent(inout), dimension (:,:) :: pic + integer, intent(in) :: count + + double precision :: xa, ya, za, xb, yb, zb + double precision :: ka, kb, kc, kd + integer :: i, px, py + + ka = 2.24 ; kb = 0.43 ; kc = -0.65 ; kd = -2.43 + + xa = 0.00 ; ya = 0.00 ; za = 0.0 + + + do i=1, count + + xb = sin(ka*ya) - za*cos(kb*xa) + yb = za*sin(kc*xa) - cos(kd*ya) + zb = sin(xa) + + print *, i, xb, yb, zb + + xa = xb ; ya = yb ; za = zb + + enddo + +end subroutine pickover_0 +!----------------------------------------------------- +! -- some support functions -- +!----------------------------------------------------- + function dist0 (x, y) implicit none real, intent(in) :: x, y diff --git a/Fraktalism/julia.f90 b/Fraktalism/julia.f90 index 1843e58..5ab7694 100644 --- a/Fraktalism/julia.f90 +++ b/Fraktalism/julia.f90 @@ -10,21 +10,21 @@ program julia implicit none - integer, dimension(640, 480) :: picz + integer, dimension(512, 342) :: picz integer :: argc character(200) :: filename, string real :: cx, cy argc = IARGC() if (3 .NE. argc) then - STOP ": JULIA PROGGY NEED PARAMETERS" + STOP ": JULIA PROGGY NEED PARAMETERS !" endif call getarg(1, filename) call getarg(2, string) ; read (string, *) cx call getarg(3, string) ; read (string, *) cy - call simple_julia(picz, cx, cy, 120) + call simple_julia(picz, cx, cy, 250) call spit_as_pgm_8(picz, trim(filename)) end program diff --git a/Fraktalism/spitpgm.f90 b/Fraktalism/spitpgm.f90 index f162992..f39e4f5 100644 --- a/Fraktalism/spitpgm.f90 +++ b/Fraktalism/spitpgm.f90 @@ -15,7 +15,7 @@ subroutine spit_as_pgm(pic, fname) integer :: ix, iy real :: fk, fpix - print *, "> spit_as_pgm to ", fname + ! XXX print *, "> spit_as_pgm to ", fname open(newunit=io, file=fname) write (io, '(a2)') "P2" @@ -50,9 +50,9 @@ subroutine spit_as_pgm_8(pic, fname) integer :: io, foo integer :: ix, iy - print *, "> spit_as_pgm_8 to ", fname + ! XXX print *, "> spit_as_pgm_8 to ", fname foo = MAXVAL(pic) - print *, " max = ", foo + ! XXX print *, " max = ", foo open(newunit=io, file=fname) write (io, '(a2)') "P2" write (io, '(i0," ",i0)') size(pic, 1), size(pic, 2)