X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=visualize;fp=visualize;h=b85b83939134cfd6a54ecf9e08f85feabe29539b;hb=c1f74e23422d004f7b9d2493cc747871c7ebfbae;hp=0000000000000000000000000000000000000000;hpb=e1348f10aff2c0bb1040108181d13fcb48db5af2;p=physik%2Fposic.git diff --git a/visualize b/visualize new file mode 100755 index 0000000..b85b839 --- /dev/null +++ b/visualize @@ -0,0 +1,70 @@ +#!/bin/sh + +if [ ! -d $1 ] ; then + echo "no such directory -> $1" + exit +fi + +POVRAY="povray -W1024 -H768 -d" + +echo "processing $1 ..." + +for file in $1/povray_*.in ; do + cat > temp.pov <<-EOF +#include "colors.inc" +#include "textures.inc" +#include "shapes.inc" +#include "glass.inc" +#include "metals.inc" +#include "woods.inc" +#include "stones.inc" +EOF + + # meta info + count=`grep '# \[C\]' $file | awk '{ print $3 }'` + time=`grep '# \[T\]' $file | awk '{ print $3 }'` + camloc=`grep '# \[L\]' $file | awk '{ print $3 }'` + + # atoms + cat $file | grep -v '#' | while read radius x y z ; do #temp dis; do + cat >> temp.pov <<-EOF +sphere { + <$x, $z, $y>, $radius + texture { + pigment { color Yellow } + finish { + phong 1 + metallic + } + } +} +EOF + done + + # boundaries + cat $file | grep '# \[D\]' | while read foo bar x1 y1 z1 x2 y2 z2 ; do + cat >> temp.pov <<-EOF +cylinder { + <$x1, $z1, $y1>, <$x2, $z2, $y2>, 0.05 + pigment { color White } +} +EOF + done + + # add camera and light source + cat >> temp.pov <<-EOF +camera { +// orthographic + location $camloc + look_at <0,0,0> +} +light_source { <0,10000,0> color White shadowless } +EOF + + # mv png + $POVRAY temp.pov > /dev/null 2>&1 + mv temp.png `echo $file | sed 's/\.in/\.png/'` + +done + +echo "done"