| 63 |
|
sin_kpol = sin(Kpol); |
| 64 |
|
K0 = cos(Kazi)*sin_kpol; |
| 65 |
|
K1 = sin(Kazi)*sin_kpol; |
| 66 |
< |
K2 = cos(Kpol); |
| 66 |
> |
K2 = sqrt(1 - sin_kpol*sin_kpol); |
| 67 |
|
'; |
| 68 |
|
my $ndiv = 145; |
| 69 |
|
# Do we have any Radiance input files? |
| 82 |
|
push @vopts, ("-vp", $bcube[0]+$bcube[3]/2-$width/2*$vd[0], |
| 83 |
|
$bcube[1]+$bcube[3]/2-$width/2*$vd[1], |
| 84 |
|
$bcube[2]+$bcube[3]/2-$width/2*$vd[2]); |
| 85 |
< |
push @vopts, ("-vh", $width, "-vh", $height); |
| 85 |
> |
push @vopts, ("-vh", $width, "-vv", $height); |
| 86 |
|
$vwset = `vwright @vopts V`; |
| 87 |
+ |
$sca = sqrt($nsamp/($width*$height)); |
| 88 |
|
my $xres; |
| 89 |
|
my $yres; |
| 90 |
|
my $ntot = 0; |
| 99 |
|
q{-e 'nOK=sq(Vdx*$5+Vdy*$6+Vdz*$7)-.999' } . |
| 100 |
|
"-if7 -of > $td/origins.flt"; |
| 101 |
|
$ntot = -s "$td/origins.flt"; |
| 102 |
< |
$ntot /= 3*4; |
| 102 |
> |
$ntot /= 3*4; # number of bytes per sample position |
| 103 |
|
if ($ntot == 0) { |
| 104 |
< |
if ($sca < sqrt(199/($width*$height))) { |
| 104 |
> |
if ($nsamp < 200) { |
| 105 |
|
$sca = sqrt(200/($width*$height)); |
| 106 |
|
redo; |
| 107 |
|
} |
| 119 |
|
"-e 'cond=($nsamp-outno+1)/($ntot-recno+1)-rand($rn+recno)' " . |
| 120 |
|
"-e 'Kbin=$k;x1=rand($r1+recno);x2=rand($r2+recno)' " . |
| 121 |
|
q{-e '$1=$1+Vo*Vdx; $2=$2+Vo*Vdy; $3=$3+Vo*Vdz' } . |
| 122 |
< |
q{-e '$4=K0*Vhx+K1*Vvx+K2*Vdx' } . |
| 123 |
< |
q{-e '$5=K0*Vhy+K1*Vvy+K2*Vdy' } . |
| 124 |
< |
q{-e '$6=K0*Vhz+K1*Vvz+K2*Vdz' } . |
| 122 |
> |
q{-e '$4=K0*Vhx-K1*Vvx+K2*Vdx' } . |
| 123 |
> |
q{-e '$5=K0*Vhy-K1*Vvy+K2*Vdy' } . |
| 124 |
> |
q{-e '$6=K0*Vhz-K1*Vvz+K2*Vdz' } . |
| 125 |
|
"-if3 $td/origins.flt"; |
| 126 |
|
} |
| 127 |
|
} else { |
| 143 |
|
q{-e '$1=Vpx+Vo*Vdx+hpos*Vhx+vpos*Vvx' } . |
| 144 |
|
q{-e '$2=Vpy+Vo*Vdy+hpos*Vhy+vpos*Vvy' } . |
| 145 |
|
q{-e '$3=Vpz+Vo*Vdz+hpos*Vhz+vpos*Vvz' } . |
| 146 |
< |
q{-e '$4=K0*Vhx+K1*Vvx+K2*Vdx' } . |
| 147 |
< |
q{-e '$5=K0*Vhy+K1*Vvy+K2*Vdy' } . |
| 148 |
< |
q{-e '$6=K0*Vhz+K1*Vvz+K2*Vdz' } ; |
| 146 |
> |
q{-e '$4=K0*Vhx-K1*Vvx+K2*Vdx' } . |
| 147 |
> |
q{-e '$5=K0*Vhy-K1*Vvy+K2*Vdy' } . |
| 148 |
> |
q{-e '$6=K0*Vhz-K1*Vvz+K2*Vdz' } ; |
| 149 |
|
} |
| 150 |
|
} |
| 151 |
|
system "rm -rf $td"; |