#!/bin/bash
if false
then
view="-1.257107069309473385006 3.792595459480247177508e-1 1.6858739404357617e-07"
./render $view
./ray_in ".(0101101011010110101101011010110101101)" 1000 > ray0.txt &
./ray_in ".(0110001100011000110001100011000110010)" 1000 > ray1.txt &
wait
./colour > o.ppm && ./annotate o.ppm <<EOF
rgba 1 1 1 1
line cat ray0.txt | ./rescale 53 53 $view 0
line cat ray1.txt | ./rescale 53 53 $view 0
EOF
fi
if false
then
view="-1.257107069309473385006 3.792595459480247177508e-1 3.5233326899186383e-6"
./render $view
while read ignore n re im
do
  ./ray_out 100 $re $im > ray$n.txt &
done <<EOF
probe 0 -1.2571053132916361 3.7925963246001571e-1
probe 1 -1.2571053302370099 3.7925980450928387e-1
probe 2 -1.2571053639645644 3.7925997406915068e-1
probe 3 -1.2571054141494848 3.7926013950666193e-1
probe 4 -1.2571054803084629 3.7926029922856397e-1
probe 5 -1.2571055618043514 3.7926045169664752e-1
probe 6 -1.2571056578523006 3.7926059544256169e-1
probe 7 -1.2571057675273161 3.7926072908195463e-1
probe 8 -1.2571058897731673 3.7926085132780601e-1
probe 9 -1.2571060234125604 3.7926096100282147e-1
probe 10 -1.2571061671584745 3.7926105705077057e-1
probe 11 -1.2571063196265582 3.7926113854665916e-1
probe 12 -1.2571064793484601 3.7926120470563718e-1
probe 13 -1.2571066447859713 3.7926125489055756e-1
probe 14 -1.2571068143458382 3.7926128861811209e-1
probe 15 -1.2571069863951063 3.7926130556348592e-1
probe 16 -1.2571071592768472 3.7926130556348592e-1
probe 17 -1.2571073313261154 3.7926128861811209e-1
probe 18 -1.2571075008859822 3.7926125489055756e-1
probe 19 -1.2571076663234935 3.7926120470563718e-1
probe 20 -1.2571078260453954 3.7926113854665916e-1
probe 21 -1.2571079785134791 3.7926105705077057e-1
probe 22 -1.2571081222593932 3.7926096100282147e-1
probe 23 -1.2571082558987863 3.7926085132780601e-1
probe 24 -1.2571083781446375 3.7926072908195463e-1
probe 25 -1.2571084878196530 3.7926059544256169e-1
probe 26 -1.2571085838676022 3.7926045169664752e-1
probe 27 -1.2571086653634906 3.7926029922856397e-1
probe 28 -1.2571087315224687 3.7926013950666193e-1
probe 29 -1.2571087817073892 3.7925997406915068e-1
probe 30 -1.2571088154349437 3.7925980450928387e-1
probe 31 -1.2571088323803175 3.7925963246001571e-1
probe 32 -1.2571088323803175 3.7925945957827478e-1
probe 33 -1.2571088154349437 3.7925928752900662e-1
probe 34 -1.2571087817073892 3.7925911796913980e-1
probe 35 -1.2571087315224687 3.7925895253162856e-1
probe 36 -1.2571086653634906 3.7925879280972652e-1
probe 37 -1.2571085838676022 3.7925864034164297e-1
probe 38 -1.2571084878196530 3.7925849659572880e-1
probe 39 -1.2571083781446375 3.7925836295633586e-1
probe 40 -1.2571082558987863 3.7925824071048447e-1
probe 41 -1.2571081222593932 3.7925813103546901e-1
probe 42 -1.2571079785134791 3.7925803498751992e-1
probe 43 -1.2571078260453954 3.7925795349163133e-1
probe 44 -1.2571076663234935 3.7925788733265331e-1
probe 45 -1.2571075008859822 3.7925783714773292e-1
probe 46 -1.2571073313261154 3.7925780342017840e-1
probe 47 -1.2571071592768472 3.7925778647480457e-1
probe 48 -1.2571069863951063 3.7925778647480457e-1
probe 49 -1.2571068143458382 3.7925780342017840e-1
probe 50 -1.2571066447859713 3.7925783714773292e-1
probe 51 -1.2571064793484601 3.7925788733265331e-1
probe 52 -1.2571063196265582 3.7925795349163133e-1
probe 53 -1.2571061671584745 3.7925803498751992e-1
probe 54 -1.2571060234125604 3.7925813103546901e-1
probe 55 -1.2571058897731673 3.7925824071048447e-1
probe 56 -1.2571057675273161 3.7925836295633586e-1
probe 57 -1.2571056578523006 3.7925849659572880e-1
probe 58 -1.2571055618043514 3.7925864034164297e-1
probe 59 -1.2571054803084629 3.7925879280972652e-1
probe 60 -1.2571054141494848 3.7925895253162856e-1
probe 61 -1.2571053639645644 3.7925911796913980e-1
probe 62 -1.2571053302370099 3.7925928752900662e-1
probe 63 -1.2571053132916361 3.7925945957827478e-1
EOF
wait
./colour > o.ppm && ./annotate o.ppm <<EOF
rgba 1 1 1 1
line cat ray1.txt  | ./rescale 100 53 $view 0
line cat ray2.txt  | ./rescale 100 53 $view 0
line cat ray3.txt  | ./rescale 100 53 $view 0
line cat ray4.txt  | ./rescale 100 53 $view 0
line cat ray5.txt  | ./rescale 100 53 $view 0
line cat ray6.txt  | ./rescale 100 53 $view 0
line cat ray7.txt  | ./rescale 100 53 $view 0
line cat ray8.txt  | ./rescale 100 53 $view 0
line cat ray9.txt  | ./rescale 100 53 $view 0
line cat ray10.txt | ./rescale 100 53 $view 0
line cat ray11.txt | ./rescale 100 53 $view 0
line cat ray12.txt | ./rescale 100 53 $view 0
line cat ray13.txt | ./rescale 100 53 $view 0
line cat ray14.txt | ./rescale 100 53 $view 0
line cat ray15.txt | ./rescale 100 53 $view 0
line cat ray16.txt | ./rescale 100 53 $view 0
line cat ray17.txt | ./rescale 100 53 $view 0
line cat ray18.txt | ./rescale 100 53 $view 0
line cat ray19.txt | ./rescale 100 53 $view 0
line cat ray20.txt | ./rescale 100 53 $view 0
line cat ray21.txt | ./rescale 100 53 $view 0
line cat ray22.txt | ./rescale 100 53 $view 0
line cat ray23.txt | ./rescale 100 53 $view 0
line cat ray24.txt | ./rescale 100 53 $view 0
line cat ray25.txt | ./rescale 100 53 $view 0
line cat ray26.txt | ./rescale 100 53 $view 0
line cat ray27.txt | ./rescale 100 53 $view 0
line cat ray28.txt | ./rescale 100 53 $view 0
line cat ray29.txt | ./rescale 100 53 $view 0
line cat ray30.txt | ./rescale 100 53 $view 0
line cat ray31.txt | ./rescale 100 53 $view 0
line cat ray32.txt | ./rescale 100 53 $view 0
line cat ray34.txt | ./rescale 100 53 $view 0
line cat ray35.txt | ./rescale 100 53 $view 0
line cat ray36.txt | ./rescale 100 53 $view 0
line cat ray37.txt | ./rescale 100 53 $view 0
line cat ray38.txt | ./rescale 100 53 $view 0
line cat ray39.txt | ./rescale 100 53 $view 0
line cat ray40.txt | ./rescale 100 53 $view 0
line cat ray41.txt | ./rescale 100 53 $view 0
line cat ray42.txt | ./rescale 100 53 $view 0
line cat ray43.txt | ./rescale 100 53 $view 0
line cat ray44.txt | ./rescale 100 53 $view 0
line cat ray45.txt | ./rescale 100 53 $view 0
line cat ray46.txt | ./rescale 100 53 $view 0
line cat ray47.txt | ./rescale 100 53 $view 0
line cat ray48.txt | ./rescale 100 53 $view 0
line cat ray49.txt | ./rescale 100 53 $view 0
line cat ray50.txt | ./rescale 100 53 $view 0
line cat ray51.txt | ./rescale 100 53 $view 0
line cat ray52.txt | ./rescale 100 53 $view 0
line cat ray53.txt | ./rescale 100 53 $view 0
line cat ray54.txt | ./rescale 100 53 $view 0
line cat ray55.txt | ./rescale 100 53 $view 0
line cat ray56.txt | ./rescale 100 53 $view 0
line cat ray57.txt | ./rescale 100 53 $view 0
line cat ray58.txt | ./rescale 100 53 $view 0
line cat ray59.txt | ./rescale 100 53 $view 0
line cat ray60.txt | ./rescale 100 53 $view 0
line cat ray61.txt | ./rescale 100 53 $view 0
line cat ray62.txt | ./rescale 100 53 $view 0
line cat ray63.txt | ./rescale 100 53 $view 0
rgba 1 0 0 1
line cat ray0.txt  | ./rescale 100 53 $view 0
line cat ray33.txt | ./rescale 100 53 $view 0
EOF
fi

./ray_in ".(0101101011010110101101011010110101100)" 1000 > bad0a.txt &
./ray_in  ".01011010110101101011010110101101011001(0)" 200 > edge0a.txt &
./ray_in ".(0101101011010110101101011010110101101)" 1000 > good0.txt &
./ray_in  ".01011010110101101011010110101101011011(0)" 200 > edge0b.txt &
./ray_in ".(0101101011010110101101011010110101110)" 1000 > bad0b.txt &
./ray_in ".(0110001100011000110001100011000110001)" 1000 > bad1a.txt &
./ray_in  ".01100011000110001100011000110001100011(0)" 200 > edge1a.txt &
./ray_in ".(0110001100011000110001100011000110010)" 1000 > good1.txt &
./ray_in  ".01100011000110001100011000110001100101(0)" 200 > edge1b.txt &
./ray_in ".(0110001100011000110001100011000110011)" 1000 > bad1b.txt &
wait
view="-1.257107069309473385006 3.792595459480247177508e-1 4.2371985245598484e-4"
./render $view
./colour > o.ppm && ./annotate o.ppm <<EOF
rgba 1 0 0 1
line cat bad0a.txt | ./rescale 100 53 $view 0
line cat bad0b.txt | ./rescale 100 53 $view 0
line cat bad1a.txt | ./rescale 100 53 $view 0
line cat bad1b.txt | ./rescale 100 53 $view 0
rgba 0 0 1 1
line cat edge0a.txt | ./rescale 100 53 $view 0
line cat edge0b.txt | ./rescale 100 53 $view 0
line cat edge1a.txt | ./rescale 100 53 $view 0
line cat edge1b.txt | ./rescale 100 53 $view 0
rgba 0 1 0 1
line cat good0.txt | ./rescale 100 53 $view 0
line cat good1.txt | ./rescale 100 53 $view 0
EOF
