+ pickover
This commit is contained in:
parent
123c87b126
commit
0b94fae700
1
Fraktalism/.gitignore
vendored
1
Fraktalism/.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
|
||||
julia
|
||||
pickover
|
||||
|
||||
*.pgm
|
||||
*.gif
|
||||
|
@ -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 $@
|
||||
|
||||
# ---------------------------------------------
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user