tweaking the Julia's fractal
This commit is contained in:
parent
27635a0398
commit
dd552abeda
@ -6,6 +6,15 @@ Voyons d'abord
|
|||||||
[une vidéo](http://la.buvette.org/fractales/f90/video.html)
|
[une vidéo](http://la.buvette.org/fractales/f90/video.html)
|
||||||
qui montre ma première expérience dans ce domaine.
|
qui montre ma première expérience dans ce domaine.
|
||||||
|
|
||||||
|
## Trucs à voir
|
||||||
|
|
||||||
|
La fractale de Julia se porte plutôt bien.
|
||||||
|
|
||||||
|
* [mkjuliagif.sh](mkjuliagif.sh) : fabrication de la gif animée
|
||||||
|
* [julias.f90](julias.f90) : fonctions de dessin d'une Julia
|
||||||
|
* [mkjulia.f90](mkjulia.f90) : le programme principal
|
||||||
|
|
||||||
|
|
||||||
## La technique
|
## La technique
|
||||||
|
|
||||||
Le gros des calculs de fractales est fait dans `mods/fraktals.f90`,
|
Le gros des calculs de fractales est fait dans `mods/fraktals.f90`,
|
||||||
@ -34,7 +43,7 @@ Generally writen as a *sequencial unformated* file.
|
|||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- Voir de près le calcul du cadrage
|
- Voir de près le calcul du cadrage : [centermag](../Modules/centermag.f90)
|
||||||
- Rajouter des formules
|
- Rajouter des formules
|
||||||
- Ne pas procastiner sur le reste
|
- Ne pas procastiner sur le reste
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
module julias
|
module julias
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
contains
|
contains
|
||||||
|
|
||||||
@ -42,13 +43,14 @@ subroutine simple_julia(pic, cx, cy, maxiter)
|
|||||||
if (over_iter) then
|
if (over_iter) then
|
||||||
pic(ix, iy) = 0
|
pic(ix, iy) = 0
|
||||||
else
|
else
|
||||||
pic(ix, iy) = iter*12
|
pic(ix, iy) = mod(iter*13, 256)
|
||||||
endif
|
endif
|
||||||
enddo ! iy
|
enddo ! iy
|
||||||
enddo ! ix
|
enddo ! ix
|
||||||
|
|
||||||
end subroutine simple_julia
|
end subroutine simple_julia
|
||||||
!===============================================================
|
!===============================================================
|
||||||
|
|
||||||
subroutine julia_colormapped(pic, cx, cy, maxiter)
|
subroutine julia_colormapped(pic, cx, cy, maxiter)
|
||||||
use pixrgb
|
use pixrgb
|
||||||
type(t_pixrgb), intent(inout), dimension (:,:) :: pic
|
type(t_pixrgb), intent(inout), dimension (:,:) :: pic
|
||||||
@ -64,11 +66,11 @@ subroutine julia_colormapped(pic, cx, cy, maxiter)
|
|||||||
width = ubound(pic, 1)
|
width = ubound(pic, 1)
|
||||||
height = ubound(pic, 2)
|
height = ubound(pic, 2)
|
||||||
C = complex(cx, cy)
|
C = complex(cx, cy)
|
||||||
print *, "Color julia, const = ", C
|
! print *, "Color julia, const = ", C
|
||||||
do ix = 1, width
|
do ix = 1, width
|
||||||
fx = (float(ix) / (float(width*2)/4.0) - 1.0)
|
fx = (float(ix) / (float(width*2)/10.0) - 2.5)
|
||||||
do iy = 1, height
|
do iy = 1, height
|
||||||
fy = (float(iy) / (float(height*2)/4.0) - 1.0)
|
fy = (float(iy) / (float(height*2)/10.0) - 2.5)
|
||||||
! ------ traitement du pixel
|
! ------ traitement du pixel
|
||||||
iter = 0 ; over_iter = .FALSE.
|
iter = 0 ; over_iter = .FALSE.
|
||||||
Z = complex(fx, fy)
|
Z = complex(fx, fy)
|
||||||
@ -85,9 +87,9 @@ subroutine julia_colormapped(pic, cx, cy, maxiter)
|
|||||||
pic(ix, iy)%g = mod(abs(int(real(Z) *140)), 255)
|
pic(ix, iy)%g = mod(abs(int(real(Z) *140)), 255)
|
||||||
pic(ix, iy)%b = mod(abs(int(aimag(Z)*140)), 255)
|
pic(ix, iy)%b = mod(abs(int(aimag(Z)*140)), 255)
|
||||||
else
|
else
|
||||||
pic(ix, iy)%r = mod(iter*33, 255)
|
pic(ix, iy)%r = mod(iter*22, 255)
|
||||||
pic(ix, iy)%g = mod(iter*59, 255)
|
pic(ix, iy)%g = mod(iter*59, 255)
|
||||||
pic(ix, iy)%b = mod(iter*41, 255)
|
pic(ix, iy)%b = mod(iter*21, 255)
|
||||||
endif
|
endif
|
||||||
enddo ! iy
|
enddo ! iy
|
||||||
enddo ! ix
|
enddo ! ix
|
||||||
|
@ -28,9 +28,13 @@ program julia
|
|||||||
|
|
||||||
allocate(picz(512, 342))
|
allocate(picz(512, 342))
|
||||||
|
|
||||||
call julia_colormapped(picz, cx, cy, 500)
|
call julia_colormapped(picz, cx, cy, 2500)
|
||||||
call rgbpix_spit_as_pnm_8(picz, trim(filename))
|
call rgbpix_spit_as_pnm_8(picz, trim(filename))
|
||||||
|
|
||||||
|
contains
|
||||||
|
|
||||||
|
!-----------------------------------------------------
|
||||||
|
|
||||||
end program
|
end program
|
||||||
|
|
||||||
!-----------------------------------------------------
|
!-----------------------------------------------------
|
||||||
|
@ -11,28 +11,41 @@ if [ $? -ne 0 ] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cxa=" -1.5 "
|
||||||
|
cya=" -1.0 "
|
||||||
|
cxb=" 1.1 "
|
||||||
|
cyb=" 2.1 "
|
||||||
|
nbi=" 180 "
|
||||||
|
|
||||||
#
|
#
|
||||||
# run the prog
|
# run the prog
|
||||||
#
|
#
|
||||||
workdir="frames/julia/"
|
workdir="frames/julia/"
|
||||||
for foo in $(seq 0 179)
|
for foo in $( seq 0 $(( nbi - 1)) )
|
||||||
do
|
do
|
||||||
|
|
||||||
img=$(printf "%s/%05d.pnm" $workdir $foo)
|
img=$(printf "%s/%05d.pnm" $workdir $foo)
|
||||||
bar=$(echo "$foo / 247.0" | bc -l)
|
|
||||||
cx=$(echo "0.5 * (1.52*c($foo/28.0))" | bc -l)
|
|
||||||
cy=$(echo "0.5 * (1.45*s($foo/17.0))" | bc -l)
|
|
||||||
|
|
||||||
|
Ka=$( echo "$foo / $nbi" | bc -l)
|
||||||
|
Kb=$( echo "1.0 - $Ka" | bc -l)
|
||||||
|
# echo $Ka $Kb
|
||||||
|
cx=$(echo "($cxa*$Ka) + ($cxb*$Kb)" | bc -l)
|
||||||
|
cy=$(echo "$cya*$Ka + $cyb*$Kb" | bc -l)
|
||||||
|
|
||||||
|
printf "%5d %4.6f %4.6f %4.6f %4.6f\n" \
|
||||||
|
$foo $Ka $Kb $cx $cy
|
||||||
./mkjulia $img $cx $cy
|
./mkjulia $img $cx $cy
|
||||||
|
|
||||||
sleep 145
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
./tagpicz.sh $workdir
|
mogrify \
|
||||||
|
-gravity South-East \
|
||||||
|
-font Courier-Bold \
|
||||||
|
-pointsize 12 \
|
||||||
|
-fill Black \
|
||||||
|
-annotate +10+4 "Konrad+tTh 2024" \
|
||||||
|
"${workdir}/*.pnm"
|
||||||
|
|
||||||
echo ; echo "Encoding, please wait..."
|
echo ; echo "Encoding, please wait..."
|
||||||
|
|
||||||
convert -delay 10 $workdir/*.pnm color-julia.gif
|
convert -delay 10 $workdir/*.pnm color-julia.gif
|
||||||
# animate foo.gif &
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user