--- ray/src/util/dayfact.csh 1991/06/05 10:04:24 1.1 +++ ray/src/util/dayfact.csh 1991/11/12 17:19:31 2.1 @@ -8,18 +8,14 @@ set genskyf=$nofile set octree=$nofile set dfpict=$nofile set ilpict=$nofile +set fcopts=($*) set wporig=(0 0 0) set wpsize=(1 1) set rtargs=(-ab 1 -ad 256 -as 128 -aa .15 -av .1 .1 .1) +set maxres=128 -set maxres=64 -set iltemp=/usr/tmp/il$$.pic -set tempfiles=($iltemp) - alias readvar 'echo -n Enter \!:1 "[$\!:1]: ";set ans="$<";if("$ans" != "")set \!:1="$ans"' -onintr quit - cat <<_EOF_ DAYLIGHT FACTOR CALCULATION @@ -31,21 +27,22 @@ or more color Radiance pictures. _EOF_ readvar octree if ( "$octree" == "$nofile" || ! -f "$octree" ) then - echo "You must first create an octree with oconv" - echo "before running this script." + echo "You must first create an octree with" + echo "oconv before running this script." exit 1 endif -echo "" +set title="$octree:r" echo "In what scene file is the gensky command located?" readvar genskyf -if ( "$genskyf" == "$none" || ! -r "$genskyf" ) then - echo "You will not be able to compute" - echo "daylight factors without a gensky file" +if ( "$genskyf" == "$nofile" || ! -r "$genskyf" ) then + echo "You will not be able to compute daylight" + echo "factors since there is no gensky file." else + set title=$title\ `sed -n 's/^.*gensky *\([0-9][0-9]* *[0-9][0-9]* *[0-9][0-9.]*\).*$/\1/p' $genskyf` set extamb=`xform -e $genskyf|sed -n 's/^# Ground ambient level: //p'` endif -echo "Is the z-axis your zenith direction?" -if ( "$ans" !~ [yY]* ) then +echo -n "Is the z-axis your zenith direction? " +if ( "$<" !~ [yY]* ) then echo "I'm sorry, you cannot use this script" exit 1 endif @@ -53,12 +50,12 @@ echo "What is the origin (smallest x y z coordinates) readvar wporig set wporig=($wporig) echo "What is the x and y size (width and length) of the workplane?" -read wpsize +readvar wpsize set wpsize=($wpsize) set wpres=(`rcalc -n -e '$1=if(l,'"floor($maxres*$wpsize[1]/$wpsize[2]),$maxres);"'$2=if(l,'"$maxres,floor($maxres*$wpsize[2]/$wpsize[1]));l=$wpsize[2]-$wpsize[1]"`) set rtargs=($rtargs -ar `getinfo -d<$octree|rcalc -e '$1=floor(16*$4/'"($wpsize[1]+$wpsize[2]))"`) echo "What calculation options do you want to give to rtrace?" -echo "(It is very important to set the -a? options correctly.)" +echo "(It is very important to set the -a* options correctly.)" readvar rtargs echo "Illuminance contour picture if you want one" readvar ilpict @@ -70,23 +67,38 @@ if ( "$ilpict" == "$nofile" && "$dfpict" == "$nofile" echo "Since you don't want any output, I guess we're done." exit 0 endif -echo "Starting rtrace calculation -- this will take some time..." -cnt $wpres | rcalc -e '$1=($1+.5)/'"$wpres[1]*$wpsize[1]+$wporig[1]" \ - -e '$2=(1-($2+.5)/$wpres[2])*$wpsize[2]+$wporig[2]" \ - -e '$3='"$wporig[3]" -e "$4=0;$5=0;$6=1" \ - | rtrace $rtargs -I -ov -faf $octree \ +echo "Title for output picture" +readvar title +set sctemp=/usr/tmp/sc$$.csh +cat <<'_EOF_' > $sctemp +set iltemp=/usr/tmp/il$$.pic +set tltemp=/usr/tmp/tl$$.pic +set tempfiles=($iltemp $sctemp $tltemp) +echo "Your dayfact job is finished." +echo "Please check for error messages below." +echo "" +set echo +cnt $wpres[2] $wpres[1] \ + | rcalc -e '$1=($2+.5)/'"$wpres[1]*$wpsize[1]+$wporig[1]" \ + -e '$2=(1-($1+.5)/'"$wpres[2])*$wpsize[2]+$wporig[2]" \ + -e '$3='"$wporig[3]" -e '$4=0;$5=0;$6=1' \ + | rtrace $rtargs -h+ -I+ -ov -faf $octree \ | pvalue -r -x $wpres[1] -y $wpres[2] -df \ - | pfilt -h 20 -n 0 -x 512 -y 512 -p 1 -r .7 > $iltemp + | pfilt -h 20 -n 0 -x 350 -y 350 -p 1 -r 1 > $iltemp set maxval=`getinfo < $iltemp | rcalc -i 'EXPOSURE=${e}' -e '$1=3/e'` +psign -h 50 " $title " | pfilt -1 -x /2 -y /2 > $tltemp +'_EOF_' if ( "$ilpict" != "$nofile" ) then - echo "Making illuminance contour picture $ilpict..." - falsecolor -s "$maxval*470" -l Lux -log 2 -cl -pi $iltemp > $ilpict + echo 'falsecolor -cb -l Lux -s "$maxval*470" \\ + $fcopts -m 470 -ip $iltemp \\ + | pcompos -a 1 - $tltemp > $ilpict' >> $sctemp endif if ( "$dfpict" != "$nofile" ) then - echo "Making daylight factor contour picture $dfpict..." - falsecolor -s "$maxval/$extamb" -m "1/$extamb" -l DF \ - -log 2 -cl -pi $iltemp > $dfpict + echo 'falsecolor -cb -l DF -s 100 \\ + $fcopts -m "100/PI/$extamb" -ip $iltemp \\ + | pcompos -a 1 - $tltemp > $dfpict' >> $sctemp endif -echo "Done." -quit: - rm -f $tempfiles +echo 'rm -f $tempfiles' >> $sctemp +(source $sctemp) |& mail `whoami` & +echo "Your job is started in the background." +echo "You will be notified by mail when it is done."