| 1 |
greg |
3.1 |
#!/bin/csh -f
|
| 2 |
greg |
3.2 |
# RCSid $Id$
|
| 3 |
|
|
|
| 4 |
|
|
# Mark ambient locations
|
| 5 |
|
|
#
|
| 6 |
|
|
# John Mardaljevic
|
| 7 |
|
|
# Institute of Energy and Sustainable Development
|
| 8 |
|
|
# De Montfort University
|
| 9 |
|
|
# The Gateway
|
| 10 |
|
|
# Leicester
|
| 11 |
|
|
# LE1 9BH, UK
|
| 12 |
|
|
# +44 (0) 116 257 7972
|
| 13 |
|
|
# +44 (0) 116 257 7981 (fax)
|
| 14 |
|
|
#
|
| 15 |
|
|
# [email protected]
|
| 16 |
|
|
# http://www.iesd.dmu.ac.uk/~jm
|
| 17 |
|
|
|
| 18 |
greg |
3.1 |
|
| 19 |
|
|
|
| 20 |
|
|
set ambdat=none
|
| 21 |
|
|
set radius=0.05
|
| 22 |
|
|
|
| 23 |
|
|
alias readvar 'echo -n Enter \!:1 "[$\!:1]: ";set ans="$<";if("$ans" != "")set \!:1="$ans"'
|
| 24 |
|
|
|
| 25 |
|
|
cat <<_EOF_
|
| 26 |
|
|
|
| 27 |
|
|
CREATE SCENE DESCRIPTION MARKERS FOR
|
| 28 |
|
|
AMBIENT SAMPLING LOCATIONS
|
| 29 |
|
|
|
| 30 |
|
|
This script puts coloured markers (spheres) at points where hemispherical
|
| 31 |
|
|
sampling was initiated. The locations and levels are taken from the binary
|
| 32 |
|
|
ambient file. The levels are colour coded -
|
| 33 |
|
|
|
| 34 |
|
|
Level 0 = red
|
| 35 |
|
|
Level 1 = green
|
| 36 |
|
|
Level 2 = blue
|
| 37 |
|
|
Level 3 = yellow
|
| 38 |
|
|
Level 4 = cyan
|
| 39 |
|
|
Level 5 = magenta
|
| 40 |
|
|
Level 6 = pink
|
| 41 |
|
|
|
| 42 |
|
|
To view the locations, include the file "amb_pos.rad" when re-creating
|
| 43 |
|
|
the octree.
|
| 44 |
|
|
|
| 45 |
|
|
_EOF_
|
| 46 |
|
|
|
| 47 |
greg |
3.2 |
rm -f amb_pos.rad
|
| 48 |
|
|
|
| 49 |
greg |
3.1 |
echo "Input ambient file"
|
| 50 |
|
|
readvar ambdat
|
| 51 |
|
|
|
| 52 |
|
|
echo "Input marker sphere radius"
|
| 53 |
|
|
readvar radius
|
| 54 |
|
|
|
| 55 |
|
|
getinfo $ambdat
|
| 56 |
|
|
lookamb -d -h $ambdat > af$$.tmp
|
| 57 |
|
|
|
| 58 |
|
|
set red=(1 0 0 1 0 1 1)
|
| 59 |
|
|
set grn=(0 1 0 1 1 0 0.5)
|
| 60 |
|
|
set blu=(0 0 1 0 1 1 0.5)
|
| 61 |
|
|
|
| 62 |
|
|
foreach j (1 2 3 4 5 6 7)
|
| 63 |
|
|
|
| 64 |
|
|
@ i = $j - 1
|
| 65 |
|
|
|
| 66 |
|
|
rcalc -e 'cond=eq($7,'"$i"');eq(a,b)=if(a-b+1e-7,b-a+1e-7,-1);$1=$1;$2=$2;$3=$3' af$$.tmp > amb_pos_lev$i
|
| 67 |
|
|
|
| 68 |
|
|
set empt=`wc -l < amb_pos_lev$i`
|
| 69 |
|
|
|
| 70 |
|
|
if ($empt !~ 0) then
|
| 71 |
|
|
|
| 72 |
|
|
echo "$empt ambient locations for level $i"
|
| 73 |
|
|
|
| 74 |
|
|
cat > sph_lev$i.fmt << _EOF_
|
| 75 |
|
|
|
| 76 |
|
|
mat_lev$i sphere sph_lev$i.\${recno}
|
| 77 |
|
|
0
|
| 78 |
|
|
0
|
| 79 |
|
|
4 \${ x1 } \${ y1 } \${ z1 } $radius
|
| 80 |
|
|
_EOF_
|
| 81 |
|
|
|
| 82 |
|
|
cat >> amb_pos.rad << _EOF_
|
| 83 |
|
|
void plastic mat_lev$i
|
| 84 |
|
|
0
|
| 85 |
|
|
0
|
| 86 |
|
|
5 $red[$j] $grn[$j] $blu[$j] 0 0
|
| 87 |
|
|
|
| 88 |
|
|
!rcalc -e 'x1=\$1;y1=\$2;z1=\$3' -o sph_lev$i.fmt amb_pos_lev$i
|
| 89 |
|
|
|
| 90 |
|
|
_EOF_
|
| 91 |
|
|
|
| 92 |
|
|
else
|
| 93 |
|
|
|
| 94 |
|
|
rm amb_pos_lev$i
|
| 95 |
|
|
|
| 96 |
|
|
endif
|
| 97 |
|
|
|
| 98 |
|
|
end
|
| 99 |
|
|
|
| 100 |
|
|
rm af$$.tmp
|