mandelbrot/run.sh

48 lines
1.3 KiB
Bash
Raw Normal View History

2013-06-27 01:34:56 +00:00
#!/bin/sh
2013-06-28 14:45:40 +00:00
if [ $# -ne 8 ]; then
echo "usage: $0 startmag endmag frames method width height centerx centery"
echo ""
echo " startmag start magnification"
echo " endmag end magnification"
echo " frames number of frames to generate over the magnification range"
echo " method name of executable to use for mandelbrot generation"
echo " width width of the images"
echo " height height of the images"
echo " centerx x zoom coordinate"
echo " centery y zoom coordinate"
echo ""
echo "example:"
echo ""
echo " $0 1.0 1.0e+30 14400 mandel_dd_aa 1920 1080 -0.743643887037158704752191506114774 0.131825904205311970493132056385139"
exit
fi
2013-06-27 01:34:56 +00:00
2013-06-28 14:45:40 +00:00
start="$1"
end="$2"
frames="$3"
method="$4"
width="$5"
height="$6"
centerx="$7"
centery="$8"
2013-06-27 01:34:56 +00:00
2013-06-28 14:45:40 +00:00
magn=`python -c "from math import pow; fac = pow($end / $start, 1.0 / ($frames - 1)); print \"\\n\".join([ str($start * pow(fac, i-1)) for i in range(1, $frames + 1)])"`
2013-06-27 01:34:56 +00:00
i=0
for mag in $magn; do
2013-06-28 14:45:40 +00:00
pngname=`printf "out_%05d.png" $i`
2013-06-28 05:34:40 +00:00
if [ -s "$pngname" ]; then
i=$((i+1))
continue
fi
echo $i $mag
2013-06-28 14:45:40 +00:00
fname=`printf "out_%05d.ppm" $i`
/usr/bin/time -f "%e s" "./$method" $width $height $centerx $centery $mag > "$fname"
2013-06-28 05:34:40 +00:00
convert "$fname" -format png "$pngname"
2013-06-28 14:45:40 +00:00
optipng -o4 -i0 "$pngname" > /dev/null 2>&1
advpng -z4 "$pngname" > /dev/null 2>&1
2013-06-28 05:34:40 +00:00
rm "$fname"
2013-06-27 01:34:56 +00:00
i=$((i+1))
done