nice work done on Julia set
This commit is contained in:
parent
0e73e47272
commit
b707b784bf
@ -12,13 +12,34 @@ SDIR="$1"
|
||||
FNAME="$2"
|
||||
echo "Encoding from " $SDIR " to " $FNAME
|
||||
|
||||
#
|
||||
# trying to guess the format of inoput files
|
||||
#
|
||||
firstfile=$(ls -1 $SDIR/* | head -1)
|
||||
echo "first file :" $firstfile
|
||||
filetype=$(file $firstfile | awk '{ print $2 }')
|
||||
echo "file type :" $filetype
|
||||
|
||||
#
|
||||
# this is BOGUS, replace file by identify ?
|
||||
#
|
||||
case $filetype in
|
||||
PNG) extension=".png" ;;
|
||||
Netpbm) extension=".pgm" ;;
|
||||
*) extension=".binary" ;;
|
||||
esac
|
||||
echo "extension :" $extension
|
||||
|
||||
|
||||
|
||||
TITLE='---{ experimental }---'
|
||||
|
||||
ffmpeg -nostdin \
|
||||
-loglevel warning \
|
||||
-y -r 25 -f image2 -i $SDIR/%05d.png \
|
||||
-y -r 30 -f image2 -i $SDIR/%05d.pnm \
|
||||
-metadata artist='---{ tTh }---' \
|
||||
-metadata title="${TITLE}" \
|
||||
-preset veryslow \
|
||||
-c:v libx264 -pix_fmt yuv420p \
|
||||
$FNAME
|
||||
|
||||
|
@ -13,7 +13,7 @@ subroutine simple_julia(pic, cx, cy, maxiter)
|
||||
integer, intent(in) :: maxiter
|
||||
|
||||
integer :: ix, iy, width, height
|
||||
real :: fx, fy, fv
|
||||
real :: fx, fy
|
||||
complex :: Z, C
|
||||
integer :: iter
|
||||
logical :: over_iter
|
||||
@ -49,4 +49,49 @@ subroutine simple_julia(pic, cx, cy, maxiter)
|
||||
|
||||
end subroutine simple_julia
|
||||
!===============================================================
|
||||
subroutine julia_colormapped(pic, cx, cy, maxiter)
|
||||
use pixrgb
|
||||
type(t_pixrgb), intent(inout), dimension (:,:) :: pic
|
||||
real, intent(in) :: cx, cy
|
||||
integer, intent(in) :: maxiter
|
||||
|
||||
integer :: ix, iy, width, height
|
||||
real :: fx, fy
|
||||
complex :: Z, C
|
||||
integer :: iter
|
||||
logical :: over_iter
|
||||
|
||||
width = ubound(pic, 1)
|
||||
height = ubound(pic, 2)
|
||||
C = complex(cx, cy)
|
||||
print *, "Color julia, const = ", C
|
||||
do ix = 1, width
|
||||
fx = (float(ix) / (float(width*2)/4.0) - 1.0)
|
||||
do iy = 1, height
|
||||
fy = (float(iy) / (float(height*2)/4.0) - 1.0)
|
||||
! ------ traitement du pixel
|
||||
iter = 0 ; over_iter = .FALSE.
|
||||
Z = complex(fx, fy)
|
||||
do while ((real(Z)*real(Z) + imag(Z)*imag(Z)) .LT. 4.0)
|
||||
Z = (Z * Z) + C
|
||||
iter = iter + 1
|
||||
if (iter .GE. maxiter) then
|
||||
over_iter = .TRUE.
|
||||
exit
|
||||
endif
|
||||
end do
|
||||
if (over_iter) then
|
||||
pic(ix, iy)%r = 0
|
||||
pic(ix, iy)%g = mod(abs(int(real(Z) *140)), 255)
|
||||
pic(ix, iy)%b = mod(abs(int(aimag(Z)*140)), 255)
|
||||
else
|
||||
pic(ix, iy)%r = mod(iter*33, 255)
|
||||
pic(ix, iy)%g = mod(iter*29, 255)
|
||||
pic(ix, iy)%b = mod(iter*21, 255)
|
||||
endif
|
||||
enddo ! iy
|
||||
enddo ! ix
|
||||
|
||||
end subroutine
|
||||
!===============================================================
|
||||
end module
|
||||
|
@ -8,10 +8,11 @@ program julia
|
||||
|
||||
use spitpgm
|
||||
use JULIAS
|
||||
use PIXRGB
|
||||
|
||||
implicit none
|
||||
|
||||
integer, dimension(640, 480) :: picz
|
||||
type(t_pixrgb), allocatable :: picz(:,:)
|
||||
integer :: argc
|
||||
character(200) :: filename, string
|
||||
real :: cx, cy
|
||||
@ -25,8 +26,10 @@ program julia
|
||||
call getarg(2, string) ; read (string, *) cx
|
||||
call getarg(3, string) ; read (string, *) cy
|
||||
|
||||
call simple_julia(picz, cx, cy, 3500)
|
||||
call spit_as_pgm_8(picz, trim(filename))
|
||||
allocate(picz(640, 480))
|
||||
|
||||
call julia_colormapped(picz, cx, cy, 500)
|
||||
call rgbpix_spit_as_pnm_8(picz, trim(filename))
|
||||
|
||||
end program
|
||||
|
||||
|
@ -14,20 +14,23 @@ fi
|
||||
#
|
||||
# run the prog
|
||||
#
|
||||
for foo in $(seq 0 99)
|
||||
workdir="frames/julia/"
|
||||
for foo in $(seq 0 179)
|
||||
do
|
||||
|
||||
img=$(printf "frames/julia/%05d.pgm" $foo)
|
||||
img=$(printf "%s/%05d.pnm" $workdir $foo)
|
||||
bar=$(echo "$foo / 247.0" | bc -l)
|
||||
cx=$(echo "0.7 * (2.72*c($foo/3))" | bc -l)
|
||||
cy=$(echo "0.5 * (1.45+s($foo/2))" | 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)
|
||||
|
||||
./mkjulia $img $cx $cy
|
||||
|
||||
done
|
||||
|
||||
./tagpicz.sh $workdir
|
||||
|
||||
echo ; echo "Encoding, please wait..."
|
||||
|
||||
convert -delay 10 frames/julia/*.pgm foo.gif
|
||||
convert -delay 10 $workdir/*.pnm color-julia.gif
|
||||
# animate foo.gif &
|
||||
|
||||
|
27
Fraktalism/tagpicz.sh
Executable file
27
Fraktalism/tagpicz.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# THIS IS JUST A QUICK'N'DIRTY HACK !
|
||||
# DO NOT USE IT IN REAL LIFE !
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
SDIR="frames/spool/"
|
||||
if [ $# -eq 1 ] ; then
|
||||
SDIR="$1"
|
||||
fi
|
||||
|
||||
for img in $SDIR/*.pnm
|
||||
do
|
||||
|
||||
mogrify \
|
||||
-gravity South-East \
|
||||
-font Courier \
|
||||
-pointsize 12 \
|
||||
-fill Yellow \
|
||||
-annotate +10+10 "tTh 2023" \
|
||||
$img
|
||||
echo "tagging " $img
|
||||
|
||||
done
|
Loading…
Reference in New Issue
Block a user