| 81 | 
  | 
                q{-e "Rbin=$1;x1=rand(recno*.37-5.3);x2=rand(recno*-1.47+.86)" } . | 
| 82 | 
  | 
                q{-e "$1=0;$2=0;$3=0;$4=Dx;$5=Dy;$6=Dz" } . | 
| 83 | 
  | 
                "| rtrace -h -ab 0 -w $octree | total -16 -m"; | 
| 84 | 
< | 
        $suncmd = "cnt " . ($nbins-1) . | 
| 85 | 
< | 
                " | rcalc -e MF:$mf -e \"$rhcal\" -e Rbin=recno " . | 
| 86 | 
< | 
                "-e \"dot=Dx*$sundir[0] + Dy*$sundir[1] + Dz*$sundir[2]\" " . | 
| 87 | 
< | 
                "-e \"cond=dot-.866\" " . | 
| 88 | 
< | 
                q{-e "$1=if(1-dot,acos(dot),0);$2=Romega;$3=recno" }; | 
| 84 | 
> | 
        if (@sundir) { | 
| 85 | 
> | 
                $suncmd = "cnt " . ($nbins-1) . | 
| 86 | 
> | 
                        " | rcalc -e MF:$mf -e \"$rhcal\" -e Rbin=recno " . | 
| 87 | 
> | 
                        "-e \"dot=Dx*$sundir[0] + Dy*$sundir[1] + Dz*$sundir[2]\" " . | 
| 88 | 
> | 
                        "-e \"cond=dot-.866\" " . | 
| 89 | 
> | 
                        q{-e "$1=if(1-dot,acos(dot),0);$2=Romega;$3=recno" }; | 
| 90 | 
> | 
        } | 
| 91 | 
  | 
} else { | 
| 92 | 
  | 
        $nbins = `rcalc -n -e MF:$mf -e \'$rhcal\' -e \'\$1=Rmax+1\'`; | 
| 93 | 
  | 
        chomp $nbins; | 
| 96 | 
  | 
                q{-e 'Rbin=$1;x1=rand(recno*.37-5.3);x2=rand(recno*-1.47+.86)' } . | 
| 97 | 
  | 
                q{-e '$1=0;$2=0;$3=0;$4=Dx;$5=Dy;$6=Dz' } . | 
| 98 | 
  | 
                "| rtrace -h -ff -ab 0 -w $octree | total -if3 -16 -m"; | 
| 99 | 
< | 
        $suncmd = "cnt " . ($nbins-1) . | 
| 100 | 
< | 
                " | rcalc -e MF:$mf -e '$rhcal' -e Rbin=recno " . | 
| 101 | 
< | 
                "-e 'dot=Dx*$sundir[0] + Dy*$sundir[1] + Dz*$sundir[2]' " . | 
| 102 | 
< | 
                "-e 'cond=dot-.866' " . | 
| 103 | 
< | 
                q{-e '$1=if(1-dot,acos(dot),0);$2=Romega;$3=recno' }; | 
| 99 | 
> | 
        if (@sundir) { | 
| 100 | 
> | 
                $suncmd = "cnt " . ($nbins-1) . | 
| 101 | 
> | 
                        " | rcalc -e MF:$mf -e '$rhcal' -e Rbin=recno " . | 
| 102 | 
> | 
                        "-e 'dot=Dx*$sundir[0] + Dy*$sundir[1] + Dz*$sundir[2]' " . | 
| 103 | 
> | 
                        "-e 'cond=dot-.866' " . | 
| 104 | 
> | 
                        q{-e '$1=if(1-dot,acos(dot),0);$2=Romega;$3=recno' }; | 
| 105 | 
> | 
        } | 
| 106 | 
  | 
} | 
| 107 | 
  | 
# Create octree for rtrace | 
| 108 | 
  | 
open OCONV, "| oconv - > $octree"; |