trying to make a gif89a...
This commit is contained in:
parent
a41a630889
commit
123c87b126
1
Fraktalism/.gitignore
vendored
1
Fraktalism/.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
julia
|
julia
|
||||||
|
|
||||||
*.pgm
|
*.pgm
|
||||||
|
*.gif
|
||||||
|
@ -3,24 +3,24 @@ module fraktals
|
|||||||
contains
|
contains
|
||||||
|
|
||||||
!-----------------------------------------------------
|
!-----------------------------------------------------
|
||||||
subroutine simple_julia(pic, cx, cy)
|
subroutine simple_julia(pic, cx, cy, maxiter)
|
||||||
implicit none
|
implicit none
|
||||||
integer, intent(inout), dimension (:,:) :: pic
|
integer, intent(inout), dimension (:,:) :: pic
|
||||||
real, intent(in) :: cx, cy
|
real, intent(in) :: cx, cy
|
||||||
|
integer, intent(in) :: maxiter
|
||||||
|
|
||||||
integer :: ix, iy, width, height
|
integer :: ix, iy, width, height
|
||||||
real :: fx, fy
|
real :: fx, fy
|
||||||
complex :: Z, C
|
complex :: Z, C
|
||||||
integer :: iter, maxiter
|
integer :: iter
|
||||||
|
|
||||||
width = ubound(pic, 1)
|
width = ubound(pic, 1)
|
||||||
height = ubound(pic, 2)
|
height = ubound(pic, 2)
|
||||||
print *, "image size : ", width, height
|
! print *, "image size : ", width, height
|
||||||
! print *, "constante : ", cx, cy
|
! print *, "constante : ", cx, cy
|
||||||
|
|
||||||
maxiter = 500
|
|
||||||
C = complex(cx, cy)
|
C = complex(cx, cy)
|
||||||
print *, "C = ", C
|
! print *, "C = ", C
|
||||||
|
|
||||||
do ix = 1, width
|
do ix = 1, width
|
||||||
fx = (float(ix) / (float(width)/4.0) - 2.0)
|
fx = (float(ix) / (float(width)/4.0) - 2.0)
|
||||||
|
@ -12,18 +12,20 @@ program julia
|
|||||||
|
|
||||||
integer, dimension(640, 480) :: picz
|
integer, dimension(640, 480) :: picz
|
||||||
integer :: argc
|
integer :: argc
|
||||||
character(200) :: filename
|
character(200) :: filename, string
|
||||||
|
real :: cx, cy
|
||||||
|
|
||||||
argc = IARGC()
|
argc = IARGC()
|
||||||
|
if (3 .NE. argc) then
|
||||||
if (1 .NE. argc) then
|
STOP ": JULIA PROGGY NEED PARAMETERS"
|
||||||
STOP ": JULIA PROGGY NEED A FILENAME"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call getarg(1, filename)
|
call getarg(1, filename)
|
||||||
|
call getarg(2, string) ; read (string, *) cx
|
||||||
|
call getarg(3, string) ; read (string, *) cy
|
||||||
|
|
||||||
call simple_julia(picz, 0.3, 0.6)
|
call simple_julia(picz, cx, cy, 120)
|
||||||
call spit_as_pgm(picz, trim(filename))
|
call spit_as_pgm_8(picz, trim(filename))
|
||||||
|
|
||||||
end program
|
end program
|
||||||
|
|
||||||
|
18
Fraktalism/mkjuliagif.sh
Executable file
18
Fraktalism/mkjuliagif.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for foo in $(seq 0 39)
|
||||||
|
do
|
||||||
|
|
||||||
|
img=$(printf "frames/%05d.pgm" $foo)
|
||||||
|
bar=$(echo "$foo / 147.0" | bc -l)
|
||||||
|
cx=$(echo "0.4 * c($foo)" | bc -l)
|
||||||
|
cy=$(echo "0.4 * s($foo*2)" | bc -l)
|
||||||
|
|
||||||
|
./julia $img $cx $cy
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ; echo "Encoding, please wait..."
|
||||||
|
|
||||||
|
convert -delay 10 frames/*.pgm foo.gif
|
||||||
|
|
@ -8,8 +8,6 @@ module spitpgm
|
|||||||
|
|
||||||
subroutine spit_as_pgm(pic, fname)
|
subroutine spit_as_pgm(pic, fname)
|
||||||
|
|
||||||
! implicit none
|
|
||||||
|
|
||||||
integer, intent(in), dimension (:,:) :: pic
|
integer, intent(in), dimension (:,:) :: pic
|
||||||
character (len=*), intent(in) :: fname
|
character (len=*), intent(in) :: fname
|
||||||
|
|
||||||
@ -25,7 +23,6 @@ subroutine spit_as_pgm(pic, fname)
|
|||||||
write (io, '(i0)') 65535
|
write (io, '(i0)') 65535
|
||||||
|
|
||||||
foo = MAXVAL(pic)
|
foo = MAXVAL(pic)
|
||||||
|
|
||||||
if (foo .EQ. 0) then
|
if (foo .EQ. 0) then
|
||||||
print *, " IS SOMETHING WRONG GOING TO HAPPEN ?"
|
print *, " IS SOMETHING WRONG GOING TO HAPPEN ?"
|
||||||
do ix = 1, size(pic)
|
do ix = 1, size(pic)
|
||||||
@ -41,7 +38,33 @@ subroutine spit_as_pgm(pic, fname)
|
|||||||
end do
|
end do
|
||||||
end do
|
end do
|
||||||
endif
|
endif
|
||||||
|
close(io)
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
!-----------------------------------------------------
|
||||||
|
subroutine spit_as_pgm_8(pic, fname)
|
||||||
|
|
||||||
|
integer, intent(in), dimension (:,:) :: pic
|
||||||
|
character (len=*), intent(in) :: fname
|
||||||
|
|
||||||
|
integer :: io, foo
|
||||||
|
integer :: ix, iy
|
||||||
|
|
||||||
|
print *, "> spit_as_pgm_8 to ", fname
|
||||||
|
foo = MAXVAL(pic)
|
||||||
|
print *, " max = ", foo
|
||||||
|
open(newunit=io, file=fname)
|
||||||
|
write (io, '(a2)') "P2"
|
||||||
|
write (io, '(i0," ",i0)') size(pic, 1), size(pic, 2)
|
||||||
|
write (io, '(i0)') 255
|
||||||
|
|
||||||
|
do iy=1,ubound(pic, 2)
|
||||||
|
do ix=1, ubound(pic, 1)
|
||||||
|
foo = pic(ix, iy)
|
||||||
|
if (foo .GT. 255) foo = 255
|
||||||
|
write(io, "(i3)") foo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
close(io)
|
close(io)
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
Loading…
Reference in New Issue
Block a user