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