Optical Model of the Human Eye

Manipulate[
 Column[
  {
   Grid[
    {{Show[{Graphics[{{Opacity[0.8], 
           staticpolygons1118640200831284558144170, Opacity[1], 
           RGBColor[0.038747429704798886, 0.9161617552424038, 
            0.03984721226918142], AbsoluteThickness[Medium], 
           Line[Dynamic[({#1[[{1, 2}]], #1[[{4, 5}]]} & ) /@ 
              Select[raytracefunction118640200831284558148930[th, x, 
                y], #1[[1]] > -9.87654321*^8 & ], SynchronousUpdating -> 
              False]], Arrowheads[Large], Thickness[Large], 
           Dashing[{Small, Small}], RGBColor[1, 1, 0], 
           Arrow[Dynamic[If[laststartposth != {x, y} || lastth =!= th, 
               laststartposth = {x, y}; lastth = th; {xth, yth} = 
                 laststartposth + radiusth*{Cos[th*Degree], 
                    Sin[th*Degree]}]; {laststartposth, {xth, yth}}, 
             ({laststartposth, {xth, yth}} = #1) & ]], 
           Tooltip[Locator[Dynamic[BesselJ[1., 3.]; (
                If[{xth, yth} != lastlocposth || lastth != th, 
                 lastlocposth = {xth, yth}; lastth = th; {xth, yth} = 
                   laststartposth + radiusth*{Cos[th*Degree], 
                      Sin[th*Degree]}]; {xth, yth}), ({xth, yth} = #1; 
                xoffth = xth - x; yoffth = yth - y; radiusth = 
                 Sqrt[xoffth^2 + yoffth^2]; th = Chop[ArcTan[xoffth, 
                    yoffth]/Degree]; {xth, yth}) & ], 
             Graphics[{RGBColor[1/3, 1/3, 1], Disk[{0, 0}, 0.5]}, 
              ImageSize -> 10]], Dynamic[StringJoin["th = ", 
              ToString[th]]]], Tooltip[Locator[Dynamic[BesselJ[1., 3.]; {
                x, y}, ({x, y} = Chop[#1]) & ], Graphics[{RGBColor[1, 
                1/3, 1/3], Disk[{0, 0}, 0.8]}, ImageSize -> 10]], 
            Dynamic[StringJoin["{x, y} = ", ToString[Chop[
                {x, y}]]]]]}}]}, {PlotLabel -> "eye model", 
        ImageSize -> {225, 300}, AspectRatio -> Automatic}], 
      Show[{Graphics3D[{{Opacity[1], 
           staticpolygons211864020083128460945430, Opacity[1], 
           RGBColor[0.038747429704798886, 0.9161617552424038, 
            0.03984721226918142], AbsoluteThickness[Medium], 
           Line[Dynamic[({#1[[{1, 2, 3}]], #1[[{4, 5, 6}]]} & ) /@ 
              Select[raytracefunction21864020083128460953516[th, x, y], 
               #1[[1]] > -9.87654321*^8 & ], SynchronousUpdating -> 
              False]]}}]}, {PlotLabel -> None, ImageSize -> {225, 300}, 
        AspectRatio -> Automatic}]}}]}, Center], 
 {{th, 0.}, -180., 180., ControlType -> None}, 
 {{x, -5.}, -10, -0.05, ControlType -> None}, 
 {{y, 0.}, -10, 10, ControlType -> None}, 
 {{xth, -4.4019925}, ControlType -> None}, 
 {{yth, 0.}, ControlType -> None}, 
 {{radiusth, 0.5980074999999999}, 
  ControlType -> None}, {{xoffth, 0.5980074999999999}, 
  ControlType -> None}, {{yoffth, 0.}, ControlType -> None}, 
 {{laststartposth, {-5., 0.}}, ControlType -> None}, 
 {{lastlocposth, {-4.4019925, 0.}}, ControlType -> None}, 
 {{lastth, 0}, ControlType -> None}, 
 {{staticpolygons1118640200831284558144170, 
   {GrayLevel[0], AbsoluteThickness[0.5], 
    Line[{{{-0.654121133468629, -6.25}, {-0.9903057458473903, -5.9375}, 
       {-1.2964078972773794, -5.625}, {-1.575713724426754, -5.3125}, 
       {-1.830815380800448, -5.}, {-2.0637952929044054, -4.6875}, 
       {-2.276351075688101, -4.375}, {-2.4698828946113975, -4.0625}, 
       {-2.645556176913418, -3.75}, {-2.8043476264468827, -3.4375}, 
       {-2.947079616577351, -3.125}, {-3.0744462949685563, -2.8125}, 
       {-3.1870336467217917, -2.5}, {-3.285335063038256, -2.1875}, 
       {-3.3697635009278692, -1.875}, {-3.4406610073320936, -1.5625}, 
       {-3.4983061651113845, -1.25}, {-3.542919865616026, -0.9375}, 
       {-3.5746697019586033, -0.625}, {-3.593673194879362, -0.3125}, 
       {-3.5999999999999996, 0.}, {-3.593673194879362, 0.3125}, 
       {-3.5746697019586033, 0.625}, {-3.542919865616026, 0.9375}, 
       {-3.4983061651113845, 1.25}, {-3.4406610073320936, 1.5625}, 
       {-3.3697635009278692, 1.875}, {-3.285335063038256, 2.1875}, 
       {-3.1870336467217917, 2.5}, {-3.0744462949685563, 2.8125}, 
       {-2.947079616577351, 3.125}, {-2.8043476264468827, 3.4375}, 
       {-2.645556176913418, 3.75}, {-2.4698828946113975, 4.0625}, 
       {-2.276351075688101, 4.375}, {-2.0637952929044054, 4.6875}, 
       {-1.830815380800448, 5.}, {-1.575713724426754, 5.3125}, 
       {-1.2964078972773794, 5.625}, {-0.9903057458473903, 5.9375}, 
       {-0.654121133468629, 6.25}, {-0.654121133468629, 6.25}, 
       {-0.9903057458473903, 5.9375}, {-1.2964078972773794, 5.625}, 
       {-1.575713724426754, 5.3125}, {-1.830815380800448, 5.}, 
       {-2.0637952929044054, 4.6875}, {-2.276351075688101, 4.375}, 
       {-2.4698828946113975, 4.0625}, {-2.645556176913418, 3.75}, 
       {-2.8043476264468827, 3.4375}, {-2.947079616577351, 3.125}, 
       {-3.0744462949685563, 2.8125}, {-3.1870336467217917, 2.5}, 
       {-3.285335063038256, 2.1875}, {-3.3697635009278692, 1.875}, 
       {-3.4406610073320936, 1.5625}, {-3.4983061651113845, 1.25}, 
       {-3.542919865616026, 0.9375}, {-3.5746697019586033, 0.625}, 
       {-3.593673194879362, 0.3125}, {-3.5999999999999996, 0.}, 
       {-3.593673194879362, -0.3125}, {-3.5746697019586033, -0.625}, 
       {-3.542919865616026, -0.9375}, {-3.4983061651113845, -1.25}, 
       {-3.4406610073320936, -1.5625}, {-3.3697635009278692, -1.875}, 
       {-3.285335063038256, -2.1875}, {-3.1870336467217917, -2.5}, 
       {-3.0744462949685563, -2.8125}, {-2.947079616577351, -3.125}, 
       {-2.8043476264468827, -3.4375}, {-2.645556176913418, -3.75}, 
       {-2.4698828946113975, -4.0625}, {-2.276351075688101, -4.375}, 
       {-2.0637952929044054, -4.6875}, {-1.830815380800448, -5.}, 
       {-1.575713724426754, -5.3125}, {-1.2964078972773794, -5.625}, 
       {-0.9903057458473903, -5.9375}, {-0.654121133468629, -6.25}, 
       {-0.654121133468629, -6.25}}, {{-0.7033119314590373, -5.}, 
       {-0.9870598373247121, -4.75}, {-1.2404157598234296, -4.5}, 
       {-1.4680788932265, -4.25}, {-1.6734753829797988, -4.}, 
       {-1.8591901453988253, -3.75}, {-2.027225575051661, -3.5}, 
       {-2.1791651245988506, -3.25}, {-2.316281297335398, -3.}, 
       {-2.4396094946948734, -2.75}, {-2.55, -2.5}, 
       {-2.648155458825234, -2.25}, {-2.7346584384264903, -2.}, 
       {-2.8099920127744573, -1.75}, {-2.874555320336759, -1.5}, 
       {-2.9286754110865365, -1.25}, {-2.9726162893325645, -1.}, 
       {-3.0065857850724784, -0.75}, {-3.03074069840786, -0.5}, 
       {-3.04519052838329, -0.25}, {-3.05, 0.}, {-3.04519052838329, 
        0.25}, {-3.03074069840786, 0.5}, {-3.0065857850724784, 0.75}, 
       {-2.9726162893325645, 1.}, {-2.9286754110865365, 1.25}, 
       {-2.874555320336759, 1.5}, {-2.8099920127744573, 1.75}, 
       {-2.7346584384264903, 2.}, {-2.648155458825234, 2.25}, 
       {-2.55, 2.5}, {-2.4396094946948734, 2.75}, {-2.316281297335398, 
        3.}, {-2.1791651245988506, 3.25}, {-2.027225575051661, 3.5}, 
       {-1.8591901453988253, 3.75}, {-1.6734753829797988, 4.}, 
       {-1.4680788932265, 4.25}, {-1.2404157598234296, 4.5}, 
       {-0.9870598373247121, 4.75}, {-0.7033119314590373, 5.}, 
       {-0.7033119314590373, 5.}, {-0.9870598373247121, 4.75}, 
       {-1.2404157598234296, 4.5}, {-1.4680788932265, 4.25}, 
       {-1.6734753829797988, 4.}, {-1.8591901453988253, 3.75}, 
       {-2.027225575051661, 3.5}, {-2.1791651245988506, 3.25}, 
       {-2.316281297335398, 3.}, {-2.4396094946948734, 2.75}, 
       {-2.55, 2.5}, {-2.648155458825234, 2.25}, {-2.7346584384264903, 
        2.}, {-2.8099920127744573, 1.75}, {-2.874555320336759, 1.5}, 
       {-2.9286754110865365, 1.25}, {-2.9726162893325645, 1.}, 
       {-3.0065857850724784, 0.75}, {-3.03074069840786, 0.5}, 
       {-3.04519052838329, 0.25}, {-3.05, 0.}, {-3.04519052838329, 
        -0.25}, {-3.03074069840786, -0.5}, {-3.0065857850724784, -0.75}, 
       {-2.9726162893325645, -1.}, {-2.9286754110865365, -1.25}, 
       {-2.874555320336759, -1.5}, {-2.8099920127744573, -1.75}, 
       {-2.7346584384264903, -2.}, {-2.648155458825234, -2.25}, 
       {-2.55, -2.5}, {-2.4396094946948734, -2.75}, 
       {-2.316281297335398, -3.}, {-2.1791651245988506, -3.25}, 
       {-2.027225575051661, -3.5}, {-1.8591901453988253, -3.75}, 
       {-1.6734753829797988, -4.}, {-1.4680788932265, -4.25}, 
       {-1.2404157598234296, -4.5}, {-0.9870598373247121, -4.75}, 
       {-0.7033119314590373, -5.}, {-0.7033119314590373, -5.}}, 
      {{-0.05, -2.5}, {-0.05, -2.375}, {-0.05, -2.25}, {-0.05, -2.125}, 
       {-0.05, -2.}, {-0.05, -1.875}, {-0.05, -1.75}, {-0.05, -1.625}, 
       {-0.05, -1.5}, {-0.05, -1.375}, {-0.05, -1.25}, {-0.05, -1.125}, 
       {-0.05, -1.}, {-0.05, -0.875}, {-0.05, -0.75}, {-0.05, -0.625}, 
       {-0.05, -0.5}, {-0.05, -0.375}, {-0.05, -0.25}, {-0.05, -0.125}, 
       {-0.05, 0.}, {-0.05, 0.125}, {-0.05, 0.25}, {-0.05, 0.375}, 
       {-0.05, 0.5}, {-0.05, 0.625}, {-0.05, 0.75}, {-0.05, 0.875}, 
       {-0.05, 1.}, {-0.05, 1.125}, {-0.05, 1.25}, {-0.05, 1.375}, 
       {-0.05, 1.5}, {-0.05, 1.625}, {-0.05, 1.75}, {-0.05, 1.875}, 
       {-0.05, 2.}, {-0.05, 2.125}, {-0.05, 2.25}, {-0.05, 2.375}, 
       {-0.05, 2.5}, {-0.05, 2.5}, {-0.05, 2.375}, {-0.05, 2.25}, 
       {-0.05, 2.125}, {-0.05, 2.}, {-0.05, 1.875}, {-0.05, 1.75}, 
       {-0.05, 1.625}, {-0.05, 1.5}, {-0.05, 1.375}, {-0.05, 1.25}, 
       {-0.05, 1.125}, {-0.05, 1.}, {-0.05, 0.875}, {-0.05, 0.75}, 
       {-0.05, 0.625}, {-0.05, 0.5}, {-0.05, 0.375}, {-0.05, 0.25}, 
       {-0.05, 0.125}, {-0.05, 0.}, {-0.05, -0.125}, {-0.05, -0.25}, 
       {-0.05, -0.375}, {-0.05, -0.5}, {-0.05, -0.625}, {-0.05, -0.75}, 
       {-0.05, -0.875}, {-0.05, -1.}, {-0.05, -1.125}, {-0.05, -1.25}, 
       {-0.05, -1.375}, {-0.05, -1.5}, {-0.05, -1.625}, {-0.05, -1.75}, 
       {-0.05, -1.875}, {-0.05, -2.}, {-0.05, -2.125}, {-0.05, -2.25}, 
       {-0.05, -2.375}, {-0.05, -2.5}, {-0.05, -2.5}}, 
      {{-0.05, -5.}, {-0.05, -4.9375}, {-0.05, -4.875}, 
       {-0.05, -4.8125}, {-0.05, -4.75}, {-0.05, -4.6875}, 
       {-0.05, -4.625}, {-0.05, -4.5625}, {-0.05, -4.5}, 
       {-0.05, -4.4375}, {-0.05, -4.375}, {-0.05, -4.3125}, 
       {-0.05, -4.25}, {-0.05, -4.1875}, {-0.05, -4.125}, 
       {-0.05, -4.0625}, {-0.05, -4.}, {-0.05, -3.9375}, 
       {-0.05, -3.875}, {-0.05, -3.8125}, {-0.05, -3.75}, 
       {-0.05, -3.6875}, {-0.05, -3.625}, {-0.05, -3.5625}, 
       {-0.05, -3.5}, {-0.05, -3.4375}, {-0.05, -3.375}, 
       {-0.05, -3.3125}, {-0.05, -3.25}, {-0.05, -3.1875}, 
       {-0.05, -3.125}, {-0.05, -3.0625}, {-0.05, -3.}, 
       {-0.05, -2.9375}, {-0.05, -2.875}, {-0.05, -2.8125}, 
       {-0.05, -2.75}, {-0.05, -2.6875}, {-0.05, -2.625}, 
       {-0.05, -2.5625}, {-0.05, -2.5}, {-0.05, -2.5}, {-0.05, -2.5625}, 
       {-0.05, -2.625}, {-0.05, -2.6875}, {-0.05, -2.75}, 
       {-0.05, -2.8125}, {-0.05, -2.875}, {-0.05, -2.9375}, 
       {-0.05, -3.}, {-0.05, -3.0625}, {-0.05, -3.125}, 
       {-0.05, -3.1875}, {-0.05, -3.25}, {-0.05, -3.3125}, 
       {-0.05, -3.375}, {-0.05, -3.4375}, {-0.05, -3.5}, 
       {-0.05, -3.5625}, {-0.05, -3.625}, {-0.05, -3.6875}, 
       {-0.05, -3.75}, {-0.05, -3.8125}, {-0.05, -3.875}, 
       {-0.05, -3.9375}, {-0.05, -4.}, {-0.05, -4.0625}, 
       {-0.05, -4.125}, {-0.05, -4.1875}, {-0.05, -4.25}, 
       {-0.05, -4.3125}, {-0.05, -4.375}, {-0.05, -4.4375}, 
       {-0.05, -4.5}, {-0.05, -4.5625}, {-0.05, -4.625}, 
       {-0.05, -4.6875}, {-0.05, -4.75}, {-0.05, -4.8125}, 
       {-0.05, -4.875}, {-0.05, -4.9375}, {-0.05, -5.}, {-0.05, -5.}}, 
      {{-0.05, 2.5}, {-0.05, 2.5625}, {-0.05, 2.625}, {-0.05, 2.6875}, 
       {-0.05, 2.75}, {-0.05, 2.8125}, {-0.05, 2.875}, {-0.05, 2.9375}, 
       {-0.05, 3.}, {-0.05, 3.0625}, {-0.05, 3.125}, {-0.05, 3.1875}, 
       {-0.05, 3.25}, {-0.05, 3.3125}, {-0.05, 3.375}, {-0.05, 3.4375}, 
       {-0.05, 3.5}, {-0.05, 3.5625}, {-0.05, 3.625}, {-0.05, 3.6875}, 
       {-0.05, 3.75}, {-0.05, 3.8125}, {-0.05, 3.875}, {-0.05, 3.9375}, 
       {-0.05, 4.}, {-0.05, 4.0625}, {-0.05, 4.125}, {-0.05, 4.1875}, 
       {-0.05, 4.25}, {-0.05, 4.3125}, {-0.05, 4.375}, {-0.05, 4.4375}, 
       {-0.05, 4.5}, {-0.05, 4.5625}, {-0.05, 4.625}, {-0.05, 4.6875}, 
       {-0.05, 4.75}, {-0.05, 4.8125}, {-0.05, 4.875}, {-0.05, 4.9375}, 
       {-0.05, 5.}, {-0.05, 5.}, {-0.05, 4.9375}, {-0.05, 4.875}, 
       {-0.05, 4.8125}, {-0.05, 4.75}, {-0.05, 4.6875}, {-0.05, 4.625}, 
       {-0.05, 4.5625}, {-0.05, 4.5}, {-0.05, 4.4375}, {-0.05, 4.375}, 
       {-0.05, 4.3125}, {-0.05, 4.25}, {-0.05, 4.1875}, {-0.05, 4.125}, 
       {-0.05, 4.0625}, {-0.05, 4.}, {-0.05, 3.9375}, {-0.05, 3.875}, 
       {-0.05, 3.8125}, {-0.05, 3.75}, {-0.05, 3.6875}, {-0.05, 3.625}, 
       {-0.05, 3.5625}, {-0.05, 3.5}, {-0.05, 3.4375}, {-0.05, 3.375}, 
       {-0.05, 3.3125}, {-0.05, 3.25}, {-0.05, 3.1875}, {-0.05, 3.125}, 
       {-0.05, 3.0625}, {-0.05, 3.}, {-0.05, 2.9375}, {-0.05, 2.875}, 
       {-0.05, 2.8125}, {-0.05, 2.75}, {-0.05, 2.6875}, {-0.05, 2.625}, 
       {-0.05, 2.5625}, {-0.05, 2.5}, {-0.05, 2.5}}, 
      {{1.3689976525819987, -5.65}, {1.249200508667663, 
        -5.367500000000001}, {1.133305718014965, -5.085}, 
       {1.0215469448527958, -4.8025}, {0.9141675062554867, 
        -4.5200000000000005}, {0.8114194827665998, -4.237500000000001}, 
       {0.7135625066333096, -3.955}, {0.6208621909813115, 
        -3.6725000000000003}, {0.5335881696456211, -3.39}, 
       {0.4520117276705726, -3.1075}, {0.3764030171799524, -2.825}, 
       {0.30702787256214575, -2.5425}, {0.24414426241533377, -2.26}, 
       {0.18799844254256412, -1.9775}, {0.13882090285648163, 
        -1.6949999999999998}, {0.09682222901675835, 
        -1.4124999999999996}, {0.06218902406370809, -1.13}, 
       {0.03508005301320917, -0.8475000000000001}, 
       {0.01562278125633912, -0.5649999999999995}, 
       {0.0039104732351545445, -0.28249999999999975}, {0., 0.}, 
       {0.003910473235154569, 0.28250000000000064}, 
       {0.01562278125633917, 0.5650000000000004}, {0.03508005301320917, 
        0.8475000000000001}, {0.06218902406370819, 1.1300000000000008}, 
       {0.09682222901675848, 1.4125000000000005}, {0.13882090285648174, 
        1.6950000000000003}, {0.18799844254256412, 1.9775}, 
       {0.244144262415334, 2.2600000000000007}, {0.30702787256214586, 
        2.5425000000000004}, {0.37640301717995267, 2.825000000000001}, 
       {0.4520117276705726, 3.1075}, {0.5335881696456212, 
        3.3900000000000006}, {0.6208621909813118, 3.672500000000001}, 
       {0.7135625066333096, 3.955}, {0.8114194827665998, 
        4.237500000000001}, {0.914167506255487, 4.520000000000001}, 
       {1.0215469448527958, 4.8025}, {1.1333057180149655, 
        5.085000000000001}, {1.2492005086676634, 5.3675000000000015}, 
       {1.3689976525819987, 5.65}, {1.3689976525819987, 5.65}, 
       {1.249200508667663, 5.367500000000001}, {1.133305718014965, 
        5.085}, {1.0215469448527958, 4.8025}, {0.9141675062554867, 
        4.5200000000000005}, {0.8114194827665998, 4.237500000000001}, 
       {0.7135625066333096, 3.955}, {0.6208621909813115, 
        3.6725000000000003}, {0.5335881696456211, 3.39}, 
       {0.4520117276705726, 3.1075}, {0.3764030171799524, 2.825}, 
       {0.30702787256214575, 2.5425}, {0.24414426241533377, 2.26}, 
       {0.18799844254256412, 1.9775}, {0.13882090285648163, 
        1.6949999999999998}, {0.09682222901675835, 1.4124999999999996}, 
       {0.06218902406370809, 1.13}, {0.03508005301320917, 
        0.8475000000000001}, {0.01562278125633912, 0.5649999999999995}, 
       {0.0039104732351545445, 0.28249999999999975}, {0., 0.}, 
       {0.003910473235154569, -0.28250000000000064}, 
       {0.01562278125633917, -0.5650000000000004}, 
       {0.03508005301320917, -0.8475000000000001}, 
       {0.06218902406370819, -1.1300000000000008}, 
       {0.09682222901675848, -1.4125000000000005}, 
       {0.13882090285648174, -1.6950000000000003}, 
       {0.18799844254256412, -1.9775}, {0.244144262415334, 
        -2.2600000000000007}, {0.30702787256214586, 
        -2.5425000000000004}, {0.37640301717995267, -2.825000000000001}, 
       {0.4520117276705726, -3.1075}, {0.5335881696456212, 
        -3.3900000000000006}, {0.6208621909813118, -3.672500000000001}, 
       {0.7135625066333096, -3.955}, {0.8114194827665998, 
        -4.237500000000001}, {0.914167506255487, -4.520000000000001}, 
       {1.0215469448527958, -4.8025}, {1.1333057180149655, 
        -5.085000000000001}, {1.2492005086676634, -5.3675000000000015}, 
       {1.3689976525819987, -5.65}, {1.3689976525819987, -5.65}}, 
      {{1.3397916666666667, -5.65}, {1.5991619791666665, 
        -5.367500000000001}, {1.8452312500000003, -5.085}, 
       {2.0779994791666665, -4.8025}, {2.2974666666666663, 
        -4.5200000000000005}, {2.5036328124999994, -4.237500000000001}, 
       {2.696497916666667, -3.955}, {2.876061979166667, 
        -3.6725000000000003}, {3.042325, -3.39}, {3.1952869791666667, 
        -3.1075}, {3.3349479166666667, -2.825}, {3.4613078125000003, 
        -2.5425}, {3.5743666666666667, -2.26}, {3.6741244791666667, 
        -1.9775}, {3.76058125, -1.6949999999999998}, 
       {3.833736979166667, -1.4124999999999996}, {3.8935916666666666, 
        -1.13}, {3.9401453125, -0.8475000000000001}, 
       {3.973397916666667, -0.5649999999999995}, {3.9933494791666666, 
        -0.28249999999999975}, {4., 0.}, {3.9933494791666666, 
        0.28250000000000064}, {3.9733979166666664, 0.5650000000000004}, 
       {3.9401453125, 0.8475000000000001}, {3.8935916666666666, 
        1.1300000000000008}, {3.8337369791666664, 1.4125000000000005}, 
       {3.76058125, 1.6950000000000003}, {3.6741244791666667, 1.9775}, 
       {3.5743666666666662, 2.2600000000000007}, 
       {3.4613078125, 2.5425000000000004}, {3.3349479166666662, 
        2.825000000000001}, {3.1952869791666667, 3.1075}, 
       {3.042325, 3.3900000000000006}, {2.876061979166666, 
        3.672500000000001}, {2.696497916666667, 3.955}, 
       {2.5036328124999994, 4.237500000000001}, {2.297466666666666, 
        4.520000000000001}, {2.0779994791666665, 4.8025}, 
       {1.8452312499999994, 5.085000000000001}, {1.5991619791666656, 
        5.3675000000000015}, {1.3397916666666667, 5.65}, 
       {1.3397916666666667, 5.65}, {1.5991619791666665, 
        5.367500000000001}, {1.8452312500000003, 5.085}, 
       {2.0779994791666665, 4.8025}, {2.2974666666666663, 
        4.5200000000000005}, {2.5036328124999994, 4.237500000000001}, 
       {2.696497916666667, 3.955}, {2.876061979166667, 
        3.6725000000000003}, {3.042325, 3.39}, {3.1952869791666667, 
        3.1075}, {3.3349479166666667, 2.825}, {3.4613078125000003, 
        2.5425}, {3.5743666666666667, 2.26}, {3.6741244791666667, 
        1.9775}, {3.76058125, 1.6949999999999998}, 
       {3.833736979166667, 1.4124999999999996}, {3.8935916666666666, 
        1.13}, {3.9401453125, 0.8475000000000001}, 
       {3.973397916666667, 0.5649999999999995}, {3.9933494791666666, 
        0.28249999999999975}, {4., 0.}, {3.9933494791666666, 
        -0.28250000000000064}, {3.9733979166666664, 
        -0.5650000000000004}, {3.9401453125, -0.8475000000000001}, 
       {3.8935916666666666, -1.1300000000000008}, {3.8337369791666664, 
        -1.4125000000000005}, {3.76058125, -1.6950000000000003}, 
       {3.6741244791666667, -1.9775}, {3.5743666666666662, 
        -2.2600000000000007}, {3.4613078125, -2.5425000000000004}, 
       {3.3349479166666662, -2.825000000000001}, {3.1952869791666667, 
        -3.1075}, {3.042325, -3.3900000000000006}, 
       {2.876061979166666, -3.672500000000001}, {2.696497916666667, 
        -3.955}, {2.5036328124999994, -4.237500000000001}, 
       {2.297466666666666, -4.520000000000001}, {2.0779994791666665, 
        -4.8025}, {1.8452312499999994, -5.085000000000001}, 
       {1.5991619791666656, -5.3675000000000015}, {1.3397916666666667, 
        -5.65}, {1.3397916666666667, -5.65}}, 
      {{9.414603431411972, -11.95}, {12.208840053799115, -11.3525}, 
       {13.642891004388748, -10.754999999999999}, {14.709759581999093, 
        -10.157499999999999}, {15.573326954313629, -9.559999999999999}, 
       {16.299873531837402, -8.962499999999999}, {16.924181391558115, 
        -8.364999999999998}, {17.46720897243435, -7.767499999999999}, 
       {17.942726928795043, -7.169999999999999}, {18.360332059211764, 
        -6.572499999999999}, {18.726998563905845, -5.974999999999999}, 
       {19.04795089616548, -5.377499999999999}, {19.327188752049782, 
        -4.779999999999999}, {19.567819448749578, -4.182499999999999}, 
       {19.772276903574333, -3.584999999999999}, {19.942470354542216, 
        -2.987499999999999}, {20.079887577802207, -2.389999999999999}, 
       {20.18566740897643, -1.7924999999999986}, {20.260650706742243, 
        -1.1949999999999985}, {20.305415508412924, -0.5974999999999984}, 
       {20.3203, 1.7763568394002505*^-15}, {20.305415508412924, 
        0.5975000000000019}, {20.260650706742243, 1.195000000000002}, 
       {20.18566740897643, 1.7925000000000022}, {20.079887577802207, 
        2.3900000000000006}, {19.942470354542216, 2.9875000000000007}, 
       {19.772276903574333, 3.585000000000001}, {19.567819448749574, 
        4.182500000000001}, {19.32718875204978, 4.780000000000001}, 
       {19.047950896165478, 5.377500000000001}, {18.726998563905845, 
        5.975000000000001}, {18.360332059211764, 6.572500000000002}, 
       {17.94272692879504, 7.170000000000002}, {17.46720897243435, 
        7.767500000000002}, {16.924181391558115, 8.365000000000002}, 
       {16.2998735318374, 8.962500000000002}, {15.573326954313622, 
        9.560000000000002}, {14.709759581999087, 10.157500000000002}, 
       {13.64289100438874, 10.755000000000003}, {12.208840053799104, 
        11.352500000000003}, {9.414603431411933, 11.950000000000003}, 
       {9.414603431411972, 11.95}, {12.208840053799115, 11.3525}, 
       {13.642891004388748, 10.754999999999999}, {14.709759581999093, 
        10.157499999999999}, {15.573326954313629, 9.559999999999999}, 
       {16.299873531837402, 8.962499999999999}, {16.924181391558115, 
        8.364999999999998}, {17.46720897243435, 7.767499999999999}, 
       {17.942726928795043, 7.169999999999999}, {18.360332059211764, 
        6.572499999999999}, {18.726998563905845, 5.974999999999999}, 
       {19.04795089616548, 5.377499999999999}, {19.327188752049782, 
        4.779999999999999}, {19.567819448749578, 4.182499999999999}, 
       {19.772276903574333, 3.584999999999999}, {19.942470354542216, 
        2.987499999999999}, {20.079887577802207, 2.389999999999999}, 
       {20.18566740897643, 1.7924999999999986}, {20.260650706742243, 
        1.1949999999999985}, {20.305415508412924, 0.5974999999999984}, 
       {20.3203, -1.7763568394002505*^-15}, {20.305415508412924, 
        -0.5975000000000019}, {20.260650706742243, -1.195000000000002}, 
       {20.18566740897643, -1.7925000000000022}, {20.079887577802207, 
        -2.3900000000000006}, {19.942470354542216, -2.9875000000000007}, 
       {19.772276903574333, -3.585000000000001}, {19.567819448749574, 
        -4.182500000000001}, {19.32718875204978, -4.780000000000001}, 
       {19.047950896165478, -5.377500000000001}, {18.726998563905845, 
        -5.975000000000001}, {18.360332059211764, -6.572500000000002}, 
       {17.94272692879504, -7.170000000000002}, {17.46720897243435, 
        -7.767500000000002}, {16.924181391558115, -8.365000000000002}, 
       {16.2998735318374, -8.962500000000002}, {15.573326954313622, 
        -9.560000000000002}, {14.709759581999087, -10.157500000000002}, 
       {13.64289100438874, -10.755000000000003}, {12.208840053799104, 
        -11.352500000000003}, {9.414603431411933, -11.950000000000003}, 
       {9.414603431411972, -11.95}}}]}}, ControlType -> None}, 
 {{staticpolygons211864020083128460945430, 
   {GrayLevel[0], AbsoluteThickness[0.5], 
    Line[{{{-0.654121133468629, -6.25, 0.}, {-0.9903057458473903, 
        -5.9375, 0.}, {-1.2964078972773794, -5.625, 0.}, 
       {-1.575713724426754, -5.3125, 0.}, {-1.830815380800448, -5., 0.}, 
       {-2.0637952929044054, -4.6875, 0.}, {-2.276351075688101, -4.375, 
        0.}, {-2.4698828946113975, -4.0625, 0.}, {-2.645556176913418, 
        -3.75, 0.}, {-2.8043476264468827, -3.4375, 0.}, 
       {-2.947079616577351, -3.125, 0.}, {-3.0744462949685563, -2.8125, 
        0.}, {-3.1870336467217917, -2.5, 0.}, {-3.285335063038256, 
        -2.1875, 0.}, {-3.3697635009278692, -1.875, 0.}, 
       {-3.4406610073320936, -1.5625, 0.}, {-3.4983061651113845, -1.25, 
        0.}, {-3.542919865616026, -0.9375, 0.}, {-3.5746697019586033, 
        -0.625, 0.}, {-3.593673194879362, -0.3125, 0.}, 
       {-3.5999999999999996, 0., 0.}, {-3.593673194879362, 0.3125, 0.}, 
       {-3.5746697019586033, 0.625, 0.}, {-3.542919865616026, 0.9375, 
        0.}, {-3.4983061651113845, 1.25, 0.}, {-3.4406610073320936, 
        1.5625, 0.}, {-3.3697635009278692, 1.875, 0.}, 
       {-3.285335063038256, 2.1875, 0.}, {-3.1870336467217917, 2.5, 0.}, 
       {-3.0744462949685563, 2.8125, 0.}, {-2.947079616577351, 3.125, 
        0.}, {-2.8043476264468827, 3.4375, 0.}, {-2.645556176913418, 
        3.75, 0.}, {-2.4698828946113975, 4.0625, 0.}, 
       {-2.276351075688101, 4.375, 0.}, {-2.0637952929044054, 4.6875, 
        0.}, {-1.830815380800448, 5., 0.}, {-1.575713724426754, 5.3125, 
        0.}, {-1.2964078972773794, 5.625, 0.}, {-0.9903057458473903, 
        5.9375, 0.}, {-0.654121133468629, 6.25, 0.}, 
       {-0.654121133468629, 6.25, 0.}, {-0.9903057458473903, 5.9375, 
        0.}, {-1.2964078972773794, 5.625, 0.}, {-1.575713724426754, 
        5.3125, 0.}, {-1.830815380800448, 5., 0.}, 
       {-2.0637952929044054, 4.6875, 0.}, {-2.276351075688101, 4.375, 
        0.}, {-2.4698828946113975, 4.0625, 0.}, {-2.645556176913418, 
        3.75, 0.}, {-2.8043476264468827, 3.4375, 0.}, 
       {-2.947079616577351, 3.125, 0.}, {-3.0744462949685563, 2.8125, 
        0.}, {-3.1870336467217917, 2.5, 0.}, {-3.285335063038256, 
        2.1875, 0.}, {-3.3697635009278692, 1.875, 0.}, 
       {-3.4406610073320936, 1.5625, 0.}, {-3.4983061651113845, 1.25, 
        0.}, {-3.542919865616026, 0.9375, 0.}, {-3.5746697019586033, 
        0.625, 0.}, {-3.593673194879362, 0.3125, 0.}, 
       {-3.5999999999999996, 0., 0.}, {-3.593673194879362, -0.3125, 0.}, 
       {-3.5746697019586033, -0.625, 0.}, {-3.542919865616026, -0.9375, 
        0.}, {-3.4983061651113845, -1.25, 0.}, {-3.4406610073320936, 
        -1.5625, 0.}, {-3.3697635009278692, -1.875, 0.}, 
       {-3.285335063038256, -2.1875, 0.}, {-3.1870336467217917, -2.5, 
        0.}, {-3.0744462949685563, -2.8125, 0.}, {-2.947079616577351, 
        -3.125, 0.}, {-2.8043476264468827, -3.4375, 0.}, 
       {-2.645556176913418, -3.75, 0.}, {-2.4698828946113975, -4.0625, 
        0.}, {-2.276351075688101, -4.375, 0.}, {-2.0637952929044054, 
        -4.6875, 0.}, {-1.830815380800448, -5., 0.}, 
       {-1.575713724426754, -5.3125, 0.}, {-1.2964078972773794, -5.625, 
        0.}, {-0.9903057458473903, -5.9375, 0.}, {-0.654121133468629, 
        -6.25, 0.}, {-0.654121133468629, -6.25, 0.}}, 
      {{-0.654121133468629, 0., -6.25}, {-0.9903057458473903, 0., 
        -5.9375}, {-1.2964078972773794, 0., -5.625}, 
       {-1.575713724426754, 0., -5.3125}, {-1.830815380800448, 0., -5.}, 
       {-2.0637952929044054, 0., -4.6875}, {-2.276351075688101, 0., 
        -4.375}, {-2.4698828946113975, 0., -4.0625}, 
       {-2.645556176913418, 0., -3.75}, {-2.8043476264468827, 0., 
        -3.4375}, {-2.947079616577351, 0., -3.125}, 
       {-3.0744462949685563, 0., -2.8125}, {-3.1870336467217917, 0., 
        -2.5}, {-3.285335063038256, 0., -2.1875}, {-3.3697635009278692, 
        0., -1.875}, {-3.4406610073320936, 0., -1.5625}, 
       {-3.4983061651113845, 0., -1.25}, {-3.542919865616026, 0., 
        -0.9375}, {-3.5746697019586033, 0., -0.625}, 
       {-3.593673194879362, 0., -0.3125}, {-3.5999999999999996, 0., 0.}, 
       {-3.593673194879362, 0., 0.3125}, {-3.5746697019586033, 0., 
        0.625}, {-3.542919865616026, 0., 0.9375}, {-3.4983061651113845, 
        0., 1.25}, {-3.4406610073320936, 0., 1.5625}, 
       {-3.3697635009278692, 0., 1.875}, {-3.285335063038256, 0., 
        2.1875}, {-3.1870336467217917, 0., 2.5}, {-3.0744462949685563, 
        0., 2.8125}, {-2.947079616577351, 0., 3.125}, 
       {-2.8043476264468827, 0., 3.4375}, {-2.645556176913418, 0., 
        3.75}, {-2.4698828946113975, 0., 4.0625}, {-2.276351075688101, 
        0., 4.375}, {-2.0637952929044054, 0., 4.6875}, 
       {-1.830815380800448, 0., 5.}, {-1.575713724426754, 0., 5.3125}, 
       {-1.2964078972773794, 0., 5.625}, {-0.9903057458473903, 0., 
        5.9375}, {-0.654121133468629, 0., 6.25}, {-0.654121133468629, 
        0., 6.25}, {-0.9903057458473903, 0., 5.9375}, 
       {-1.2964078972773794, 0., 5.625}, {-1.575713724426754, 0., 
        5.3125}, {-1.830815380800448, 0., 5.}, {-2.0637952929044054, 0., 
        4.6875}, {-2.276351075688101, 0., 4.375}, {-2.4698828946113975, 
        0., 4.0625}, {-2.645556176913418, 0., 3.75}, 
       {-2.8043476264468827, 0., 3.4375}, {-2.947079616577351, 0., 
        3.125}, {-3.0744462949685563, 0., 2.8125}, 
       {-3.1870336467217917, 0., 2.5}, {-3.285335063038256, 0., 2.1875}, 
       {-3.3697635009278692, 0., 1.875}, {-3.4406610073320936, 0., 
        1.5625}, {-3.4983061651113845, 0., 1.25}, {-3.542919865616026, 
        0., 0.9375}, {-3.5746697019586033, 0., 0.625}, 
       {-3.593673194879362, 0., 0.3125}, {-3.5999999999999996, 0., 0.}, 
       {-3.593673194879362, 0., -0.3125}, {-3.5746697019586033, 0., 
        -0.625}, {-3.542919865616026, 0., -0.9375}, 
       {-3.4983061651113845, 0., -1.25}, {-3.4406610073320936, 0., 
        -1.5625}, {-3.3697635009278692, 0., -1.875}, 
       {-3.285335063038256, 0., -2.1875}, {-3.1870336467217917, 0., 
        -2.5}, {-3.0744462949685563, 0., -2.8125}, 
       {-2.947079616577351, 0., -3.125}, {-2.8043476264468827, 0., 
        -3.4375}, {-2.645556176913418, 0., -3.75}, 
       {-2.4698828946113975, 0., -4.0625}, {-2.276351075688101, 0., 
        -4.375}, {-2.0637952929044054, 0., -4.6875}, 
       {-1.830815380800448, 0., -5.}, {-1.575713724426754, 0., -5.3125}, 
       {-1.2964078972773794, 0., -5.625}, {-0.9903057458473903, 0., 
        -5.9375}, {-0.654121133468629, 0., -6.25}, 
       {-0.654121133468629, 0., -6.25}}, 
      {{-0.7033119314590373, -5., 0.}, {-0.9870598373247121, -4.75, 0.}, 
       {-1.2404157598234296, -4.5, 0.}, {-1.4680788932265, -4.25, 0.}, 
       {-1.6734753829797988, -4., 0.}, {-1.8591901453988253, -3.75, 0.}, 
       {-2.027225575051661, -3.5, 0.}, {-2.1791651245988506, -3.25, 0.}, 
       {-2.316281297335398, -3., 0.}, {-2.4396094946948734, -2.75, 0.}, 
       {-2.55, -2.5, 0.}, {-2.648155458825234, -2.25, 0.}, 
       {-2.7346584384264903, -2., 0.}, {-2.8099920127744573, -1.75, 0.}, 
       {-2.874555320336759, -1.5, 0.}, {-2.9286754110865365, -1.25, 0.}, 
       {-2.9726162893325645, -1., 0.}, {-3.0065857850724784, -0.75, 0.}, 
       {-3.03074069840786, -0.5, 0.}, {-3.04519052838329, -0.25, 0.}, 
       {-3.05, 0., 0.}, {-3.04519052838329, 0.25, 0.}, 
       {-3.03074069840786, 0.5, 0.}, {-3.0065857850724784, 0.75, 0.}, 
       {-2.9726162893325645, 1., 0.}, {-2.9286754110865365, 1.25, 0.}, 
       {-2.874555320336759, 1.5, 0.}, {-2.8099920127744573, 1.75, 0.}, 
       {-2.7346584384264903, 2., 0.}, {-2.648155458825234, 2.25, 0.}, 
       {-2.55, 2.5, 0.}, {-2.4396094946948734, 2.75, 0.}, 
       {-2.316281297335398, 3., 0.}, {-2.1791651245988506, 3.25, 0.}, 
       {-2.027225575051661, 3.5, 0.}, {-1.8591901453988253, 3.75, 0.}, 
       {-1.6734753829797988, 4., 0.}, {-1.4680788932265, 4.25, 0.}, 
       {-1.2404157598234296, 4.5, 0.}, {-0.9870598373247121, 4.75, 0.}, 
       {-0.7033119314590373, 5., 0.}, {-0.7033119314590373, 5., 0.}, 
       {-0.9870598373247121, 4.75, 0.}, {-1.2404157598234296, 4.5, 0.}, 
       {-1.4680788932265, 4.25, 0.}, {-1.6734753829797988, 4., 0.}, 
       {-1.8591901453988253, 3.75, 0.}, {-2.027225575051661, 3.5, 0.}, 
       {-2.1791651245988506, 3.25, 0.}, {-2.316281297335398, 3., 0.}, 
       {-2.4396094946948734, 2.75, 0.}, {-2.55, 2.5, 0.}, 
       {-2.648155458825234, 2.25, 0.}, {-2.7346584384264903, 2., 0.}, 
       {-2.8099920127744573, 1.75, 0.}, {-2.874555320336759, 1.5, 0.}, 
       {-2.9286754110865365, 1.25, 0.}, {-2.9726162893325645, 1., 0.}, 
       {-3.0065857850724784, 0.75, 0.}, {-3.03074069840786, 0.5, 0.}, 
       {-3.04519052838329, 0.25, 0.}, {-3.05, 0., 0.}, 
       {-3.04519052838329, -0.25, 0.}, {-3.03074069840786, -0.5, 0.}, 
       {-3.0065857850724784, -0.75, 0.}, {-2.9726162893325645, -1., 0.}, 
       {-2.9286754110865365, -1.25, 0.}, {-2.874555320336759, -1.5, 0.}, 
       {-2.8099920127744573, -1.75, 0.}, {-2.7346584384264903, -2., 0.}, 
       {-2.648155458825234, -2.25, 0.}, {-2.55, -2.5, 0.}, 
       {-2.4396094946948734, -2.75, 0.}, {-2.316281297335398, -3., 0.}, 
       {-2.1791651245988506, -3.25, 0.}, {-2.027225575051661, -3.5, 0.}, 
       {-1.8591901453988253, -3.75, 0.}, {-1.6734753829797988, -4., 0.}, 
       {-1.4680788932265, -4.25, 0.}, {-1.2404157598234296, -4.5, 0.}, 
       {-0.9870598373247121, -4.75, 0.}, {-0.7033119314590373, -5., 0.}, 
       {-0.7033119314590373, -5., 0.}}, {{-0.7033119314590373, 0., -5.}, 
       {-0.9870598373247121, 0., -4.75}, {-1.2404157598234296, 0., 
        -4.5}, {-1.4680788932265, 0., -4.25}, {-1.6734753829797988, 0., 
        -4.}, {-1.8591901453988253, 0., -3.75}, {-2.027225575051661, 0., 
        -3.5}, {-2.1791651245988506, 0., -3.25}, {-2.316281297335398, 
        0., -3.}, {-2.4396094946948734, 0., -2.75}, {-2.55, 0., -2.5}, 
       {-2.648155458825234, 0., -2.25}, {-2.7346584384264903, 0., -2.}, 
       {-2.8099920127744573, 0., -1.75}, {-2.874555320336759, 0., -1.5}, 
       {-2.9286754110865365, 0., -1.25}, {-2.9726162893325645, 0., -1.}, 
       {-3.0065857850724784, 0., -0.75}, {-3.03074069840786, 0., -0.5}, 
       {-3.04519052838329, 0., -0.25}, {-3.05, 0., 0.}, 
       {-3.04519052838329, 0., 0.25}, {-3.03074069840786, 0., 0.5}, 
       {-3.0065857850724784, 0., 0.75}, {-2.9726162893325645, 0., 1.}, 
       {-2.9286754110865365, 0., 1.25}, {-2.874555320336759, 0., 1.5}, 
       {-2.8099920127744573, 0., 1.75}, {-2.7346584384264903, 0., 2.}, 
       {-2.648155458825234, 0., 2.25}, {-2.55, 0., 2.5}, 
       {-2.4396094946948734, 0., 2.75}, {-2.316281297335398, 0., 3.}, 
       {-2.1791651245988506, 0., 3.25}, {-2.027225575051661, 0., 3.5}, 
       {-1.8591901453988253, 0., 3.75}, {-1.6734753829797988, 0., 4.}, 
       {-1.4680788932265, 0., 4.25}, {-1.2404157598234296, 0., 4.5}, 
       {-0.9870598373247121, 0., 4.75}, {-0.7033119314590373, 0., 5.}, 
       {-0.7033119314590373, 0., 5.}, {-0.9870598373247121, 0., 4.75}, 
       {-1.2404157598234296, 0., 4.5}, {-1.4680788932265, 0., 4.25}, 
       {-1.6734753829797988, 0., 4.}, {-1.8591901453988253, 0., 3.75}, 
       {-2.027225575051661, 0., 3.5}, {-2.1791651245988506, 0., 3.25}, 
       {-2.316281297335398, 0., 3.}, {-2.4396094946948734, 0., 2.75}, 
       {-2.55, 0., 2.5}, {-2.648155458825234, 0., 2.25}, 
       {-2.7346584384264903, 0., 2.}, {-2.8099920127744573, 0., 1.75}, 
       {-2.874555320336759, 0., 1.5}, {-2.9286754110865365, 0., 1.25}, 
       {-2.9726162893325645, 0., 1.}, {-3.0065857850724784, 0., 0.75}, 
       {-3.03074069840786, 0., 0.5}, {-3.04519052838329, 0., 0.25}, 
       {-3.05, 0., 0.}, {-3.04519052838329, 0., -0.25}, 
       {-3.03074069840786, 0., -0.5}, {-3.0065857850724784, 0., -0.75}, 
       {-2.9726162893325645, 0., -1.}, {-2.9286754110865365, 0., -1.25}, 
       {-2.874555320336759, 0., -1.5}, {-2.8099920127744573, 0., -1.75}, 
       {-2.7346584384264903, 0., -2.}, {-2.648155458825234, 0., -2.25}, 
       {-2.55, 0., -2.5}, {-2.4396094946948734, 0., -2.75}, 
       {-2.316281297335398, 0., -3.}, {-2.1791651245988506, 0., -3.25}, 
       {-2.027225575051661, 0., -3.5}, {-1.8591901453988253, 0., -3.75}, 
       {-1.6734753829797988, 0., -4.}, {-1.4680788932265, 0., -4.25}, 
       {-1.2404157598234296, 0., -4.5}, {-0.9870598373247121, 0., 
        -4.75}, {-0.7033119314590373, 0., -5.}, {-0.7033119314590373, 
        0., -5.}}, {{-0.05, -2.5, 0.}, {-0.05, -2.375, 0.}, 
       {-0.05, -2.25, 0.}, {-0.05, -2.125, 0.}, {-0.05, -2., 0.}, 
       {-0.05, -1.875, 0.}, {-0.05, -1.75, 0.}, {-0.05, -1.625, 0.}, 
       {-0.05, -1.5, 0.}, {-0.05, -1.375, 0.}, {-0.05, -1.25, 0.}, 
       {-0.05, -1.125, 0.}, {-0.05, -1., 0.}, {-0.05, -0.875, 0.}, 
       {-0.05, -0.75, 0.}, {-0.05, -0.625, 0.}, {-0.05, -0.5, 0.}, 
       {-0.05, -0.375, 0.}, {-0.05, -0.25, 0.}, {-0.05, -0.125, 0.}, 
       {-0.05, 0., 0.}, {-0.05, 0.125, 0.}, {-0.05, 0.25, 0.}, 
       {-0.05, 0.375, 0.}, {-0.05, 0.5, 0.}, {-0.05, 0.625, 0.}, 
       {-0.05, 0.75, 0.}, {-0.05, 0.875, 0.}, {-0.05, 1., 0.}, 
       {-0.05, 1.125, 0.}, {-0.05, 1.25, 0.}, {-0.05, 1.375, 0.}, 
       {-0.05, 1.5, 0.}, {-0.05, 1.625, 0.}, {-0.05, 1.75, 0.}, 
       {-0.05, 1.875, 0.}, {-0.05, 2., 0.}, {-0.05, 2.125, 0.}, 
       {-0.05, 2.25, 0.}, {-0.05, 2.375, 0.}, {-0.05, 2.5, 0.}, 
       {-0.05, 2.5, 0.}, {-0.05, 2.375, 0.}, {-0.05, 2.25, 0.}, 
       {-0.05, 2.125, 0.}, {-0.05, 2., 0.}, {-0.05, 1.875, 0.}, 
       {-0.05, 1.75, 0.}, {-0.05, 1.625, 0.}, {-0.05, 1.5, 0.}, 
       {-0.05, 1.375, 0.}, {-0.05, 1.25, 0.}, {-0.05, 1.125, 0.}, 
       {-0.05, 1., 0.}, {-0.05, 0.875, 0.}, {-0.05, 0.75, 0.}, 
       {-0.05, 0.625, 0.}, {-0.05, 0.5, 0.}, {-0.05, 0.375, 0.}, 
       {-0.05, 0.25, 0.}, {-0.05, 0.125, 0.}, {-0.05, 0., 0.}, 
       {-0.05, -0.125, 0.}, {-0.05, -0.25, 0.}, {-0.05, -0.375, 0.}, 
       {-0.05, -0.5, 0.}, {-0.05, -0.625, 0.}, {-0.05, -0.75, 0.}, 
       {-0.05, -0.875, 0.}, {-0.05, -1., 0.}, {-0.05, -1.125, 0.}, 
       {-0.05, -1.25, 0.}, {-0.05, -1.375, 0.}, {-0.05, -1.5, 0.}, 
       {-0.05, -1.625, 0.}, {-0.05, -1.75, 0.}, {-0.05, -1.875, 0.}, 
       {-0.05, -2., 0.}, {-0.05, -2.125, 0.}, {-0.05, -2.25, 0.}, 
       {-0.05, -2.375, 0.}, {-0.05, -2.5, 0.}, {-0.05, -2.5, 0.}}, 
      {{-0.05, 0., -2.5}, {-0.05, 0., -2.375}, {-0.05, 0., -2.25}, 
       {-0.05, 0., -2.125}, {-0.05, 0., -2.}, {-0.05, 0., -1.875}, 
       {-0.05, 0., -1.75}, {-0.05, 0., -1.625}, {-0.05, 0., -1.5}, 
       {-0.05, 0., -1.375}, {-0.05, 0., -1.25}, {-0.05, 0., -1.125}, 
       {-0.05, 0., -1.}, {-0.05, 0., -0.875}, {-0.05, 0., -0.75}, 
       {-0.05, 0., -0.625}, {-0.05, 0., -0.5}, {-0.05, 0., -0.375}, 
       {-0.05, 0., -0.25}, {-0.05, 0., -0.125}, {-0.05, 0., 0.}, 
       {-0.05, 0., 0.125}, {-0.05, 0., 0.25}, {-0.05, 0., 0.375}, 
       {-0.05, 0., 0.5}, {-0.05, 0., 0.625}, {-0.05, 0., 0.75}, 
       {-0.05, 0., 0.875}, {-0.05, 0., 1.}, {-0.05, 0., 1.125}, 
       {-0.05, 0., 1.25}, {-0.05, 0., 1.375}, {-0.05, 0., 1.5}, 
       {-0.05, 0., 1.625}, {-0.05, 0., 1.75}, {-0.05, 0., 1.875}, 
       {-0.05, 0., 2.}, {-0.05, 0., 2.125}, {-0.05, 0., 2.25}, 
       {-0.05, 0., 2.375}, {-0.05, 0., 2.5}, {-0.05, 0., 2.5}, 
       {-0.05, 0., 2.375}, {-0.05, 0., 2.25}, {-0.05, 0., 2.125}, 
       {-0.05, 0., 2.}, {-0.05, 0., 1.875}, {-0.05, 0., 1.75}, 
       {-0.05, 0., 1.625}, {-0.05, 0., 1.5}, {-0.05, 0., 1.375}, 
       {-0.05, 0., 1.25}, {-0.05, 0., 1.125}, {-0.05, 0., 1.}, 
       {-0.05, 0., 0.875}, {-0.05, 0., 0.75}, {-0.05, 0., 0.625}, 
       {-0.05, 0., 0.5}, {-0.05, 0., 0.375}, {-0.05, 0., 0.25}, 
       {-0.05, 0., 0.125}, {-0.05, 0., 0.}, {-0.05, 0., -0.125}, 
       {-0.05, 0., -0.25}, {-0.05, 0., -0.375}, {-0.05, 0., -0.5}, 
       {-0.05, 0., -0.625}, {-0.05, 0., -0.75}, {-0.05, 0., -0.875}, 
       {-0.05, 0., -1.}, {-0.05, 0., -1.125}, {-0.05, 0., -1.25}, 
       {-0.05, 0., -1.375}, {-0.05, 0., -1.5}, {-0.05, 0., -1.625}, 
       {-0.05, 0., -1.75}, {-0.05, 0., -1.875}, {-0.05, 0., -2.}, 
       {-0.05, 0., -2.125}, {-0.05, 0., -2.25}, {-0.05, 0., -2.375}, 
       {-0.05, 0., -2.5}, {-0.05, 0., -2.5}}, {{-0.05, -5., 0.}, 
       {-0.05, -4.9375, 0.}, {-0.05, -4.875, 0.}, {-0.05, -4.8125, 0.}, 
       {-0.05, -4.75, 0.}, {-0.05, -4.6875, 0.}, {-0.05, -4.625, 0.}, 
       {-0.05, -4.5625, 0.}, {-0.05, -4.5, 0.}, {-0.05, -4.4375, 0.}, 
       {-0.05, -4.375, 0.}, {-0.05, -4.3125, 0.}, {-0.05, -4.25, 0.}, 
       {-0.05, -4.1875, 0.}, {-0.05, -4.125, 0.}, {-0.05, -4.0625, 0.}, 
       {-0.05, -4., 0.}, {-0.05, -3.9375, 0.}, {-0.05, -3.875, 0.}, 
       {-0.05, -3.8125, 0.}, {-0.05, -3.75, 0.}, {-0.05, -3.6875, 0.}, 
       {-0.05, -3.625, 0.}, {-0.05, -3.5625, 0.}, {-0.05, -3.5, 0.}, 
       {-0.05, -3.4375, 0.}, {-0.05, -3.375, 0.}, {-0.05, -3.3125, 0.}, 
       {-0.05, -3.25, 0.}, {-0.05, -3.1875, 0.}, {-0.05, -3.125, 0.}, 
       {-0.05, -3.0625, 0.}, {-0.05, -3., 0.}, {-0.05, -2.9375, 0.}, 
       {-0.05, -2.875, 0.}, {-0.05, -2.8125, 0.}, {-0.05, -2.75, 0.}, 
       {-0.05, -2.6875, 0.}, {-0.05, -2.625, 0.}, {-0.05, -2.5625, 0.}, 
       {-0.05, -2.5, 0.}, {-0.05, -2.5, 0.}, {-0.05, -2.5625, 0.}, 
       {-0.05, -2.625, 0.}, {-0.05, -2.6875, 0.}, {-0.05, -2.75, 0.}, 
       {-0.05, -2.8125, 0.}, {-0.05, -2.875, 0.}, {-0.05, -2.9375, 0.}, 
       {-0.05, -3., 0.}, {-0.05, -3.0625, 0.}, {-0.05, -3.125, 0.}, 
       {-0.05, -3.1875, 0.}, {-0.05, -3.25, 0.}, {-0.05, -3.3125, 0.}, 
       {-0.05, -3.375, 0.}, {-0.05, -3.4375, 0.}, {-0.05, -3.5, 0.}, 
       {-0.05, -3.5625, 0.}, {-0.05, -3.625, 0.}, {-0.05, -3.6875, 0.}, 
       {-0.05, -3.75, 0.}, {-0.05, -3.8125, 0.}, {-0.05, -3.875, 0.}, 
       {-0.05, -3.9375, 0.}, {-0.05, -4., 0.}, {-0.05, -4.0625, 0.}, 
       {-0.05, -4.125, 0.}, {-0.05, -4.1875, 0.}, {-0.05, -4.25, 0.}, 
       {-0.05, -4.3125, 0.}, {-0.05, -4.375, 0.}, {-0.05, -4.4375, 0.}, 
       {-0.05, -4.5, 0.}, {-0.05, -4.5625, 0.}, {-0.05, -4.625, 0.}, 
       {-0.05, -4.6875, 0.}, {-0.05, -4.75, 0.}, {-0.05, -4.8125, 0.}, 
       {-0.05, -4.875, 0.}, {-0.05, -4.9375, 0.}, {-0.05, -5., 0.}, 
       {-0.05, -5., 0.}}, {{-0.05, 2.5, 0.}, {-0.05, 2.5625, 0.}, 
       {-0.05, 2.625, 0.}, {-0.05, 2.6875, 0.}, {-0.05, 2.75, 0.}, 
       {-0.05, 2.8125, 0.}, {-0.05, 2.875, 0.}, {-0.05, 2.9375, 0.}, 
       {-0.05, 3., 0.}, {-0.05, 3.0625, 0.}, {-0.05, 3.125, 0.}, 
       {-0.05, 3.1875, 0.}, {-0.05, 3.25, 0.}, {-0.05, 3.3125, 0.}, 
       {-0.05, 3.375, 0.}, {-0.05, 3.4375, 0.}, {-0.05, 3.5, 0.}, 
       {-0.05, 3.5625, 0.}, {-0.05, 3.625, 0.}, {-0.05, 3.6875, 0.}, 
       {-0.05, 3.75, 0.}, {-0.05, 3.8125, 0.}, {-0.05, 3.875, 0.}, 
       {-0.05, 3.9375, 0.}, {-0.05, 4., 0.}, {-0.05, 4.0625, 0.}, 
       {-0.05, 4.125, 0.}, {-0.05, 4.1875, 0.}, {-0.05, 4.25, 0.}, 
       {-0.05, 4.3125, 0.}, {-0.05, 4.375, 0.}, {-0.05, 4.4375, 0.}, 
       {-0.05, 4.5, 0.}, {-0.05, 4.5625, 0.}, {-0.05, 4.625, 0.}, 
       {-0.05, 4.6875, 0.}, {-0.05, 4.75, 0.}, {-0.05, 4.8125, 0.}, 
       {-0.05, 4.875, 0.}, {-0.05, 4.9375, 0.}, {-0.05, 5., 0.}, 
       {-0.05, 5., 0.}, {-0.05, 4.9375, 0.}, {-0.05, 4.875, 0.}, 
       {-0.05, 4.8125, 0.}, {-0.05, 4.75, 0.}, {-0.05, 4.6875, 0.}, 
       {-0.05, 4.625, 0.}, {-0.05, 4.5625, 0.}, {-0.05, 4.5, 0.}, 
       {-0.05, 4.4375, 0.}, {-0.05, 4.375, 0.}, {-0.05, 4.3125, 0.}, 
       {-0.05, 4.25, 0.}, {-0.05, 4.1875, 0.}, {-0.05, 4.125, 0.}, 
       {-0.05, 4.0625, 0.}, {-0.05, 4., 0.}, {-0.05, 3.9375, 0.}, 
       {-0.05, 3.875, 0.}, {-0.05, 3.8125, 0.}, {-0.05, 3.75, 0.}, 
       {-0.05, 3.6875, 0.}, {-0.05, 3.625, 0.}, {-0.05, 3.5625, 0.}, 
       {-0.05, 3.5, 0.}, {-0.05, 3.4375, 0.}, {-0.05, 3.375, 0.}, 
       {-0.05, 3.3125, 0.}, {-0.05, 3.25, 0.}, {-0.05, 3.1875, 0.}, 
       {-0.05, 3.125, 0.}, {-0.05, 3.0625, 0.}, {-0.05, 3., 0.}, 
       {-0.05, 2.9375, 0.}, {-0.05, 2.875, 0.}, {-0.05, 2.8125, 0.}, 
       {-0.05, 2.75, 0.}, {-0.05, 2.6875, 0.}, {-0.05, 2.625, 0.}, 
       {-0.05, 2.5625, 0.}, {-0.05, 2.5, 0.}, {-0.05, 2.5, 0.}}, 
      {{-0.05, 0., -5.}, {-0.05, 0., -4.9375}, {-0.05, 0., -4.875}, 
       {-0.05, 0., -4.8125}, {-0.05, 0., -4.75}, {-0.05, 0., -4.6875}, 
       {-0.05, 0., -4.625}, {-0.05, 0., -4.5625}, {-0.05, 0., -4.5}, 
       {-0.05, 0., -4.4375}, {-0.05, 0., -4.375}, {-0.05, 0., -4.3125}, 
       {-0.05, 0., -4.25}, {-0.05, 0., -4.1875}, {-0.05, 0., -4.125}, 
       {-0.05, 0., -4.0625}, {-0.05, 0., -4.}, {-0.05, 0., -3.9375}, 
       {-0.05, 0., -3.875}, {-0.05, 0., -3.8125}, {-0.05, 0., -3.75}, 
       {-0.05, 0., -3.6875}, {-0.05, 0., -3.625}, {-0.05, 0., -3.5625}, 
       {-0.05, 0., -3.5}, {-0.05, 0., -3.4375}, {-0.05, 0., -3.375}, 
       {-0.05, 0., -3.3125}, {-0.05, 0., -3.25}, {-0.05, 0., -3.1875}, 
       {-0.05, 0., -3.125}, {-0.05, 0., -3.0625}, {-0.05, 0., -3.}, 
       {-0.05, 0., -2.9375}, {-0.05, 0., -2.875}, {-0.05, 0., -2.8125}, 
       {-0.05, 0., -2.75}, {-0.05, 0., -2.6875}, {-0.05, 0., -2.625}, 
       {-0.05, 0., -2.5625}, {-0.05, 0., -2.5}, {-0.05, 0., -2.5}, 
       {-0.05, 0., -2.5625}, {-0.05, 0., -2.625}, {-0.05, 0., -2.6875}, 
       {-0.05, 0., -2.75}, {-0.05, 0., -2.8125}, {-0.05, 0., -2.875}, 
       {-0.05, 0., -2.9375}, {-0.05, 0., -3.}, {-0.05, 0., -3.0625}, 
       {-0.05, 0., -3.125}, {-0.05, 0., -3.1875}, {-0.05, 0., -3.25}, 
       {-0.05, 0., -3.3125}, {-0.05, 0., -3.375}, {-0.05, 0., -3.4375}, 
       {-0.05, 0., -3.5}, {-0.05, 0., -3.5625}, {-0.05, 0., -3.625}, 
       {-0.05, 0., -3.6875}, {-0.05, 0., -3.75}, {-0.05, 0., -3.8125}, 
       {-0.05, 0., -3.875}, {-0.05, 0., -3.9375}, {-0.05, 0., -4.}, 
       {-0.05, 0., -4.0625}, {-0.05, 0., -4.125}, {-0.05, 0., -4.1875}, 
       {-0.05, 0., -4.25}, {-0.05, 0., -4.3125}, {-0.05, 0., -4.375}, 
       {-0.05, 0., -4.4375}, {-0.05, 0., -4.5}, {-0.05, 0., -4.5625}, 
       {-0.05, 0., -4.625}, {-0.05, 0., -4.6875}, {-0.05, 0., -4.75}, 
       {-0.05, 0., -4.8125}, {-0.05, 0., -4.875}, {-0.05, 0., -4.9375}, 
       {-0.05, 0., -5.}, {-0.05, 0., -5.}}, {{-0.05, 0., 2.5}, 
       {-0.05, 0., 2.5625}, {-0.05, 0., 2.625}, {-0.05, 0., 2.6875}, 
       {-0.05, 0., 2.75}, {-0.05, 0., 2.8125}, {-0.05, 0., 2.875}, 
       {-0.05, 0., 2.9375}, {-0.05, 0., 3.}, {-0.05, 0., 3.0625}, 
       {-0.05, 0., 3.125}, {-0.05, 0., 3.1875}, {-0.05, 0., 3.25}, 
       {-0.05, 0., 3.3125}, {-0.05, 0., 3.375}, {-0.05, 0., 3.4375}, 
       {-0.05, 0., 3.5}, {-0.05, 0., 3.5625}, {-0.05, 0., 3.625}, 
       {-0.05, 0., 3.6875}, {-0.05, 0., 3.75}, {-0.05, 0., 3.8125}, 
       {-0.05, 0., 3.875}, {-0.05, 0., 3.9375}, {-0.05, 0., 4.}, 
       {-0.05, 0., 4.0625}, {-0.05, 0., 4.125}, {-0.05, 0., 4.1875}, 
       {-0.05, 0., 4.25}, {-0.05, 0., 4.3125}, {-0.05, 0., 4.375}, 
       {-0.05, 0., 4.4375}, {-0.05, 0., 4.5}, {-0.05, 0., 4.5625}, 
       {-0.05, 0., 4.625}, {-0.05, 0., 4.6875}, {-0.05, 0., 4.75}, 
       {-0.05, 0., 4.8125}, {-0.05, 0., 4.875}, {-0.05, 0., 4.9375}, 
       {-0.05, 0., 5.}, {-0.05, 0., 5.}, {-0.05, 0., 4.9375}, 
       {-0.05, 0., 4.875}, {-0.05, 0., 4.8125}, {-0.05, 0., 4.75}, 
       {-0.05, 0., 4.6875}, {-0.05, 0., 4.625}, {-0.05, 0., 4.5625}, 
       {-0.05, 0., 4.5}, {-0.05, 0., 4.4375}, {-0.05, 0., 4.375}, 
       {-0.05, 0., 4.3125}, {-0.05, 0., 4.25}, {-0.05, 0., 4.1875}, 
       {-0.05, 0., 4.125}, {-0.05, 0., 4.0625}, {-0.05, 0., 4.}, 
       {-0.05, 0., 3.9375}, {-0.05, 0., 3.875}, {-0.05, 0., 3.8125}, 
       {-0.05, 0., 3.75}, {-0.05, 0., 3.6875}, {-0.05, 0., 3.625}, 
       {-0.05, 0., 3.5625}, {-0.05, 0., 3.5}, {-0.05, 0., 3.4375}, 
       {-0.05, 0., 3.375}, {-0.05, 0., 3.3125}, {-0.05, 0., 3.25}, 
       {-0.05, 0., 3.1875}, {-0.05, 0., 3.125}, {-0.05, 0., 3.0625}, 
       {-0.05, 0., 3.}, {-0.05, 0., 2.9375}, {-0.05, 0., 2.875}, 
       {-0.05, 0., 2.8125}, {-0.05, 0., 2.75}, {-0.05, 0., 2.6875}, 
       {-0.05, 0., 2.625}, {-0.05, 0., 2.5625}, {-0.05, 0., 2.5}, 
       {-0.05, 0., 2.5}}, {{1.3689976525819987, -5.65, 0.}, 
       {1.249200508667663, -5.367500000000001, 0.}, 
       {1.133305718014965, -5.085, 0.}, {1.0215469448527958, -4.8025, 
        0.}, {0.9141675062554867, -4.5200000000000005, 0.}, 
       {0.8114194827665998, -4.237500000000001, 0.}, 
       {0.7135625066333096, -3.955, 0.}, {0.6208621909813115, 
        -3.6725000000000003, 0.}, {0.5335881696456211, -3.39, 0.}, 
       {0.4520117276705726, -3.1075, 0.}, {0.3764030171799524, -2.825, 
        0.}, {0.30702787256214575, -2.5425, 0.}, {0.24414426241533377, 
        -2.26, 0.}, {0.18799844254256412, -1.9775, 0.}, 
       {0.13882090285648163, -1.6949999999999998, 0.}, 
       {0.09682222901675835, -1.4124999999999996, 0.}, 
       {0.06218902406370809, -1.13, 0.}, {0.03508005301320917, 
        -0.8475000000000001, 0.}, {0.01562278125633912, 
        -0.5649999999999995, 0.}, {0.0039104732351545445, 
        -0.28249999999999975, 0.}, {0., 0., 0.}, {0.003910473235154569, 
        0.28250000000000064, 0.}, {0.01562278125633917, 
        0.5650000000000004, 0.}, {0.03508005301320917, 
        0.8475000000000001, 0.}, {0.06218902406370819, 
        1.1300000000000008, 0.}, {0.09682222901675848, 
        1.4125000000000005, 0.}, {0.13882090285648174, 
        1.6950000000000003, 0.}, {0.18799844254256412, 1.9775, 0.}, 
       {0.244144262415334, 2.2600000000000007, 0.}, 
       {0.30702787256214586, 2.5425000000000004, 0.}, 
       {0.37640301717995267, 2.825000000000001, 0.}, 
       {0.4520117276705726, 3.1075, 0.}, {0.5335881696456212, 
        3.3900000000000006, 0.}, {0.6208621909813118, 3.672500000000001, 
        0.}, {0.7135625066333096, 3.955, 0.}, {0.8114194827665998, 
        4.237500000000001, 0.}, {0.914167506255487, 4.520000000000001, 
        0.}, {1.0215469448527958, 4.8025, 0.}, {1.1333057180149655, 
        5.085000000000001, 0.}, {1.2492005086676634, 5.3675000000000015, 
        0.}, {1.3689976525819987, 5.65, 0.}, {1.3689976525819987, 5.65, 
        0.}, {1.249200508667663, 5.367500000000001, 0.}, 
       {1.133305718014965, 5.085, 0.}, {1.0215469448527958, 4.8025, 0.}, 
       {0.9141675062554867, 4.5200000000000005, 0.}, 
       {0.8114194827665998, 4.237500000000001, 0.}, 
       {0.7135625066333096, 3.955, 0.}, {0.6208621909813115, 
        3.6725000000000003, 0.}, {0.5335881696456211, 3.39, 0.}, 
       {0.4520117276705726, 3.1075, 0.}, {0.3764030171799524, 2.825, 
        0.}, {0.30702787256214575, 2.5425, 0.}, {0.24414426241533377, 
        2.26, 0.}, {0.18799844254256412, 1.9775, 0.}, 
       {0.13882090285648163, 1.6949999999999998, 0.}, 
       {0.09682222901675835, 1.4124999999999996, 0.}, 
       {0.06218902406370809, 1.13, 0.}, {0.03508005301320917, 
        0.8475000000000001, 0.}, {0.01562278125633912, 
        0.5649999999999995, 0.}, {0.0039104732351545445, 
        0.28249999999999975, 0.}, {0., 0., 0.}, {0.003910473235154569, 
        -0.28250000000000064, 0.}, {0.01562278125633917, 
        -0.5650000000000004, 0.}, {0.03508005301320917, 
        -0.8475000000000001, 0.}, {0.06218902406370819, 
        -1.1300000000000008, 0.}, {0.09682222901675848, 
        -1.4125000000000005, 0.}, {0.13882090285648174, 
        -1.6950000000000003, 0.}, {0.18799844254256412, -1.9775, 0.}, 
       {0.244144262415334, -2.2600000000000007, 0.}, 
       {0.30702787256214586, -2.5425000000000004, 0.}, 
       {0.37640301717995267, -2.825000000000001, 0.}, 
       {0.4520117276705726, -3.1075, 0.}, {0.5335881696456212, 
        -3.3900000000000006, 0.}, {0.6208621909813118, 
        -3.672500000000001, 0.}, {0.7135625066333096, -3.955, 0.}, 
       {0.8114194827665998, -4.237500000000001, 0.}, 
       {0.914167506255487, -4.520000000000001, 0.}, 
       {1.0215469448527958, -4.8025, 0.}, {1.1333057180149655, 
        -5.085000000000001, 0.}, {1.2492005086676634, 
        -5.3675000000000015, 0.}, {1.3689976525819987, -5.65, 0.}, 
       {1.3689976525819987, -5.65, 0.}}, 
      {{1.3689976525819987, 0., -5.65}, {1.249200508667663, 0., 
        -5.367500000000001}, {1.133305718014965, 0., -5.085}, 
       {1.0215469448527958, 0., -4.8025}, {0.9141675062554867, 0., 
        -4.5200000000000005}, {0.8114194827665998, 0., 
        -4.237500000000001}, {0.7135625066333096, 0., -3.955}, 
       {0.6208621909813115, 0., -3.6725000000000003}, 
       {0.5335881696456211, 0., -3.39}, {0.4520117276705726, 0., 
        -3.1075}, {0.3764030171799524, 0., -2.825}, 
       {0.30702787256214575, 0., -2.5425}, {0.24414426241533377, 0., 
        -2.26}, {0.18799844254256412, 0., -1.9775}, 
       {0.13882090285648163, 0., -1.6949999999999998}, 
       {0.09682222901675835, 0., -1.4124999999999996}, 
       {0.06218902406370809, 0., -1.13}, {0.03508005301320917, 0., 
        -0.8475000000000001}, {0.01562278125633912, 0., 
        -0.5649999999999995}, {0.0039104732351545445, 0., 
        -0.28249999999999975}, {0., 0., 0.}, {0.003910473235154569, 0., 
        0.28250000000000064}, {0.01562278125633917, 0., 
        0.5650000000000004}, {0.03508005301320917, 0., 
        0.8475000000000001}, {0.06218902406370819, 0., 
        1.1300000000000008}, {0.09682222901675848, 0., 
        1.4125000000000005}, {0.13882090285648174, 0., 
        1.6950000000000003}, {0.18799844254256412, 0., 1.9775}, 
       {0.244144262415334, 0., 2.2600000000000007}, 
       {0.30702787256214586, 0., 2.5425000000000004}, 
       {0.37640301717995267, 0., 2.825000000000001}, 
       {0.4520117276705726, 0., 3.1075}, {0.5335881696456212, 0., 
        3.3900000000000006}, {0.6208621909813118, 0., 
        3.672500000000001}, {0.7135625066333096, 0., 3.955}, 
       {0.8114194827665998, 0., 4.237500000000001}, 
       {0.914167506255487, 0., 4.520000000000001}, 
       {1.0215469448527958, 0., 4.8025}, {1.1333057180149655, 0., 
        5.085000000000001}, {1.2492005086676634, 0., 
        5.3675000000000015}, {1.3689976525819987, 0., 5.65}, 
       {1.3689976525819987, 0., 5.65}, {1.249200508667663, 0., 
        5.367500000000001}, {1.133305718014965, 0., 5.085}, 
       {1.0215469448527958, 0., 4.8025}, {0.9141675062554867, 0., 
        4.5200000000000005}, {0.8114194827665998, 0., 
        4.237500000000001}, {0.7135625066333096, 0., 3.955}, 
       {0.6208621909813115, 0., 3.6725000000000003}, 
       {0.5335881696456211, 0., 3.39}, {0.4520117276705726, 0., 3.1075}, 
       {0.3764030171799524, 0., 2.825}, {0.30702787256214575, 0., 
        2.5425}, {0.24414426241533377, 0., 2.26}, {0.18799844254256412, 
        0., 1.9775}, {0.13882090285648163, 0., 1.6949999999999998}, 
       {0.09682222901675835, 0., 1.4124999999999996}, 
       {0.06218902406370809, 0., 1.13}, {0.03508005301320917, 0., 
        0.8475000000000001}, {0.01562278125633912, 0., 
        0.5649999999999995}, {0.0039104732351545445, 0., 
        0.28249999999999975}, {0., 0., 0.}, {0.003910473235154569, 0., 
        -0.28250000000000064}, {0.01562278125633917, 0., 
        -0.5650000000000004}, {0.03508005301320917, 0., 
        -0.8475000000000001}, {0.06218902406370819, 0., 
        -1.1300000000000008}, {0.09682222901675848, 0., 
        -1.4125000000000005}, {0.13882090285648174, 0., 
        -1.6950000000000003}, {0.18799844254256412, 0., -1.9775}, 
       {0.244144262415334, 0., -2.2600000000000007}, 
       {0.30702787256214586, 0., -2.5425000000000004}, 
       {0.37640301717995267, 0., -2.825000000000001}, 
       {0.4520117276705726, 0., -3.1075}, {0.5335881696456212, 0., 
        -3.3900000000000006}, {0.6208621909813118, 0., 
        -3.672500000000001}, {0.7135625066333096, 0., -3.955}, 
       {0.8114194827665998, 0., -4.237500000000001}, 
       {0.914167506255487, 0., -4.520000000000001}, 
       {1.0215469448527958, 0., -4.8025}, {1.1333057180149655, 0., 
        -5.085000000000001}, {1.2492005086676634, 0., 
        -5.3675000000000015}, {1.3689976525819987, 0., -5.65}, 
       {1.3689976525819987, 0., -5.65}}, 
      {{1.3397916666666667, -5.65, 0.}, {1.5991619791666665, 
        -5.367500000000001, 0.}, {1.8452312500000003, -5.085, 0.}, 
       {2.0779994791666665, -4.8025, 0.}, {2.2974666666666663, 
        -4.5200000000000005, 0.}, {2.5036328124999994, 
        -4.237500000000001, 0.}, {2.696497916666667, -3.955, 0.}, 
       {2.876061979166667, -3.6725000000000003, 0.}, 
       {3.042325, -3.39, 0.}, {3.1952869791666667, -3.1075, 0.}, 
       {3.3349479166666667, -2.825, 0.}, {3.4613078125000003, -2.5425, 
        0.}, {3.5743666666666667, -2.26, 0.}, {3.6741244791666667, 
        -1.9775, 0.}, {3.76058125, -1.6949999999999998, 0.}, 
       {3.833736979166667, -1.4124999999999996, 0.}, 
       {3.8935916666666666, -1.13, 0.}, {3.9401453125, 
        -0.8475000000000001, 0.}, {3.973397916666667, 
        -0.5649999999999995, 0.}, {3.9933494791666666, 
        -0.28249999999999975, 0.}, {4., 0., 0.}, {3.9933494791666666, 
        0.28250000000000064, 0.}, {3.9733979166666664, 
        0.5650000000000004, 0.}, {3.9401453125, 0.8475000000000001, 0.}, 
       {3.8935916666666666, 1.1300000000000008, 0.}, 
       {3.8337369791666664, 1.4125000000000005, 0.}, 
       {3.76058125, 1.6950000000000003, 0.}, {3.6741244791666667, 
        1.9775, 0.}, {3.5743666666666662, 2.2600000000000007, 0.}, 
       {3.4613078125, 2.5425000000000004, 0.}, {3.3349479166666662, 
        2.825000000000001, 0.}, {3.1952869791666667, 3.1075, 0.}, 
       {3.042325, 3.3900000000000006, 0.}, {2.876061979166666, 
        3.672500000000001, 0.}, {2.696497916666667, 3.955, 0.}, 
       {2.5036328124999994, 4.237500000000001, 0.}, 
       {2.297466666666666, 4.520000000000001, 0.}, 
       {2.0779994791666665, 4.8025, 0.}, {1.8452312499999994, 
        5.085000000000001, 0.}, {1.5991619791666656, 5.3675000000000015, 
        0.}, {1.3397916666666667, 5.65, 0.}, {1.3397916666666667, 5.65, 
        0.}, {1.5991619791666665, 5.367500000000001, 0.}, 
       {1.8452312500000003, 5.085, 0.}, {2.0779994791666665, 4.8025, 
        0.}, {2.2974666666666663, 4.5200000000000005, 0.}, 
       {2.5036328124999994, 4.237500000000001, 0.}, 
       {2.696497916666667, 3.955, 0.}, {2.876061979166667, 
        3.6725000000000003, 0.}, {3.042325, 3.39, 0.}, 
       {3.1952869791666667, 3.1075, 0.}, {3.3349479166666667, 2.825, 
        0.}, {3.4613078125000003, 2.5425, 0.}, {3.5743666666666667, 
        2.26, 0.}, {3.6741244791666667, 1.9775, 0.}, 
       {3.76058125, 1.6949999999999998, 0.}, {3.833736979166667, 
        1.4124999999999996, 0.}, {3.8935916666666666, 1.13, 0.}, 
       {3.9401453125, 0.8475000000000001, 0.}, {3.973397916666667, 
        0.5649999999999995, 0.}, {3.9933494791666666, 
        0.28249999999999975, 0.}, {4., 0., 0.}, {3.9933494791666666, 
        -0.28250000000000064, 0.}, {3.9733979166666664, 
        -0.5650000000000004, 0.}, {3.9401453125, -0.8475000000000001, 
        0.}, {3.8935916666666666, -1.1300000000000008, 0.}, 
       {3.8337369791666664, -1.4125000000000005, 0.}, 
       {3.76058125, -1.6950000000000003, 0.}, {3.6741244791666667, 
        -1.9775, 0.}, {3.5743666666666662, -2.2600000000000007, 0.}, 
       {3.4613078125, -2.5425000000000004, 0.}, {3.3349479166666662, 
        -2.825000000000001, 0.}, {3.1952869791666667, -3.1075, 0.}, 
       {3.042325, -3.3900000000000006, 0.}, {2.876061979166666, 
        -3.672500000000001, 0.}, {2.696497916666667, -3.955, 0.}, 
       {2.5036328124999994, -4.237500000000001, 0.}, 
       {2.297466666666666, -4.520000000000001, 0.}, 
       {2.0779994791666665, -4.8025, 0.}, {1.8452312499999994, 
        -5.085000000000001, 0.}, {1.5991619791666656, 
        -5.3675000000000015, 0.}, {1.3397916666666667, -5.65, 0.}, 
       {1.3397916666666667, -5.65, 0.}}, 
      {{1.3397916666666667, 0., -5.65}, {1.5991619791666665, 0., 
        -5.367500000000001}, {1.8452312500000003, 0., -5.085}, 
       {2.0779994791666665, 0., -4.8025}, {2.2974666666666663, 0., 
        -4.5200000000000005}, {2.5036328124999994, 0., 
        -4.237500000000001}, {2.696497916666667, 0., -3.955}, 
       {2.876061979166667, 0., -3.6725000000000003}, 
       {3.042325, 0., -3.39}, {3.1952869791666667, 0., -3.1075}, 
       {3.3349479166666667, 0., -2.825}, {3.4613078125000003, 0., 
        -2.5425}, {3.5743666666666667, 0., -2.26}, 
       {3.6741244791666667, 0., -1.9775}, {3.76058125, 0., 
        -1.6949999999999998}, {3.833736979166667, 0., 
        -1.4124999999999996}, {3.8935916666666666, 0., -1.13}, 
       {3.9401453125, 0., -0.8475000000000001}, {3.973397916666667, 0., 
        -0.5649999999999995}, {3.9933494791666666, 0., 
        -0.28249999999999975}, {4., 0., 0.}, {3.9933494791666666, 0., 
        0.28250000000000064}, {3.9733979166666664, 0., 
        0.5650000000000004}, {3.9401453125, 0., 0.8475000000000001}, 
       {3.8935916666666666, 0., 1.1300000000000008}, 
       {3.8337369791666664, 0., 1.4125000000000005}, 
       {3.76058125, 0., 1.6950000000000003}, {3.6741244791666667, 0., 
        1.9775}, {3.5743666666666662, 0., 2.2600000000000007}, 
       {3.4613078125, 0., 2.5425000000000004}, {3.3349479166666662, 0., 
        2.825000000000001}, {3.1952869791666667, 0., 3.1075}, 
       {3.042325, 0., 3.3900000000000006}, {2.876061979166666, 0., 
        3.672500000000001}, {2.696497916666667, 0., 3.955}, 
       {2.5036328124999994, 0., 4.237500000000001}, 
       {2.297466666666666, 0., 4.520000000000001}, 
       {2.0779994791666665, 0., 4.8025}, {1.8452312499999994, 0., 
        5.085000000000001}, {1.5991619791666656, 0., 
        5.3675000000000015}, {1.3397916666666667, 0., 5.65}, 
       {1.3397916666666667, 0., 5.65}, {1.5991619791666665, 0., 
        5.367500000000001}, {1.8452312500000003, 0., 5.085}, 
       {2.0779994791666665, 0., 4.8025}, {2.2974666666666663, 0., 
        4.5200000000000005}, {2.5036328124999994, 0., 
        4.237500000000001}, {2.696497916666667, 0., 3.955}, 
       {2.876061979166667, 0., 3.6725000000000003}, 
       {3.042325, 0., 3.39}, {3.1952869791666667, 0., 3.1075}, 
       {3.3349479166666667, 0., 2.825}, {3.4613078125000003, 0., 
        2.5425}, {3.5743666666666667, 0., 2.26}, {3.6741244791666667, 
        0., 1.9775}, {3.76058125, 0., 1.6949999999999998}, 
       {3.833736979166667, 0., 1.4124999999999996}, 
       {3.8935916666666666, 0., 1.13}, {3.9401453125, 0., 
        0.8475000000000001}, {3.973397916666667, 0., 
        0.5649999999999995}, {3.9933494791666666, 0., 
        0.28249999999999975}, {4., 0., 0.}, {3.9933494791666666, 0., 
        -0.28250000000000064}, {3.9733979166666664, 0., 
        -0.5650000000000004}, {3.9401453125, 0., -0.8475000000000001}, 
       {3.8935916666666666, 0., -1.1300000000000008}, 
       {3.8337369791666664, 0., -1.4125000000000005}, 
       {3.76058125, 0., -1.6950000000000003}, {3.6741244791666667, 0., 
        -1.9775}, {3.5743666666666662, 0., -2.2600000000000007}, 
       {3.4613078125, 0., -2.5425000000000004}, {3.3349479166666662, 0., 
        -2.825000000000001}, {3.1952869791666667, 0., -3.1075}, 
       {3.042325, 0., -3.3900000000000006}, {2.876061979166666, 0., 
        -3.672500000000001}, {2.696497916666667, 0., -3.955}, 
       {2.5036328124999994, 0., -4.237500000000001}, 
       {2.297466666666666, 0., -4.520000000000001}, 
       {2.0779994791666665, 0., -4.8025}, {1.8452312499999994, 0., 
        -5.085000000000001}, {1.5991619791666656, 0., 
        -5.3675000000000015}, {1.3397916666666667, 0., -5.65}, 
       {1.3397916666666667, 0., -5.65}}, 
      {{9.414603431411972, -11.95, 0.}, {12.208840053799115, -11.3525, 
        0.}, {13.642891004388748, -10.754999999999999, 0.}, 
       {14.709759581999093, -10.157499999999999, 0.}, 
       {15.573326954313629, -9.559999999999999, 0.}, 
       {16.299873531837402, -8.962499999999999, 0.}, 
       {16.924181391558115, -8.364999999999998, 0.}, 
       {17.46720897243435, -7.767499999999999, 0.}, 
       {17.942726928795043, -7.169999999999999, 0.}, 
       {18.360332059211764, -6.572499999999999, 0.}, 
       {18.726998563905845, -5.974999999999999, 0.}, 
       {19.04795089616548, -5.377499999999999, 0.}, 
       {19.327188752049782, -4.779999999999999, 0.}, 
       {19.567819448749578, -4.182499999999999, 0.}, 
       {19.772276903574333, -3.584999999999999, 0.}, 
       {19.942470354542216, -2.987499999999999, 0.}, 
       {20.079887577802207, -2.389999999999999, 0.}, 
       {20.18566740897643, -1.7924999999999986, 0.}, 
       {20.260650706742243, -1.1949999999999985, 0.}, 
       {20.305415508412924, -0.5974999999999984, 0.}, 
       {20.3203, 1.7763568394002505*^-15, 0.}, {20.305415508412924, 
        0.5975000000000019, 0.}, {20.260650706742243, 1.195000000000002, 
        0.}, {20.18566740897643, 1.7925000000000022, 0.}, 
       {20.079887577802207, 2.3900000000000006, 0.}, 
       {19.942470354542216, 2.9875000000000007, 0.}, 
       {19.772276903574333, 3.585000000000001, 0.}, 
       {19.567819448749574, 4.182500000000001, 0.}, 
       {19.32718875204978, 4.780000000000001, 0.}, 
       {19.047950896165478, 5.377500000000001, 0.}, 
       {18.726998563905845, 5.975000000000001, 0.}, 
       {18.360332059211764, 6.572500000000002, 0.}, 
       {17.94272692879504, 7.170000000000002, 0.}, 
       {17.46720897243435, 7.767500000000002, 0.}, 
       {16.924181391558115, 8.365000000000002, 0.}, 
       {16.2998735318374, 8.962500000000002, 0.}, {15.573326954313622, 
        9.560000000000002, 0.}, {14.709759581999087, 10.157500000000002, 
        0.}, {13.64289100438874, 10.755000000000003, 0.}, 
       {12.208840053799104, 11.352500000000003, 0.}, 
       {9.414603431411933, 11.950000000000003, 0.}, 
       {9.414603431411972, 11.95, 0.}, {12.208840053799115, 11.3525, 
        0.}, {13.642891004388748, 10.754999999999999, 0.}, 
       {14.709759581999093, 10.157499999999999, 0.}, 
       {15.573326954313629, 9.559999999999999, 0.}, 
       {16.299873531837402, 8.962499999999999, 0.}, 
       {16.924181391558115, 8.364999999999998, 0.}, 
       {17.46720897243435, 7.767499999999999, 0.}, 
       {17.942726928795043, 7.169999999999999, 0.}, 
       {18.360332059211764, 6.572499999999999, 0.}, 
       {18.726998563905845, 5.974999999999999, 0.}, 
       {19.04795089616548, 5.377499999999999, 0.}, 
       {19.327188752049782, 4.779999999999999, 0.}, 
       {19.567819448749578, 4.182499999999999, 0.}, 
       {19.772276903574333, 3.584999999999999, 0.}, 
       {19.942470354542216, 2.987499999999999, 0.}, 
       {20.079887577802207, 2.389999999999999, 0.}, 
       {20.18566740897643, 1.7924999999999986, 0.}, 
       {20.260650706742243, 1.1949999999999985, 0.}, 
       {20.305415508412924, 0.5974999999999984, 0.}, 
       {20.3203, -1.7763568394002505*^-15, 0.}, {20.305415508412924, 
        -0.5975000000000019, 0.}, {20.260650706742243, 
        -1.195000000000002, 0.}, {20.18566740897643, 
        -1.7925000000000022, 0.}, {20.079887577802207, 
        -2.3900000000000006, 0.}, {19.942470354542216, 
        -2.9875000000000007, 0.}, {19.772276903574333, 
        -3.585000000000001, 0.}, {19.567819448749574, 
        -4.182500000000001, 0.}, {19.32718875204978, -4.780000000000001, 
        0.}, {19.047950896165478, -5.377500000000001, 0.}, 
       {18.726998563905845, -5.975000000000001, 0.}, 
       {18.360332059211764, -6.572500000000002, 0.}, 
       {17.94272692879504, -7.170000000000002, 0.}, 
       {17.46720897243435, -7.767500000000002, 0.}, 
       {16.924181391558115, -8.365000000000002, 0.}, 
       {16.2998735318374, -8.962500000000002, 0.}, 
       {15.573326954313622, -9.560000000000002, 0.}, 
       {14.709759581999087, -10.157500000000002, 0.}, 
       {13.64289100438874, -10.755000000000003, 0.}, 
       {12.208840053799104, -11.352500000000003, 0.}, 
       {9.414603431411933, -11.950000000000003, 0.}, 
       {9.414603431411972, -11.95, 0.}}, 
      {{9.414603431411972, 0., -11.95}, {12.208840053799115, 0., 
        -11.3525}, {13.642891004388748, 0., -10.754999999999999}, 
       {14.709759581999093, 0., -10.157499999999999}, 
       {15.573326954313629, 0., -9.559999999999999}, 
       {16.299873531837402, 0., -8.962499999999999}, 
       {16.924181391558115, 0., -8.364999999999998}, 
       {17.46720897243435, 0., -7.767499999999999}, 
       {17.942726928795043, 0., -7.169999999999999}, 
       {18.360332059211764, 0., -6.572499999999999}, 
       {18.726998563905845, 0., -5.974999999999999}, 
       {19.04795089616548, 0., -5.377499999999999}, 
       {19.327188752049782, 0., -4.779999999999999}, 
       {19.567819448749578, 0., -4.182499999999999}, 
       {19.772276903574333, 0., -3.584999999999999}, 
       {19.942470354542216, 0., -2.987499999999999}, 
       {20.079887577802207, 0., -2.389999999999999}, 
       {20.18566740897643, 0., -1.7924999999999986}, 
       {20.260650706742243, 0., -1.1949999999999985}, 
       {20.305415508412924, 0., -0.5974999999999984}, 
       {20.3203, 0., 1.7763568394002505*^-15}, {20.305415508412924, 0., 
        0.5975000000000019}, {20.260650706742243, 0., 
        1.195000000000002}, {20.18566740897643, 0., 1.7925000000000022}, 
       {20.079887577802207, 0., 2.3900000000000006}, 
       {19.942470354542216, 0., 2.9875000000000007}, 
       {19.772276903574333, 0., 3.585000000000001}, 
       {19.567819448749574, 0., 4.182500000000001}, 
       {19.32718875204978, 0., 4.780000000000001}, 
       {19.047950896165478, 0., 5.377500000000001}, 
       {18.726998563905845, 0., 5.975000000000001}, 
       {18.360332059211764, 0., 6.572500000000002}, 
       {17.94272692879504, 0., 7.170000000000002}, 
       {17.46720897243435, 0., 7.767500000000002}, 
       {16.924181391558115, 0., 8.365000000000002}, 
       {16.2998735318374, 0., 8.962500000000002}, {15.573326954313622, 
        0., 9.560000000000002}, {14.709759581999087, 0., 
        10.157500000000002}, {13.64289100438874, 0., 
        10.755000000000003}, {12.208840053799104, 0., 
        11.352500000000003}, {9.414603431411933, 0., 
        11.950000000000003}, {9.414603431411972, 0., 11.95}, 
       {12.208840053799115, 0., 11.3525}, {13.642891004388748, 0., 
        10.754999999999999}, {14.709759581999093, 0., 
        10.157499999999999}, {15.573326954313629, 0., 
        9.559999999999999}, {16.299873531837402, 0., 8.962499999999999}, 
       {16.924181391558115, 0., 8.364999999999998}, 
       {17.46720897243435, 0., 7.767499999999999}, 
       {17.942726928795043, 0., 7.169999999999999}, 
       {18.360332059211764, 0., 6.572499999999999}, 
       {18.726998563905845, 0., 5.974999999999999}, 
       {19.04795089616548, 0., 5.377499999999999}, 
       {19.327188752049782, 0., 4.779999999999999}, 
       {19.567819448749578, 0., 4.182499999999999}, 
       {19.772276903574333, 0., 3.584999999999999}, 
       {19.942470354542216, 0., 2.987499999999999}, 
       {20.079887577802207, 0., 2.389999999999999}, 
       {20.18566740897643, 0., 1.7924999999999986}, 
       {20.260650706742243, 0., 1.1949999999999985}, 
       {20.305415508412924, 0., 0.5974999999999984}, 
       {20.3203, 0., -1.7763568394002505*^-15}, {20.305415508412924, 0., 
        -0.5975000000000019}, {20.260650706742243, 0., 
        -1.195000000000002}, {20.18566740897643, 0., 
        -1.7925000000000022}, {20.079887577802207, 0., 
        -2.3900000000000006}, {19.942470354542216, 0., 
        -2.9875000000000007}, {19.772276903574333, 0., 
        -3.585000000000001}, {19.567819448749574, 0., 
        -4.182500000000001}, {19.32718875204978, 0., 
        -4.780000000000001}, {19.047950896165478, 0., 
        -5.377500000000001}, {18.726998563905845, 0., 
        -5.975000000000001}, {18.360332059211764, 0., 
        -6.572500000000002}, {17.94272692879504, 0., 
        -7.170000000000002}, {17.46720897243435, 0., 
        -7.767500000000002}, {16.924181391558115, 0., 
        -8.365000000000002}, {16.2998735318374, 0., -8.962500000000002}, 
       {15.573326954313622, 0., -9.560000000000002}, 
       {14.709759581999087, 0., -10.157500000000002}, 
       {13.64289100438874, 0., -10.755000000000003}, 
       {12.208840053799104, 0., -11.352500000000003}, 
       {9.414603431411933, 0., -11.950000000000003}, 
       {9.414603431411972, 0., -11.95}}, 
      {{-0.654121133468629, 6.25, 0.}, {-0.6541211334686294, 
        6.245181476504518, 0.24537384849417881}, {-0.654121133468629, 
        6.23073333583205, 0.4903693482990309}, {-0.6541211334686295, 
        6.206677855968289, 0.7346087341114853}, {-0.6541211334686289, 
        6.173052128719611, 0.977715406501443}, {-0.6541211334686288, 
        6.129908002520191, 1.2193145126008016}, {-0.6541211334686305, 
        6.0773120024854785, 1.4590335240994088}, {-0.6541211334686295, 
        6.0153452278352955, 1.6965028116567142}, {-0.6541211334686303, 
        5.944103226844709, 1.9313562148434211}, {-0.654121133468629, 
        5.863695849515526, 2.163231606734331}, {-0.6541211334686292, 
        5.774247078195542, 2.391771452281811}, {-0.6541211334686295, 
        5.675894836406758, 2.6166233596089254}, {-0.6541211334686297, 
        5.568790776177299, 2.837440623372167}, {-0.6541211334686294, 
        5.453100044204982, 3.053882759355968}, {-0.6541211334686303, 
        5.329001027213076, 3.26561602947468}, {-0.6541211334686303, 
        5.196685076890907, 3.4723139563725134}, {-0.6541211334686292, 
        5.056356214843421, 3.673657826827957}, {-0.6541211334686294, 
        4.908230818004656, 3.8693371831864622}, {-0.654121133468629, 
        4.7525372850001935, 4.059050302063648}, {-0.6541211334686297, 
        4.589515683973035, 4.242504659580885}, {-0.6541211334686303, 
        4.419417382415922, 4.419417382415921}, {-0.6541211334686288, 
        4.242504659580886, 4.589515683973035}, {-0.654121133468629, 
        4.059050302063648, 4.7525372850001935}, {-0.6541211334686294, 
        3.8693371831864622, 4.908230818004656}, {-0.6541211334686292, 
        3.673657826827957, 5.056356214843421}, {-0.654121133468629, 
        3.4723139563725143, 5.196685076890907}, {-0.6541211334686294, 
        3.2656160294746805, 5.329001027213076}, {-0.654121133468629, 
        3.0538827593559685, 5.453100044204982}, {-0.6541211334686303, 
        2.8374406233721676, 5.568790776177298}, {-0.6541211334686294, 
        2.616623359608926, 5.675894836406758}, {-0.654121133468629, 
        2.3917714522818114, 5.774247078195542}, {-0.654121133468629, 
        2.1632316067343313, 5.863695849515526}, {-0.6541211334686303, 
        1.9313562148434216, 5.944103226844709}, {-0.6541211334686294, 
        1.6965028116567145, 6.0153452278352955}, {-0.6541211334686294, 
        1.4590335240994092, 6.0773120024854785}, {-0.6541211334686285, 
        1.219314512600802, 6.129908002520191}, {-0.654121133468629, 
        0.9777154065014433, 6.173052128719611}, {-0.6541211334686294, 
        0.7346087341114856, 6.206677855968289}, {-0.654121133468629, 
        0.4903693482990312, 6.23073333583205}, {-0.6541211334686294, 
        0.24537384849417915, 6.245181476504518}, {-0.654121133468629, 
        3.826894855694929*^-16, 6.25}, {-0.6541211334686294, 
        -0.24537384849417843, 6.245181476504518}, {-0.654121133468629, 
        -0.49036934829903045, 6.23073333583205}, {-0.6541211334686294, 
        -0.7346087341114849, 6.206677855968289}, {-0.654121133468629, 
        -0.9777154065014426, 6.173052128719611}, {-0.654121133468629, 
        -1.2193145126008011, 6.129908002520191}, {-0.654121133468629, 
        -1.4590335240994083, 6.077312002485479}, {-0.6541211334686299, 
        -1.6965028116567138, 6.0153452278352955}, {-0.654121133468629, 
        -1.931356214843421, 5.94410322684471}, {-0.6541211334686294, 
        -2.1632316067343305, 5.863695849515526}, {-0.654121133468629, 
        -2.391771452281811, 5.774247078195542}, {-0.654121133468629, 
        -2.6166233596089237, 5.675894836406759}, {-0.6541211334686299, 
        -2.8374406233721667, 5.568790776177299}, {-0.654121133468629, 
        -3.053882759355969, 5.453100044204982}, {-0.654121133468629, 
        -3.26561602947468, 5.329001027213077}, {-0.654121133468629, 
        -3.472313956372512, 5.196685076890909}, {-0.6541211334686305, 
        -3.6736578268279563, 5.056356214843421}, {-0.6541211334686285, 
        -3.869337183186463, 4.908230818004656}, {-0.6541211334686285, 
        -4.059050302063647, 4.752537285000194}, {-0.654121133468629, 
        -4.242504659580884, 4.589515683973036}, {-0.6541211334686301, 
        -4.419417382415921, 4.419417382415922}, {-0.6541211334686297, 
        -4.589515683973035, 4.242504659580885}, {-0.6541211334686285, 
        -4.7525372850001935, 4.059050302063649}, {-0.6541211334686292, 
        -4.908230818004655, 3.8693371831864636}, {-0.6541211334686303, 
        -5.0563562148434205, 3.6736578268279576}, {-0.6541211334686292, 
        -5.196685076890908, 3.4723139563725134}, {-0.6541211334686294, 
        -5.329001027213076, 3.2656160294746805}, {-0.6541211334686293, 
        -5.453100044204981, 3.0538827593559703}, {-0.6541211334686302, 
        -5.568790776177298, 2.837440623372168}, {-0.6541211334686288, 
        -5.6758948364067585, 2.616623359608925}, {-0.6541211334686288, 
        -5.774247078195542, 2.391771452281812}, {-0.6541211334686288, 
        -5.863695849515525, 2.163231606734333}, {-0.6541211334686291, 
        -5.944103226844709, 1.931356214843422}, {-0.6541211334686303, 
        -6.0153452278352955, 1.6965028116567133}, {-0.6541211334686294, 
        -6.0773120024854785, 1.4590335240994095}, {-0.6541211334686284, 
        -6.129908002520191, 1.2193145126008038}, {-0.6541211334686298, 
        -6.17305212871961, 0.9777154065014436}, {-0.6541211334686297, 
        -6.206677855968289, 0.7346087341114846}, {-0.654121133468629, 
        -6.23073333583205, 0.49036934829903167}, {-0.6541211334686293, 
        -6.245181476504518, 0.24537384849418092}, {-0.654121133468629, 
        -6.25, 7.653789711389858*^-16}, {-0.6541211334686294, 
        -6.245181476504518, -0.24537384849417943}, 
       {-0.6541211334686291, -6.23073333583205, -0.4903693482990301}, 
       {-0.6541211334686303, -6.206677855968289, -0.7346087341114831}, 
       {-0.6541211334686291, -6.173052128719611, -0.9777154065014421}, 
       {-0.6541211334686287, -6.129908002520191, -1.2193145126008023}, 
       {-0.6541211334686289, -6.077312002485479, -1.459033524099408}, 
       {-0.6541211334686288, -6.015345227835296, -1.696502811656712}, 
       {-0.6541211334686291, -5.94410322684471, -1.9313562148434205}, 
       {-0.6541211334686287, -5.863695849515526, -2.163231606734332}, 
       {-0.6541211334686292, -5.774247078195542, -2.3917714522818105}, 
       {-0.6541211334686291, -5.675894836406759, -2.6166233596089232}, 
       {-0.6541211334686298, -5.568790776177299, -2.8374406233721667}, 
       {-0.654121133468629, -5.453100044204982, -3.053882759355969}, 
       {-0.6541211334686292, -5.329001027213077, -3.265616029474679}, 
       {-0.654121133468629, -5.196685076890909, -3.472313956372512}, 
       {-0.6541211334686292, -5.056356214843422, -3.6736578268279563}, 
       {-0.6541211334686288, -4.908230818004656, -3.869337183186463}, 
       {-0.6541211334686288, -4.752537285000194, -4.059050302063647}, 
       {-0.654121133468629, -4.589515683973036, -4.242504659580884}, 
       {-0.6541211334686292, -4.419417382415923, -4.419417382415921}, 
       {-0.6541211334686297, -4.242504659580885, -4.589515683973035}, 
       {-0.6541211334686297, -4.059050302063651, -4.752537285000191}, 
       {-0.6541211334686288, -3.8693371831864645, -4.908230818004655}, 
       {-0.6541211334686301, -3.6736578268279576, -5.0563562148434205}, 
       {-0.6541211334686303, -3.4723139563725134, -5.196685076890907}, 
       {-0.6541211334686285, -3.2656160294746788, -5.329001027213078}, 
       {-0.654121133468629, -3.0538827593559708, -5.453100044204981}, 
       {-0.6541211334686303, -2.837440623372168, -5.568790776177298}, 
       {-0.6541211334686285, -2.616623359608925, -5.6758948364067585}, 
       {-0.6541211334686294, -2.3917714522818145, -5.774247078195541}, 
       {-0.6541211334686285, -2.1632316067343336, -5.863695849515525}, 
       {-0.654121133468629, -1.9313562148434222, -5.944103226844709}, 
       {-0.6541211334686299, -1.6965028116567138, -6.0153452278352955}, 
       {-0.654121133468629, -1.4590335240994072, -6.077312002485479}, 
       {-0.6541211334686294, -1.2193145126008043, -6.12990800252019}, 
       {-0.6541211334686299, -0.977715406501444, -6.17305212871961}, 
       {-0.6541211334686294, -0.734608734111485, -6.206677855968289}, 
       {-0.6541211334686285, -0.4903693482990348, -6.23073333583205}, 
       {-0.6541211334686294, -0.24537384849418134, -6.245181476504518}, 
       {-0.654121133468629, -1.1480684567084787*^-15, -6.25}, 
       {-0.6541211334686294, 0.24537384849417904, -6.245181476504518}, 
       {-0.654121133468629, 0.49036934829903256, -6.23073333583205}, 
       {-0.6541211334686303, 0.7346087341114828, -6.206677855968289}, 
       {-0.654121133468629, 0.9777154065014417, -6.173052128719611}, 
       {-0.6541211334686285, 1.2193145126008018, -6.129908002520191}, 
       {-0.6541211334686294, 1.4590335240994048, -6.077312002485479}, 
       {-0.654121133468629, 1.6965028116567118, -6.015345227835296}, 
       {-0.654121133468629, 1.9313562148434202, -5.94410322684471}, 
       {-0.654121133468629, 2.1632316067343313, -5.863695849515526}, 
       {-0.654121133468629, 2.3917714522818123, -5.7742470781955415}, 
       {-0.654121133468629, 2.6166233596089232, -5.675894836406759}, 
       {-0.6541211334686303, 2.8374406233721663, -5.568790776177299}, 
       {-0.654121133468629, 3.0538827593559685, -5.453100044204982}, 
       {-0.6541211334686294, 3.2656160294746774, -5.329001027213078}, 
       {-0.6541211334686294, 3.4723139563725116, -5.196685076890909}, 
       {-0.6541211334686294, 3.673657826827956, -5.056356214843422}, 
       {-0.6541211334686294, 3.8693371831864622, -4.908230818004656}, 
       {-0.6541211334686285, 4.05905030206365, -4.752537285000193}, 
       {-0.654121133468629, 4.242504659580884, -4.589515683973036}, 
       {-0.6541211334686288, 4.419417382415921, -4.419417382415923}, 
       {-0.6541211334686292, 4.589515683973035, -4.242504659580886}, 
       {-0.654121133468629, 4.752537285000191, -4.0590503020636515}, 
       {-0.6541211334686301, 4.908230818004654, -3.8693371831864645}, 
       {-0.6541211334686292, 5.0563562148434205, -3.6736578268279585}, 
       {-0.6541211334686303, 5.196685076890907, -3.4723139563725134}, 
       {-0.6541211334686292, 5.329001027213077, -3.265616029474679}, 
       {-0.6541211334686295, 5.45310004420498, -3.0538827593559708}, 
       {-0.6541211334686294, 5.568790776177298, -2.8374406233721685}, 
       {-0.6541211334686295, 5.675894836406758, -2.6166233596089254}, 
       {-0.6541211334686294, 5.774247078195541, -2.391771452281815}, 
       {-0.6541211334686309, 5.8636958495155245, -2.1632316067343336}, 
       {-0.654121133468629, 5.944103226844709, -1.9313562148434227}, 
       {-0.6541211334686295, 6.0153452278352955, -1.6965028116567142}, 
       {-0.654121133468629, 6.077312002485479, -1.4590335240994075}, 
       {-0.6541211334686292, 6.12990800252019, -1.2193145126008045}, 
       {-0.6541211334686297, 6.17305212871961, -0.9777154065014443}, 
       {-0.6541211334686295, 6.206677855968289, -0.7346087341114854}, 
       {-0.6541211334686287, 6.23073333583205, -0.49036934829903517}, 
       {-0.6541211334686293, 6.245181476504518, -0.24537384849418173}, 
       {-0.654121133468629, 6.25, -1.5307579422779716*^-15}}, 
      {{-0.7033119314590373, 5., 0.}, {-0.7033119314590373, 
        4.996145181203614, 0.19629907879534306}, {-0.7033119314590373, 
        4.9845866686656395, 0.3922954786392247}, {-0.7033119314590373, 
        4.965342284774631, 0.5876869872891882}, {-0.7033119314590364, 
        4.938441702975689, 0.7821723252011543}, {-0.7033119314590373, 
        4.903926402016152, 0.9754516100806412}, {-0.7033119314590373, 
        4.861849601988383, 1.167226819279527}, {-0.7033119314590373, 
        4.812276182268237, 1.3572022493253713}, {-0.7033119314590381, 
        4.755282581475767, 1.545084971874737}, {-0.7033119314590373, 
        4.6909566796124205, 1.7305852853874648}, {-0.7033119314590373, 
        4.619397662556434, 1.913417161825449}, {-0.7033119314590381, 
        4.540715869125406, 2.0932986876871404}, {-0.7033119314590373, 
        4.455032620941839, 2.2699524986977337}, {-0.7033119314590373, 
        4.362480035363986, 2.4431062074847745}, {-0.7033119314590373, 
        4.263200821770461, 2.612492823579744}, {-0.7033119314590373, 
        4.157348061512726, 2.777851165098011}, {-0.7033119314590373, 
        4.045084971874737, 2.938926261462366}, {-0.7033119314590373, 
        3.9265846544037246, 3.0954697465491696}, {-0.7033119314590373, 
        3.8020298280001548, 3.2472402416509185}, {-0.7033119314590373, 
        3.6716125471784276, 3.3940037276647086}, {-0.7033119314590373, 
        3.5355339059327378, 3.5355339059327373}, {-0.7033119314590373, 
        3.394003727664709, 3.6716125471784276}, {-0.7033119314590373, 
        3.2472402416509185, 3.8020298280001548}, {-0.7033119314590373, 
        3.0954697465491696, 3.9265846544037246}, {-0.7033119314590364, 
        2.938926261462366, 4.045084971874737}, {-0.7033119314590364, 
        2.7778511650980113, 4.157348061512726}, {-0.7033119314590373, 
        2.6124928235797444, 4.263200821770461}, {-0.7033119314590373, 
        2.443106207484775, 4.362480035363985}, {-0.7033119314590373, 
        2.269952498697734, 4.455032620941839}, {-0.7033119314590373, 
        2.093298687687141, 4.540715869125406}, {-0.7033119314590373, 
        1.9134171618254492, 4.619397662556434}, {-0.7033119314590373, 
        1.730585285387465, 4.6909566796124205}, {-0.7033119314590381, 
        1.5450849718747373, 4.755282581475767}, {-0.7033119314590364, 
        1.3572022493253715, 4.812276182268237}, {-0.7033119314590373, 
        1.1672268192795274, 4.861849601988383}, {-0.7033119314590373, 
        0.9754516100806416, 4.903926402016152}, {-0.7033119314590364, 
        0.7821723252011547, 4.938441702975689}, {-0.7033119314590373, 
        0.5876869872891886, 4.965342284774631}, {-0.7033119314590373, 
        0.392295478639225, 4.9845866686656395}, {-0.7033119314590373, 
        0.19629907879534333, 4.996145181203614}, {-0.7033119314590373, 
        3.061515884555943*^-16, 5.}, {-0.7033119314590373, 
        -0.19629907879534275, 4.996145181203614}, {-0.7033119314590373, 
        -0.39229547863922437, 4.9845866686656395}, 
       {-0.7033119314590373, -0.5876869872891879, 4.965342284774631}, 
       {-0.7033119314590364, -0.7821723252011541, 4.938441702975689}, 
       {-0.7033119314590373, -0.975451610080641, 4.903926402016152}, 
       {-0.7033119314590373, -1.1672268192795268, 4.861849601988383}, 
       {-0.7033119314590373, -1.357202249325371, 4.812276182268237}, 
       {-0.7033119314590373, -1.5450849718747368, 4.755282581475768}, 
       {-0.7033119314590373, -1.7305852853874646, 4.6909566796124205}, 
       {-0.7033119314590373, -1.9134171618254485, 4.619397662556434}, 
       {-0.7033119314590364, -2.093298687687139, 4.540715869125408}, 
       {-0.7033119314590373, -2.2699524986977333, 4.455032620941839}, 
       {-0.7033119314590373, -2.4431062074847754, 4.362480035363985}, 
       {-0.7033119314590364, -2.612492823579744, 4.263200821770462}, 
       {-0.7033119314590373, -2.77785116509801, 4.157348061512727}, 
       {-0.7033119314590373, -2.938926261462365, 4.045084971874737}, 
       {-0.7033119314590373, -3.0954697465491705, 3.926584654403724}, 
       {-0.7033119314590373, -3.2472402416509176, 3.802029828000155}, 
       {-0.7033119314590373, -3.3940037276647077, 3.671612547178429}, 
       {-0.7033119314590373, -3.5355339059327373, 3.5355339059327378}, 
       {-0.7033119314590373, -3.6716125471784284, 3.3940037276647086}, 
       {-0.7033119314590373, -3.8020298280001548, 3.247240241650919}, 
       {-0.7033119314590373, -3.9265846544037237, 3.095469746549171}, 
       {-0.7033119314590373, -4.045084971874736, 2.9389262614623664}, 
       {-0.7033119314590373, -4.157348061512726, 2.777851165098011}, 
       {-0.7033119314590373, -4.263200821770461, 2.6124928235797444}, 
       {-0.7033119314590373, -4.362480035363985, 2.4431062074847762}, 
       {-0.7033119314590373, -4.455032620941839, 2.269952498697734}, 
       {-0.7033119314590373, -4.540715869125407, 2.09329868768714}, 
       {-0.7033119314590373, -4.619397662556434, 1.9134171618254494}, 
       {-0.7033119314590373, -4.6909566796124205, 1.7305852853874666}, 
       {-0.7033119314590373, -4.755282581475767, 1.5450849718747375}, 
       {-0.7033119314590373, -4.812276182268237, 1.3572022493253708}, 
       {-0.7033119314590373, -4.861849601988383, 1.1672268192795276}, 
       {-0.7033119314590373, -4.903926402016152, 0.9754516100806431}, 
       {-0.7033119314590373, -4.938441702975688, 0.7821723252011549}, 
       {-0.7033119314590373, -4.965342284774631, 0.5876869872891878}, 
       {-0.7033119314590373, -4.9845866686656395, 0.3922954786392253}, 
       {-0.7033119314590373, -4.996145181203614, 0.19629907879534475}, 
       {-0.7033119314590373, -5., 6.123031769111886*^-16}, 
       {-0.7033119314590373, -4.996145181203614, -0.19629907879534353}, 
       {-0.7033119314590373, -4.9845866686656395, -0.3922954786392241}, 
       {-0.7033119314590373, -4.965342284774631, -0.5876869872891864}, 
       {-0.7033119314590364, -4.938441702975689, -0.7821723252011537}, 
       {-0.7033119314590373, -4.903926402016152, -0.9754516100806419}, 
       {-0.7033119314590373, -4.861849601988383, -1.1672268192795263}, 
       {-0.7033119314590373, -4.812276182268237, -1.3572022493253697}, 
       {-0.7033119314590373, -4.755282581475768, -1.5450849718747364}, 
       {-0.7033119314590373, -4.6909566796124205, -1.7305852853874653}, 
       {-0.7033119314590373, -4.619397662556434, -1.9134171618254483}, 
       {-0.7033119314590373, -4.540715869125408, -2.0932986876871387}, 
       {-0.7033119314590373, -4.455032620941839, -2.2699524986977333}, 
       {-0.7033119314590373, -4.362480035363985, -2.443106207484775}, 
       {-0.7033119314590373, -4.263200821770462, -2.6124928235797436}, 
       {-0.7033119314590373, -4.157348061512727, -2.77785116509801}, 
       {-0.7033119314590364, -4.045084971874738, -2.938926261462365}, 
       {-0.7033119314590373, -3.926584654403724, -3.0954697465491705}, 
       {-0.7033119314590373, -3.802029828000155, -3.2472402416509176}, 
       {-0.7033119314590373, -3.671612547178429, -3.3940037276647073}, 
       {-0.7033119314590364, -3.5355339059327386, -3.5355339059327373}, 
       {-0.7033119314590373, -3.3940037276647086, -3.6716125471784276}, 
       {-0.7033119314590373, -3.2472402416509203, -3.802029828000153}, 
       {-0.7033119314590373, -3.0954697465491714, -3.9265846544037237}, 
       {-0.7033119314590373, -2.9389262614623664, -4.045084971874736}, 
       {-0.7033119314590373, -2.777851165098011, -4.157348061512726}, 
       {-0.7033119314590373, -2.6124928235797427, -4.263200821770462}, 
       {-0.7033119314590373, -2.4431062074847762, -4.362480035363985}, 
       {-0.7033119314590373, -2.2699524986977346, -4.455032620941839}, 
       {-0.7033119314590373, -2.09329868768714, -4.540715869125407}, 
       {-0.7033119314590373, -1.9134171618254516, -4.619397662556432}, 
       {-0.7033119314590373, -1.7305852853874668, -4.6909566796124205}, 
       {-0.7033119314590373, -1.5450849718747377, -4.755282581475767}, 
       {-0.7033119314590373, -1.357202249325371, -4.812276182268237}, 
       {-0.7033119314590381, -1.1672268192795257, -4.861849601988383}, 
       {-0.7033119314590373, -0.9754516100806433, -4.903926402016151}, 
       {-0.7033119314590373, -0.7821723252011552, -4.938441702975688}, 
       {-0.7033119314590373, -0.587686987289188, -4.965342284774631}, 
       {-0.7033119314590373, -0.39229547863922787, -4.9845866686656395}, 
       {-0.7033119314590373, -0.19629907879534506, -4.996145181203614}, 
       {-0.7033119314590373, -9.18454765366783*^-16, -5.}, 
       {-0.7033119314590373, 0.19629907879534322, -4.996145181203614}, 
       {-0.7033119314590373, 0.39229547863922604, -4.9845866686656395}, 
       {-0.7033119314590381, 0.5876869872891862, -4.965342284774631}, 
       {-0.7033119314590364, 0.7821723252011534, -4.938441702975689}, 
       {-0.7033119314590373, 0.9754516100806415, -4.903926402016152}, 
       {-0.7033119314590373, 1.1672268192795239, -4.861849601988384}, 
       {-0.7033119314590373, 1.3572022493253693, -4.812276182268237}, 
       {-0.7033119314590373, 1.5450849718747361, -4.755282581475768}, 
       {-0.7033119314590373, 1.730585285387465, -4.6909566796124205}, 
       {-0.7033119314590373, 1.91341716182545, -4.619397662556433}, 
       {-0.7033119314590373, 2.0932986876871382, -4.540715869125408}, 
       {-0.7033119314590373, 2.2699524986977333, -4.455032620941839}, 
       {-0.7033119314590373, 2.443106207484775, -4.362480035363985}, 
       {-0.7033119314590373, 2.6124928235797418, -4.263200821770463}, 
       {-0.7033119314590373, 2.777851165098009, -4.157348061512727}, 
       {-0.7033119314590373, 2.9389262614623646, -4.045084971874738}, 
       {-0.7033119314590373, 3.0954697465491696, -3.9265846544037246}, 
       {-0.7033119314590373, 3.2472402416509194, -3.802029828000154}, 
       {-0.7033119314590373, 3.3940037276647073, -3.671612547178429}, 
       {-0.7033119314590373, 3.535533905932737, -3.5355339059327386}, 
       {-0.7033119314590373, 3.6716125471784276, -3.394003727664709}, 
       {-0.7033119314590373, 3.8020298280001525, -3.247240241650921}, 
       {-0.7033119314590373, 3.9265846544037233, -3.0954697465491714}, 
       {-0.7033119314590373, 4.045084971874736, -2.938926261462367}, 
       {-0.7033119314590373, 4.157348061512726, -2.777851165098011}, 
       {-0.7033119314590373, 4.263200821770462, -2.6124928235797436}, 
       {-0.7033119314590373, 4.362480035363984, -2.4431062074847767}, 
       {-0.7033119314590373, 4.455032620941839, -2.2699524986977346}, 
       {-0.7033119314590381, 4.540715869125406, -2.0932986876871404}, 
       {-0.7033119314590373, 4.619397662556432, -1.913417161825452}, 
       {-0.7033119314590373, 4.69095667961242, -1.730585285387467}, 
       {-0.7033119314590373, 4.755282581475767, -1.5450849718747381}, 
       {-0.7033119314590373, 4.812276182268237, -1.3572022493253713}, 
       {-0.7033119314590373, 4.861849601988383, -1.1672268192795259}, 
       {-0.7033119314590373, 4.903926402016151, -0.9754516100806436}, 
       {-0.7033119314590373, 4.938441702975688, -0.7821723252011554}, 
       {-0.7033119314590373, 4.965342284774631, -0.5876869872891883}, 
       {-0.7033119314590373, 4.9845866686656395, -0.3922954786392281}, 
       {-0.7033119314590373, 4.996145181203614, -0.19629907879534536}, 
       {-0.7033119314590373, 5., -1.2246063538223773*^-15}}, 
      {{-0.05, 2.5, 0.}, {-0.05, 2.498072590601807, 
        0.09814953939767153}, {-0.05, 2.4922933343328197, 
        0.19614773931961235}, {-0.05, 2.4826711423873156, 
        0.2938434936445941}, {-0.05, 2.4692208514878446, 
        0.39108616260057716}, {-0.05, 2.451963201008076, 
        0.4877258050403206}, {-0.05, 2.4309248009941915, 
        0.5836134096397635}, {-0.05, 2.4061380911341184, 
        0.6786011246626856}, {-0.05, 2.3776412907378837, 
        0.7725424859373685}, {-0.05, 2.3454783398062102, 
        0.8652926426937324}, {-0.05, 2.309698831278217, 
        0.9567085809127245}, {-0.05, 2.270357934562703, 
        1.0466493438435702}, {-0.05, 2.2275163104709197, 
        1.1349762493488669}, {-0.05, 2.181240017681993, 
        1.2215531037423872}, {-0.05, 2.1316004108852304, 
        1.306246411789872}, {-0.05, 2.078674030756363, 
        1.3889255825490054}, {-0.05, 2.0225424859373686, 
        1.469463130731183}, {-0.05, 1.9632923272018623, 
        1.5477348732745848}, {-0.05, 1.9010149140000774, 
        1.6236201208254593}, {-0.05, 1.8358062735892138, 
        1.6970018638323543}, {-0.05, 1.7677669529663689, 
        1.7677669529663687}, {-0.05, 1.6970018638323545, 
        1.8358062735892138}, {-0.05, 1.6236201208254593, 
        1.9010149140000774}, {-0.05, 1.5477348732745848, 
        1.9632923272018623}, {-0.05, 1.469463130731183, 
        2.0225424859373686}, {-0.05, 1.3889255825490057, 
        2.078674030756363}, {-0.05, 1.3062464117898722, 
        2.1316004108852304}, {-0.05, 1.2215531037423875, 
        2.1812400176819926}, {-0.05, 1.134976249348867, 
        2.2275163104709197}, {-0.05, 1.0466493438435704, 
        2.270357934562703}, {-0.05, 0.9567085809127246, 
        2.309698831278217}, {-0.05, 0.8652926426937325, 
        2.3454783398062102}, {-0.05, 0.7725424859373686, 
        2.3776412907378837}, {-0.05, 0.6786011246626857, 
        2.4061380911341184}, {-0.05, 0.5836134096397637, 
        2.4309248009941915}, {-0.05, 0.4877258050403208, 
        2.451963201008076}, {-0.05, 0.3910861626005773, 
        2.4692208514878446}, {-0.05, 0.2938434936445943, 
        2.4826711423873156}, {-0.05, 0.1961477393196125, 
        2.4922933343328197}, {-0.05, 0.09814953939767167, 
        2.498072590601807}, {-0.05, 1.5307579422779716*^-16, 2.5}, 
       {-0.05, -0.09814953939767138, 2.498072590601807}, 
       {-0.05, -0.19614773931961219, 2.4922933343328197}, 
       {-0.05, -0.29384349364459394, 2.4826711423873156}, 
       {-0.05, -0.39108616260057705, 2.4692208514878446}, 
       {-0.05, -0.4877258050403205, 2.451963201008076}, 
       {-0.05, -0.5836134096397634, 2.4309248009941915}, 
       {-0.05, -0.6786011246626855, 2.4061380911341184}, 
       {-0.05, -0.7725424859373684, 2.377641290737884}, 
       {-0.05, -0.8652926426937323, 2.3454783398062102}, 
       {-0.05, -0.9567085809127243, 2.309698831278217}, 
       {-0.05, -1.0466493438435696, 2.270357934562704}, 
       {-0.05, -1.1349762493488667, 2.2275163104709197}, 
       {-0.05, -1.2215531037423877, 2.1812400176819926}, 
       {-0.05, -1.306246411789872, 2.131600410885231}, 
       {-0.05, -1.388925582549005, 2.0786740307563636}, 
       {-0.05, -1.4694631307311825, 2.0225424859373686}, 
       {-0.05, -1.5477348732745853, 1.963292327201862}, 
       {-0.05, -1.6236201208254588, 1.9010149140000776}, 
       {-0.05, -1.6970018638323539, 1.8358062735892144}, 
       {-0.05, -1.7677669529663687, 1.7677669529663689}, 
       {-0.05, -1.8358062735892142, 1.6970018638323543}, 
       {-0.05, -1.9010149140000774, 1.6236201208254595}, 
       {-0.05, -1.9632923272018619, 1.5477348732745855}, 
       {-0.05, -2.022542485937368, 1.4694631307311832}, 
       {-0.05, -2.078674030756363, 1.3889255825490054}, 
       {-0.05, -2.1316004108852304, 1.3062464117898722}, 
       {-0.05, -2.1812400176819926, 1.2215531037423881}, 
       {-0.05, -2.2275163104709197, 1.134976249348867}, 
       {-0.05, -2.2703579345627034, 1.04664934384357}, 
       {-0.05, -2.309698831278217, 0.9567085809127247}, 
       {-0.05, -2.3454783398062102, 0.8652926426937333}, 
       {-0.05, -2.3776412907378837, 0.7725424859373687}, 
       {-0.05, -2.4061380911341184, 0.6786011246626854}, 
       {-0.05, -2.4309248009941915, 0.5836134096397638}, 
       {-0.05, -2.451963201008076, 0.48772580504032154}, 
       {-0.05, -2.469220851487844, 0.39108616260057744}, 
       {-0.05, -2.4826711423873156, 0.2938434936445939}, 
       {-0.05, -2.4922933343328197, 0.19614773931961266}, 
       {-0.05, -2.498072590601807, 0.09814953939767238}, 
       {-0.05, -2.5, 3.061515884555943*^-16}, 
       {-0.05, -2.498072590601807, -0.09814953939767176}, 
       {-0.05, -2.4922933343328197, -0.19614773931961205}, 
       {-0.05, -2.4826711423873156, -0.2938434936445932}, 
       {-0.05, -2.4692208514878446, -0.3910861626005768}, 
       {-0.05, -2.451963201008076, -0.4877258050403209}, 
       {-0.05, -2.4309248009941915, -0.5836134096397632}, 
       {-0.05, -2.4061380911341184, -0.6786011246626849}, 
       {-0.05, -2.377641290737884, -0.7725424859373682}, 
       {-0.05, -2.3454783398062102, -0.8652926426937326}, 
       {-0.05, -2.309698831278217, -0.9567085809127241}, 
       {-0.05, -2.270357934562704, -1.0466493438435693}, 
       {-0.05, -2.2275163104709197, -1.1349762493488667}, 
       {-0.05, -2.1812400176819926, -1.2215531037423875}, 
       {-0.05, -2.131600410885231, -1.3062464117898718}, 
       {-0.05, -2.0786740307563636, -1.388925582549005}, 
       {-0.05, -2.022542485937369, -1.4694631307311825}, 
       {-0.05, -1.963292327201862, -1.5477348732745853}, 
       {-0.05, -1.9010149140000776, -1.6236201208254588}, 
       {-0.05, -1.8358062735892144, -1.6970018638323536}, 
       {-0.05, -1.7677669529663693, -1.7677669529663687}, 
       {-0.05, -1.6970018638323543, -1.8358062735892138}, 
       {-0.05, -1.6236201208254601, -1.9010149140000765}, 
       {-0.05, -1.5477348732745857, -1.9632923272018619}, 
       {-0.05, -1.4694631307311832, -2.022542485937368}, 
       {-0.05, -1.3889255825490054, -2.078674030756363}, 
       {-0.05, -1.3062464117898713, -2.131600410885231}, 
       {-0.05, -1.2215531037423881, -2.1812400176819926}, 
       {-0.05, -1.1349762493488673, -2.2275163104709197}, 
       {-0.05, -1.04664934384357, -2.2703579345627034}, 
       {-0.05, -0.9567085809127258, -2.309698831278216}, 
       {-0.05, -0.8652926426937334, -2.3454783398062102}, 
       {-0.05, -0.7725424859373689, -2.3776412907378837}, 
       {-0.05, -0.6786011246626855, -2.4061380911341184}, 
       {-0.05, -0.5836134096397628, -2.4309248009941915}, 
       {-0.05, -0.48772580504032165, -2.4519632010080756}, 
       {-0.05, -0.3910861626005776, -2.469220851487844}, 
       {-0.05, -0.293843493644594, -2.4826711423873156}, 
       {-0.05, -0.19614773931961393, -2.4922933343328197}, 
       {-0.05, -0.09814953939767253, -2.498072590601807}, 
       {-0.05, -4.592273826833915*^-16, -2.5}, 
       {-0.05, 0.09814953939767161, -2.498072590601807}, 
       {-0.05, 0.19614773931961302, -2.4922933343328197}, 
       {-0.05, 0.2938434936445931, -2.4826711423873156}, 
       {-0.05, 0.3910861626005767, -2.4692208514878446}, 
       {-0.05, 0.48772580504032076, -2.451963201008076}, 
       {-0.05, 0.5836134096397619, -2.430924800994192}, 
       {-0.05, 0.6786011246626846, -2.4061380911341184}, 
       {-0.05, 0.7725424859373681, -2.377641290737884}, 
       {-0.05, 0.8652926426937325, -2.3454783398062102}, 
       {-0.05, 0.956708580912725, -2.3096988312782165}, 
       {-0.05, 1.0466493438435691, -2.270357934562704}, 
       {-0.05, 1.1349762493488667, -2.2275163104709197}, 
       {-0.05, 1.2215531037423875, -2.1812400176819926}, 
       {-0.05, 1.3062464117898709, -2.1316004108852313}, 
       {-0.05, 1.3889255825490046, -2.0786740307563636}, 
       {-0.05, 1.4694631307311823, -2.022542485937369}, 
       {-0.05, 1.5477348732745848, -1.9632923272018623}, 
       {-0.05, 1.6236201208254597, -1.901014914000077}, 
       {-0.05, 1.6970018638323536, -1.8358062735892144}, 
       {-0.05, 1.7677669529663684, -1.7677669529663693}, 
       {-0.05, 1.8358062735892138, -1.6970018638323545}, 
       {-0.05, 1.9010149140000763, -1.6236201208254606}, 
       {-0.05, 1.9632923272018616, -1.5477348732745857}, 
       {-0.05, 2.022542485937368, -1.4694631307311834}, 
       {-0.05, 2.078674030756363, -1.3889255825490054}, 
       {-0.05, 2.131600410885231, -1.3062464117898718}, 
       {-0.05, 2.181240017681992, -1.2215531037423883}, 
       {-0.05, 2.2275163104709197, -1.1349762493488673}, 
       {-0.05, 2.270357934562703, -1.0466493438435702}, 
       {-0.05, 2.309698831278216, -0.956708580912726}, 
       {-0.05, 2.34547833980621, -0.8652926426937335}, 
       {-0.05, 2.3776412907378837, -0.7725424859373691}, 
       {-0.05, 2.4061380911341184, -0.6786011246626856}, 
       {-0.05, 2.4309248009941915, -0.5836134096397629}, 
       {-0.05, 2.4519632010080756, -0.4877258050403218}, 
       {-0.05, 2.469220851487844, -0.3910861626005777}, 
       {-0.05, 2.4826711423873156, -0.29384349364459417}, 
       {-0.05, 2.4922933343328197, -0.19614773931961405}, 
       {-0.05, 2.498072590601807, -0.09814953939767268}, 
       {-0.05, 2.5, -6.123031769111886*^-16}}, {{-0.05, 2.5, 0.}, 
       {-0.05, 2.498072590601807, 0.09814953939767153}, 
       {-0.05, 2.4922933343328197, 0.19614773931961235}, 
       {-0.05, 2.4826711423873156, 0.2938434936445941}, 
       {-0.05, 2.4692208514878446, 0.39108616260057716}, 
       {-0.05, 2.451963201008076, 0.4877258050403206}, 
       {-0.05, 2.4309248009941915, 0.5836134096397635}, 
       {-0.05, 2.4061380911341184, 0.6786011246626856}, 
       {-0.05, 2.3776412907378837, 0.7725424859373685}, 
       {-0.05, 2.3454783398062102, 0.8652926426937324}, 
       {-0.05, 2.309698831278217, 0.9567085809127245}, 
       {-0.05, 2.270357934562703, 1.0466493438435702}, 
       {-0.05, 2.2275163104709197, 1.1349762493488669}, 
       {-0.05, 2.181240017681993, 1.2215531037423872}, 
       {-0.05, 2.1316004108852304, 1.306246411789872}, 
       {-0.05, 2.078674030756363, 1.3889255825490054}, 
       {-0.05, 2.0225424859373686, 1.469463130731183}, 
       {-0.05, 1.9632923272018623, 1.5477348732745848}, 
       {-0.05, 1.9010149140000774, 1.6236201208254593}, 
       {-0.05, 1.8358062735892138, 1.6970018638323543}, 
       {-0.05, 1.7677669529663689, 1.7677669529663687}, 
       {-0.05, 1.6970018638323545, 1.8358062735892138}, 
       {-0.05, 1.6236201208254593, 1.9010149140000774}, 
       {-0.05, 1.5477348732745848, 1.9632923272018623}, 
       {-0.05, 1.469463130731183, 2.0225424859373686}, 
       {-0.05, 1.3889255825490057, 2.078674030756363}, 
       {-0.05, 1.3062464117898722, 2.1316004108852304}, 
       {-0.05, 1.2215531037423875, 2.1812400176819926}, 
       {-0.05, 1.134976249348867, 2.2275163104709197}, 
       {-0.05, 1.0466493438435704, 2.270357934562703}, 
       {-0.05, 0.9567085809127246, 2.309698831278217}, 
       {-0.05, 0.8652926426937325, 2.3454783398062102}, 
       {-0.05, 0.7725424859373686, 2.3776412907378837}, 
       {-0.05, 0.6786011246626857, 2.4061380911341184}, 
       {-0.05, 0.5836134096397637, 2.4309248009941915}, 
       {-0.05, 0.4877258050403208, 2.451963201008076}, 
       {-0.05, 0.3910861626005773, 2.4692208514878446}, 
       {-0.05, 0.2938434936445943, 2.4826711423873156}, 
       {-0.05, 0.1961477393196125, 2.4922933343328197}, 
       {-0.05, 0.09814953939767167, 2.498072590601807}, 
       {-0.05, 1.5307579422779716*^-16, 2.5}, 
       {-0.05, -0.09814953939767138, 2.498072590601807}, 
       {-0.05, -0.19614773931961219, 2.4922933343328197}, 
       {-0.05, -0.29384349364459394, 2.4826711423873156}, 
       {-0.05, -0.39108616260057705, 2.4692208514878446}, 
       {-0.05, -0.4877258050403205, 2.451963201008076}, 
       {-0.05, -0.5836134096397634, 2.4309248009941915}, 
       {-0.05, -0.6786011246626855, 2.4061380911341184}, 
       {-0.05, -0.7725424859373684, 2.377641290737884}, 
       {-0.05, -0.8652926426937323, 2.3454783398062102}, 
       {-0.05, -0.9567085809127243, 2.309698831278217}, 
       {-0.05, -1.0466493438435696, 2.270357934562704}, 
       {-0.05, -1.1349762493488667, 2.2275163104709197}, 
       {-0.05, -1.2215531037423877, 2.1812400176819926}, 
       {-0.05, -1.306246411789872, 2.131600410885231}, 
       {-0.05, -1.388925582549005, 2.0786740307563636}, 
       {-0.05, -1.4694631307311825, 2.0225424859373686}, 
       {-0.05, -1.5477348732745853, 1.963292327201862}, 
       {-0.05, -1.6236201208254588, 1.9010149140000776}, 
       {-0.05, -1.6970018638323539, 1.8358062735892144}, 
       {-0.05, -1.7677669529663687, 1.7677669529663689}, 
       {-0.05, -1.8358062735892142, 1.6970018638323543}, 
       {-0.05, -1.9010149140000774, 1.6236201208254595}, 
       {-0.05, -1.9632923272018619, 1.5477348732745855}, 
       {-0.05, -2.022542485937368, 1.4694631307311832}, 
       {-0.05, -2.078674030756363, 1.3889255825490054}, 
       {-0.05, -2.1316004108852304, 1.3062464117898722}, 
       {-0.05, -2.1812400176819926, 1.2215531037423881}, 
       {-0.05, -2.2275163104709197, 1.134976249348867}, 
       {-0.05, -2.2703579345627034, 1.04664934384357}, 
       {-0.05, -2.309698831278217, 0.9567085809127247}, 
       {-0.05, -2.3454783398062102, 0.8652926426937333}, 
       {-0.05, -2.3776412907378837, 0.7725424859373687}, 
       {-0.05, -2.4061380911341184, 0.6786011246626854}, 
       {-0.05, -2.4309248009941915, 0.5836134096397638}, 
       {-0.05, -2.451963201008076, 0.48772580504032154}, 
       {-0.05, -2.469220851487844, 0.39108616260057744}, 
       {-0.05, -2.4826711423873156, 0.2938434936445939}, 
       {-0.05, -2.4922933343328197, 0.19614773931961266}, 
       {-0.05, -2.498072590601807, 0.09814953939767238}, 
       {-0.05, -2.5, 3.061515884555943*^-16}, 
       {-0.05, -2.498072590601807, -0.09814953939767176}, 
       {-0.05, -2.4922933343328197, -0.19614773931961205}, 
       {-0.05, -2.4826711423873156, -0.2938434936445932}, 
       {-0.05, -2.4692208514878446, -0.3910861626005768}, 
       {-0.05, -2.451963201008076, -0.4877258050403209}, 
       {-0.05, -2.4309248009941915, -0.5836134096397632}, 
       {-0.05, -2.4061380911341184, -0.6786011246626849}, 
       {-0.05, -2.377641290737884, -0.7725424859373682}, 
       {-0.05, -2.3454783398062102, -0.8652926426937326}, 
       {-0.05, -2.309698831278217, -0.9567085809127241}, 
       {-0.05, -2.270357934562704, -1.0466493438435693}, 
       {-0.05, -2.2275163104709197, -1.1349762493488667}, 
       {-0.05, -2.1812400176819926, -1.2215531037423875}, 
       {-0.05, -2.131600410885231, -1.3062464117898718}, 
       {-0.05, -2.0786740307563636, -1.388925582549005}, 
       {-0.05, -2.022542485937369, -1.4694631307311825}, 
       {-0.05, -1.963292327201862, -1.5477348732745853}, 
       {-0.05, -1.9010149140000776, -1.6236201208254588}, 
       {-0.05, -1.8358062735892144, -1.6970018638323536}, 
       {-0.05, -1.7677669529663693, -1.7677669529663687}, 
       {-0.05, -1.6970018638323543, -1.8358062735892138}, 
       {-0.05, -1.6236201208254601, -1.9010149140000765}, 
       {-0.05, -1.5477348732745857, -1.9632923272018619}, 
       {-0.05, -1.4694631307311832, -2.022542485937368}, 
       {-0.05, -1.3889255825490054, -2.078674030756363}, 
       {-0.05, -1.3062464117898713, -2.131600410885231}, 
       {-0.05, -1.2215531037423881, -2.1812400176819926}, 
       {-0.05, -1.1349762493488673, -2.2275163104709197}, 
       {-0.05, -1.04664934384357, -2.2703579345627034}, 
       {-0.05, -0.9567085809127258, -2.309698831278216}, 
       {-0.05, -0.8652926426937334, -2.3454783398062102}, 
       {-0.05, -0.7725424859373689, -2.3776412907378837}, 
       {-0.05, -0.6786011246626855, -2.4061380911341184}, 
       {-0.05, -0.5836134096397628, -2.4309248009941915}, 
       {-0.05, -0.48772580504032165, -2.4519632010080756}, 
       {-0.05, -0.3910861626005776, -2.469220851487844}, 
       {-0.05, -0.293843493644594, -2.4826711423873156}, 
       {-0.05, -0.19614773931961393, -2.4922933343328197}, 
       {-0.05, -0.09814953939767253, -2.498072590601807}, 
       {-0.05, -4.592273826833915*^-16, -2.5}, 
       {-0.05, 0.09814953939767161, -2.498072590601807}, 
       {-0.05, 0.19614773931961302, -2.4922933343328197}, 
       {-0.05, 0.2938434936445931, -2.4826711423873156}, 
       {-0.05, 0.3910861626005767, -2.4692208514878446}, 
       {-0.05, 0.48772580504032076, -2.451963201008076}, 
       {-0.05, 0.5836134096397619, -2.430924800994192}, 
       {-0.05, 0.6786011246626846, -2.4061380911341184}, 
       {-0.05, 0.7725424859373681, -2.377641290737884}, 
       {-0.05, 0.8652926426937325, -2.3454783398062102}, 
       {-0.05, 0.956708580912725, -2.3096988312782165}, 
       {-0.05, 1.0466493438435691, -2.270357934562704}, 
       {-0.05, 1.1349762493488667, -2.2275163104709197}, 
       {-0.05, 1.2215531037423875, -2.1812400176819926}, 
       {-0.05, 1.3062464117898709, -2.1316004108852313}, 
       {-0.05, 1.3889255825490046, -2.0786740307563636}, 
       {-0.05, 1.4694631307311823, -2.022542485937369}, 
       {-0.05, 1.5477348732745848, -1.9632923272018623}, 
       {-0.05, 1.6236201208254597, -1.901014914000077}, 
       {-0.05, 1.6970018638323536, -1.8358062735892144}, 
       {-0.05, 1.7677669529663684, -1.7677669529663693}, 
       {-0.05, 1.8358062735892138, -1.6970018638323545}, 
       {-0.05, 1.9010149140000763, -1.6236201208254606}, 
       {-0.05, 1.9632923272018616, -1.5477348732745857}, 
       {-0.05, 2.022542485937368, -1.4694631307311834}, 
       {-0.05, 2.078674030756363, -1.3889255825490054}, 
       {-0.05, 2.131600410885231, -1.3062464117898718}, 
       {-0.05, 2.181240017681992, -1.2215531037423883}, 
       {-0.05, 2.2275163104709197, -1.1349762493488673}, 
       {-0.05, 2.270357934562703, -1.0466493438435702}, 
       {-0.05, 2.309698831278216, -0.956708580912726}, 
       {-0.05, 2.34547833980621, -0.8652926426937335}, 
       {-0.05, 2.3776412907378837, -0.7725424859373691}, 
       {-0.05, 2.4061380911341184, -0.6786011246626856}, 
       {-0.05, 2.4309248009941915, -0.5836134096397629}, 
       {-0.05, 2.4519632010080756, -0.4877258050403218}, 
       {-0.05, 2.469220851487844, -0.3910861626005777}, 
       {-0.05, 2.4826711423873156, -0.29384349364459417}, 
       {-0.05, 2.4922933343328197, -0.19614773931961405}, 
       {-0.05, 2.498072590601807, -0.09814953939767268}, 
       {-0.05, 2.5, -6.123031769111886*^-16}}, {{-0.05, 5., 0.}, 
       {-0.05, 4.996145181203614, 0.19629907879534306}, 
       {-0.05, 4.9845866686656395, 0.3922954786392247}, 
       {-0.05, 4.965342284774631, 0.5876869872891882}, 
       {-0.05, 4.938441702975689, 0.7821723252011543}, 
       {-0.05, 4.903926402016152, 0.9754516100806412}, 
       {-0.05, 4.861849601988383, 1.167226819279527}, 
       {-0.05, 4.812276182268237, 1.3572022493253713}, 
       {-0.05, 4.755282581475767, 1.545084971874737}, 
       {-0.05, 4.6909566796124205, 1.7305852853874648}, 
       {-0.05, 4.619397662556434, 1.913417161825449}, 
       {-0.05, 4.540715869125406, 2.0932986876871404}, 
       {-0.05, 4.455032620941839, 2.2699524986977337}, 
       {-0.05, 4.362480035363986, 2.4431062074847745}, 
       {-0.05, 4.263200821770461, 2.612492823579744}, 
       {-0.05, 4.157348061512726, 2.777851165098011}, 
       {-0.05, 4.045084971874737, 2.938926261462366}, 
       {-0.05, 3.9265846544037246, 3.0954697465491696}, 
       {-0.05, 3.8020298280001548, 3.2472402416509185}, 
       {-0.05, 3.6716125471784276, 3.3940037276647086}, 
       {-0.05, 3.5355339059327378, 3.5355339059327373}, 
       {-0.05, 3.394003727664709, 3.6716125471784276}, 
       {-0.05, 3.2472402416509185, 3.8020298280001548}, 
       {-0.05, 3.0954697465491696, 3.9265846544037246}, 
       {-0.05, 2.938926261462366, 4.045084971874737}, 
       {-0.05, 2.7778511650980113, 4.157348061512726}, 
       {-0.05, 2.6124928235797444, 4.263200821770461}, 
       {-0.05, 2.443106207484775, 4.362480035363985}, 
       {-0.05, 2.269952498697734, 4.455032620941839}, 
       {-0.05, 2.093298687687141, 4.540715869125406}, 
       {-0.05, 1.9134171618254492, 4.619397662556434}, 
       {-0.05, 1.730585285387465, 4.6909566796124205}, 
       {-0.05, 1.5450849718747373, 4.755282581475767}, 
       {-0.05, 1.3572022493253715, 4.812276182268237}, 
       {-0.05, 1.1672268192795274, 4.861849601988383}, 
       {-0.05, 0.9754516100806416, 4.903926402016152}, 
       {-0.05, 0.7821723252011547, 4.938441702975689}, 
       {-0.05, 0.5876869872891886, 4.965342284774631}, 
       {-0.05, 0.392295478639225, 4.9845866686656395}, 
       {-0.05, 0.19629907879534333, 4.996145181203614}, 
       {-0.05, 3.061515884555943*^-16, 5.}, 
       {-0.05, -0.19629907879534275, 4.996145181203614}, 
       {-0.05, -0.39229547863922437, 4.9845866686656395}, 
       {-0.05, -0.5876869872891879, 4.965342284774631}, 
       {-0.05, -0.7821723252011541, 4.938441702975689}, 
       {-0.05, -0.975451610080641, 4.903926402016152}, 
       {-0.05, -1.1672268192795268, 4.861849601988383}, 
       {-0.05, -1.357202249325371, 4.812276182268237}, 
       {-0.05, -1.5450849718747368, 4.755282581475768}, 
       {-0.05, -1.7305852853874646, 4.6909566796124205}, 
       {-0.05, -1.9134171618254485, 4.619397662556434}, 
       {-0.05, -2.093298687687139, 4.540715869125408}, 
       {-0.05, -2.2699524986977333, 4.455032620941839}, 
       {-0.05, -2.4431062074847754, 4.362480035363985}, 
       {-0.05, -2.612492823579744, 4.263200821770462}, 
       {-0.05, -2.77785116509801, 4.157348061512727}, 
       {-0.05, -2.938926261462365, 4.045084971874737}, 
       {-0.05, -3.0954697465491705, 3.926584654403724}, 
       {-0.05, -3.2472402416509176, 3.802029828000155}, 
       {-0.05, -3.3940037276647077, 3.671612547178429}, 
       {-0.05, -3.5355339059327373, 3.5355339059327378}, 
       {-0.05, -3.6716125471784284, 3.3940037276647086}, 
       {-0.05, -3.8020298280001548, 3.247240241650919}, 
       {-0.05, -3.9265846544037237, 3.095469746549171}, 
       {-0.05, -4.045084971874736, 2.9389262614623664}, 
       {-0.05, -4.157348061512726, 2.777851165098011}, 
       {-0.05, -4.263200821770461, 2.6124928235797444}, 
       {-0.05, -4.362480035363985, 2.4431062074847762}, 
       {-0.05, -4.455032620941839, 2.269952498697734}, 
       {-0.05, -4.540715869125407, 2.09329868768714}, 
       {-0.05, -4.619397662556434, 1.9134171618254494}, 
       {-0.05, -4.6909566796124205, 1.7305852853874666}, 
       {-0.05, -4.755282581475767, 1.5450849718747375}, 
       {-0.05, -4.812276182268237, 1.3572022493253708}, 
       {-0.05, -4.861849601988383, 1.1672268192795276}, 
       {-0.05, -4.903926402016152, 0.9754516100806431}, 
       {-0.05, -4.938441702975688, 0.7821723252011549}, 
       {-0.05, -4.965342284774631, 0.5876869872891878}, 
       {-0.05, -4.9845866686656395, 0.3922954786392253}, 
       {-0.05, -4.996145181203614, 0.19629907879534475}, 
       {-0.05, -5., 6.123031769111886*^-16}, {-0.05, -4.996145181203614, 
        -0.19629907879534353}, {-0.05, -4.9845866686656395, 
        -0.3922954786392241}, {-0.05, -4.965342284774631, 
        -0.5876869872891864}, {-0.05, -4.938441702975689, 
        -0.7821723252011537}, {-0.05, -4.903926402016152, 
        -0.9754516100806419}, {-0.05, -4.861849601988383, 
        -1.1672268192795263}, {-0.05, -4.812276182268237, 
        -1.3572022493253697}, {-0.05, -4.755282581475768, 
        -1.5450849718747364}, {-0.05, -4.6909566796124205, 
        -1.7305852853874653}, {-0.05, -4.619397662556434, 
        -1.9134171618254483}, {-0.05, -4.540715869125408, 
        -2.0932986876871387}, {-0.05, -4.455032620941839, 
        -2.2699524986977333}, {-0.05, -4.362480035363985, 
        -2.443106207484775}, {-0.05, -4.263200821770462, 
        -2.6124928235797436}, {-0.05, -4.157348061512727, 
        -2.77785116509801}, {-0.05, -4.045084971874738, 
        -2.938926261462365}, {-0.05, -3.926584654403724, 
        -3.0954697465491705}, {-0.05, -3.802029828000155, 
        -3.2472402416509176}, {-0.05, -3.671612547178429, 
        -3.3940037276647073}, {-0.05, -3.5355339059327386, 
        -3.5355339059327373}, {-0.05, -3.3940037276647086, 
        -3.6716125471784276}, {-0.05, -3.2472402416509203, 
        -3.802029828000153}, {-0.05, -3.0954697465491714, 
        -3.9265846544037237}, {-0.05, -2.9389262614623664, 
        -4.045084971874736}, {-0.05, -2.777851165098011, 
        -4.157348061512726}, {-0.05, -2.6124928235797427, 
        -4.263200821770462}, {-0.05, -2.4431062074847762, 
        -4.362480035363985}, {-0.05, -2.2699524986977346, 
        -4.455032620941839}, {-0.05, -2.09329868768714, 
        -4.540715869125407}, {-0.05, -1.9134171618254516, 
        -4.619397662556432}, {-0.05, -1.7305852853874668, 
        -4.6909566796124205}, {-0.05, -1.5450849718747377, 
        -4.755282581475767}, {-0.05, -1.357202249325371, 
        -4.812276182268237}, {-0.05, -1.1672268192795257, 
        -4.861849601988383}, {-0.05, -0.9754516100806433, 
        -4.903926402016151}, {-0.05, -0.7821723252011552, 
        -4.938441702975688}, {-0.05, -0.587686987289188, 
        -4.965342284774631}, {-0.05, -0.39229547863922787, 
        -4.9845866686656395}, {-0.05, -0.19629907879534506, 
        -4.996145181203614}, {-0.05, -9.18454765366783*^-16, -5.}, 
       {-0.05, 0.19629907879534322, -4.996145181203614}, 
       {-0.05, 0.39229547863922604, -4.9845866686656395}, 
       {-0.05, 0.5876869872891862, -4.965342284774631}, 
       {-0.05, 0.7821723252011534, -4.938441702975689}, 
       {-0.05, 0.9754516100806415, -4.903926402016152}, 
       {-0.05, 1.1672268192795239, -4.861849601988384}, 
       {-0.05, 1.3572022493253693, -4.812276182268237}, 
       {-0.05, 1.5450849718747361, -4.755282581475768}, 
       {-0.05, 1.730585285387465, -4.6909566796124205}, 
       {-0.05, 1.91341716182545, -4.619397662556433}, 
       {-0.05, 2.0932986876871382, -4.540715869125408}, 
       {-0.05, 2.2699524986977333, -4.455032620941839}, 
       {-0.05, 2.443106207484775, -4.362480035363985}, 
       {-0.05, 2.6124928235797418, -4.263200821770463}, 
       {-0.05, 2.777851165098009, -4.157348061512727}, 
       {-0.05, 2.9389262614623646, -4.045084971874738}, 
       {-0.05, 3.0954697465491696, -3.9265846544037246}, 
       {-0.05, 3.2472402416509194, -3.802029828000154}, 
       {-0.05, 3.3940037276647073, -3.671612547178429}, 
       {-0.05, 3.535533905932737, -3.5355339059327386}, 
       {-0.05, 3.6716125471784276, -3.394003727664709}, 
       {-0.05, 3.8020298280001525, -3.247240241650921}, 
       {-0.05, 3.9265846544037233, -3.0954697465491714}, 
       {-0.05, 4.045084971874736, -2.938926261462367}, 
       {-0.05, 4.157348061512726, -2.777851165098011}, 
       {-0.05, 4.263200821770462, -2.6124928235797436}, 
       {-0.05, 4.362480035363984, -2.4431062074847767}, 
       {-0.05, 4.455032620941839, -2.2699524986977346}, 
       {-0.05, 4.540715869125406, -2.0932986876871404}, 
       {-0.05, 4.619397662556432, -1.913417161825452}, 
       {-0.05, 4.69095667961242, -1.730585285387467}, 
       {-0.05, 4.755282581475767, -1.5450849718747381}, 
       {-0.05, 4.812276182268237, -1.3572022493253713}, 
       {-0.05, 4.861849601988383, -1.1672268192795259}, 
       {-0.05, 4.903926402016151, -0.9754516100806436}, 
       {-0.05, 4.938441702975688, -0.7821723252011554}, 
       {-0.05, 4.965342284774631, -0.5876869872891883}, 
       {-0.05, 4.9845866686656395, -0.3922954786392281}, 
       {-0.05, 4.996145181203614, -0.19629907879534536}, 
       {-0.05, 5., -1.2246063538223773*^-15}}, 
      {{1.3689976525819987, 5.65, 0.}, {1.3689976525819982, 
        5.645644054760084, 0.22181795903873766}, {1.3689976525819987, 
        5.632582935592174, 0.44329389086232396}, {1.3689976525819991, 
        5.610836781795334, 0.6640862956367828}, {1.3689976525819987, 
        5.580439124362528, 0.8838547274773044}, {1.3689976525819985, 
        5.541436834278252, 1.1022603193911247}, {1.3689976525819985, 
        5.493890050246873, 1.3189663057858656}, {1.3689976525819985, 
        5.437872085963107, 1.5336385417376697}, {1.3689976525819985, 
        5.3734693170676175, 1.745946018218453}, {1.3689976525819987, 
        5.300781047962036, 1.9555613724878353}, {1.3689976525819985, 
        5.21991935868877, 2.162161392862757}, {1.3689976525819985, 
        5.131008932111709, 2.3654275170864687}, {1.3689976525819985, 
        5.034186861664279, 2.5650463235284393}, {1.368997652581999, 
        4.929602439961305, 2.7607100144577954}, {1.3689976525819982, 
        4.817416928600621, 2.9521168906451107}, {1.368997652581999, 
        4.697803309509381, 3.1389718165607525}, {1.368997652581999, 
        4.570946018218454, 3.3209866754524735}, {1.368997652581999, 
        4.437040659476209, 3.4978808136005624}, {1.368997652581999, 
        4.296293705640175, 3.669381473065538}, {1.368997652581999, 
        4.148922178311624, 3.835224212261121}, {1.368997652581999, 
        3.995153313703994, 3.9951533137039936}, {1.368997652581999, 
        3.8352242122611213, 4.148922178311624}, {1.368997652581999, 
        3.669381473065538, 4.296293705640175}, {1.368997652581999, 
        3.4978808136005624, 4.437040659476209}, {1.368997652581999, 
        3.3209866754524735, 4.570946018218454}, {1.368997652581999, 
        3.138971816560753, 4.697803309509381}, {1.3689976525819985, 
        2.9521168906451116, 4.817416928600621}, {1.3689976525819987, 
        2.760710014457796, 4.929602439961304}, {1.3689976525819987, 
        2.5650463235284398, 5.034186861664279}, {1.3689976525819987, 
        2.365427517086469, 5.131008932111709}, {1.3689976525819987, 
        2.1621613928627577, 5.21991935868877}, {1.3689976525819987, 
        1.9555613724878356, 5.300781047962036}, {1.3689976525819985, 
        1.7459460182184532, 5.3734693170676175}, {1.3689976525819985, 
        1.53363854173767, 5.437872085963107}, {1.3689976525819985, 
        1.318966305785866, 5.493890050246873}, {1.3689976525819985, 
        1.1022603193911251, 5.541436834278252}, {1.3689976525819987, 
        0.8838547274773048, 5.580439124362528}, {1.3689976525819991, 
        0.664086295636783, 5.610836781795334}, {1.3689976525819987, 
        0.4432938908623243, 5.632582935592174}, {1.3689976525819982, 
        0.22181795903873797, 5.645644054760084}, {1.3689976525819987, 
        3.459512949548216*^-16, 5.65}, {1.3689976525819982, 
        -0.2218179590387373, 5.645644054760084}, {1.3689976525819987, 
        -0.44329389086232357, 5.632582935592174}, {1.368997652581999, 
        -0.6640862956367823, 5.610836781795334}, {1.3689976525819987, 
        -0.8838547274773042, 5.580439124362528}, {1.3689976525819985, 
        -1.1022603193911245, 5.541436834278252}, {1.368997652581999, 
        -1.3189663057858652, 5.493890050246874}, {1.3689976525819985, 
        -1.5336385417376694, 5.437872085963107}, {1.368997652581999, 
        -1.7459460182184525, 5.373469317067618}, {1.3689976525819987, 
        -1.9555613724878351, 5.300781047962036}, {1.3689976525819985, 
        -2.162161392862757, 5.21991935868877}, {1.368997652581999, 
        -2.3654275170864674, 5.131008932111711}, {1.3689976525819985, 
        -2.565046323528439, 5.034186861664279}, {1.368997652581999, 
        -2.7607100144577963, 4.929602439961304}, {1.368997652581999, 
        -2.9521168906451107, 4.817416928600622}, {1.368997652581999, 
        -3.138971816560751, 4.697803309509382}, {1.3689976525819985, 
        -3.3209866754524726, 4.570946018218454}, {1.368997652581999, 
        -3.497880813600563, 4.437040659476208}, {1.368997652581999, 
        -3.6693814730655374, 4.296293705640176}, {1.3689976525819987, 
        -3.83522421226112, 4.148922178311625}, {1.368997652581999, 
        -3.9951533137039936, 3.995153313703994}, {1.368997652581999, 
        -4.148922178311624, 3.835224212261121}, {1.368997652581999, 
        -4.296293705640175, 3.6693814730655387}, {1.368997652581999, 
        -4.437040659476208, 3.4978808136005632}, {1.368997652581999, 
        -4.570946018218453, 3.320986675452474}, {1.368997652581999, 
        -4.697803309509381, 3.1389718165607525}, {1.3689976525819985, 
        -4.817416928600621, 2.9521168906451116}, {1.368997652581999, 
        -4.929602439961303, 2.760710014457797}, {1.3689976525819987, 
        -5.034186861664279, 2.5650463235284398}, {1.3689976525819987, 
        -5.13100893211171, 2.3654275170864683}, {1.3689976525819987, 
        -5.21991935868877, 2.162161392862758}, {1.3689976525819987, 
        -5.300781047962035, 1.9555613724878373}, {1.3689976525819985, 
        -5.3734693170676175, 1.7459460182184536}, {1.3689976525819982, 
        -5.437872085963107, 1.533638541737669}, {1.3689976525819985, 
        -5.493890050246873, 1.3189663057858663}, {1.3689976525819987, 
        -5.541436834278252, 1.1022603193911267}, {1.3689976525819987, 
        -5.580439124362528, 0.8838547274773051}, {1.368997652581999, 
        -5.610836781795334, 0.6640862956367822}, {1.3689976525819987, 
        -5.632582935592174, 0.4432938908623247}, {1.3689976525819982, 
        -5.645644054760084, 0.22181795903873958}, {1.3689976525819987, 
        -5.65, 6.919025899096432*^-16}, {1.3689976525819982, 
        -5.645644054760084, -0.22181795903873822}, 
       {1.3689976525819987, -5.632582935592174, -0.44329389086232324}, 
       {1.368997652581999, -5.610836781795334, -0.6640862956367808}, 
       {1.3689976525819987, -5.580439124362528, -0.8838547274773036}, 
       {1.3689976525819985, -5.541436834278252, -1.1022603193911253}, 
       {1.368997652581999, -5.493890050246874, -1.318966305785865}, 
       {1.368997652581999, -5.437872085963108, -1.533638541737668}, 
       {1.368997652581999, -5.373469317067618, -1.7459460182184523}, 
       {1.368997652581999, -5.300781047962036, -1.955561372487836}, 
       {1.3689976525819987, -5.219919358688771, -2.1621613928627568}, 
       {1.368997652581999, -5.131008932111711, -2.365427517086467}, 
       {1.3689976525819985, -5.034186861664279, -2.565046323528439}, 
       {1.3689976525819987, -4.929602439961304, -2.760710014457796}, 
       {1.3689976525819987, -4.817416928600622, -2.9521168906451103}, 
       {1.368997652581999, -4.697803309509382, -3.138971816560751}, 
       {1.3689976525819985, -4.570946018218454, -3.3209866754524726}, 
       {1.368997652581999, -4.437040659476208, -3.497880813600563}, 
       {1.368997652581999, -4.296293705640176, -3.6693814730655374}, 
       {1.3689976525819985, -4.148922178311625, -3.8352242122611195}, 
       {1.368997652581999, -3.9951533137039945, -3.9951533137039936}, 
       {1.368997652581999, -3.835224212261121, -4.148922178311624}, 
       {1.368997652581999, -3.6693814730655405, -4.296293705640173}, 
       {1.3689976525819991, -3.497880813600564, -4.437040659476208}, 
       {1.368997652581999, -3.320986675452474, -4.570946018218453}, 
       {1.368997652581999, -3.1389718165607525, -4.697803309509381}, 
       {1.3689976525819987, -2.95211689064511, -4.817416928600623}, 
       {1.368997652581999, -2.7607100144577976, -4.929602439961303}, 
       {1.3689976525819987, -2.56504632352844, -5.034186861664279}, 
       {1.3689976525819987, -2.3654275170864683, -5.13100893211171}, 
       {1.3689976525819987, -2.1621613928627603, -5.219919358688769}, 
       {1.3689976525819987, -1.9555613724878376, -5.300781047962035}, 
       {1.3689976525819987, -1.7459460182184539, -5.3734693170676175}, 
       {1.3689976525819985, -1.5336385417376694, -5.437872085963107}, 
       {1.3689976525819987, -1.318966305785864, -5.493890050246874}, 
       {1.3689976525819987, -1.1022603193911271, -5.541436834278252}, 
       {1.3689976525819987, -0.8838547274773054, -5.580439124362528}, 
       {1.368997652581999, -0.6640862956367825, -5.610836781795334}, 
       {1.368997652581999, -0.4432938908623275, -5.632582935592174}, 
       {1.3689976525819982, -0.22181795903873994, -5.645644054760084}, 
       {1.3689976525819987, -1.0378538848644648*^-15, -5.65}, 
       {1.3689976525819982, 0.22181795903873786, -5.645644054760084}, 
       {1.3689976525819987, 0.44329389086232546, -5.632582935592174}, 
       {1.368997652581999, 0.6640862956367805, -5.610836781795334}, 
       {1.3689976525819987, 0.8838547274773033, -5.580439124362528}, 
       {1.3689976525819985, 1.102260319391125, -5.541436834278252}, 
       {1.3689976525819985, 1.318966305785862, -5.493890050246874}, 
       {1.3689976525819987, 1.5336385417376674, -5.437872085963108}, 
       {1.3689976525819987, 1.7459460182184519, -5.373469317067618}, 
       {1.3689976525819987, 1.9555613724878356, -5.300781047962036}, 
       {1.368997652581999, 2.1621613928627585, -5.21991935868877}, 
       {1.3689976525819987, 2.3654275170864665, -5.131008932111711}, 
       {1.3689976525819985, 2.565046323528439, -5.034186861664279}, 
       {1.3689976525819987, 2.760710014457796, -4.929602439961304}, 
       {1.3689976525819985, 2.9521168906451085, -4.817416928600623}, 
       {1.3689976525819987, 3.1389718165607507, -4.697803309509382}, 
       {1.3689976525819985, 3.320986675452472, -4.570946018218454}, 
       {1.368997652581999, 3.4978808136005624, -4.437040659476209}, 
       {1.3689976525819987, 3.669381473065539, -4.296293705640174}, 
       {1.3689976525819985, 3.8352242122611195, -4.148922178311625}, 
       {1.3689976525819985, 3.9951533137039927, -3.9951533137039945}, 
       {1.368997652581999, 4.148922178311624, -3.8352242122611213}, 
       {1.3689976525819987, 4.296293705640172, -3.669381473065541}, 
       {1.3689976525819985, 4.4370406594762075, -3.497880813600564}, 
       {1.3689976525819991, 4.570946018218453, -3.320986675452475}, 
       {1.368997652581999, 4.697803309509381, -3.1389718165607525}, 
       {1.3689976525819987, 4.817416928600622, -2.9521168906451103}, 
       {1.3689976525819985, 4.929602439961302, -2.760710014457798}, 
       {1.368997652581999, 5.034186861664279, -2.5650463235284406}, 
       {1.3689976525819985, 5.131008932111709, -2.3654275170864687}, 
       {1.368997652581999, 5.219919358688769, -2.1621613928627608}, 
       {1.3689976525819987, 5.300781047962035, -1.9555613724878378}, 
       {1.3689976525819987, 5.3734693170676175, -1.745946018218454}, 
       {1.3689976525819985, 5.437872085963107, -1.5336385417376697}, 
       {1.368997652581999, 5.493890050246874, -1.3189663057858645}, 
       {1.3689976525819987, 5.541436834278252, -1.1022603193911273}, 
       {1.3689976525819987, 5.580439124362528, -0.8838547274773058}, 
       {1.3689976525819991, 5.610836781795334, -0.6640862956367828}, 
       {1.368997652581999, 5.632582935592174, -0.4432938908623278}, 
       {1.3689976525819985, 5.645644054760084, -0.2218179590387403}, 
       {1.3689976525819987, 5.65, -1.3838051798192863*^-15}}, 
      {{1.3397916666666667, 5.65, 0.}, {1.339791666666667, 
        5.645644054760084, 0.22181795903873766}, {1.339791666666666, 
        5.632582935592174, 0.44329389086232396}, {1.339791666666666, 
        5.610836781795334, 0.6640862956367828}, {1.3397916666666667, 
        5.580439124362528, 0.8838547274773044}, {1.339791666666667, 
        5.541436834278252, 1.1022603193911247}, {1.3397916666666667, 
        5.493890050246873, 1.3189663057858656}, {1.3397916666666667, 
        5.437872085963107, 1.5336385417376697}, {1.3397916666666672, 
        5.3734693170676175, 1.745946018218453}, {1.3397916666666663, 
        5.300781047962036, 1.9555613724878353}, {1.3397916666666667, 
        5.21991935868877, 2.162161392862757}, {1.3397916666666672, 
        5.131008932111709, 2.3654275170864687}, {1.3397916666666667, 
        5.034186861664279, 2.5650463235284393}, {1.3397916666666658, 
        4.929602439961305, 2.7607100144577954}, {1.3397916666666674, 
        4.817416928600621, 2.9521168906451107}, {1.3397916666666667, 
        4.697803309509381, 3.1389718165607525}, {1.339791666666666, 
        4.570946018218454, 3.3209866754524735}, {1.3397916666666665, 
        4.437040659476209, 3.4978808136005624}, {1.3397916666666665, 
        4.296293705640175, 3.669381473065538}, {1.3397916666666667, 
        4.148922178311624, 3.835224212261121}, {1.3397916666666663, 
        3.995153313703994, 3.9951533137039936}, {1.339791666666666, 
        3.8352242122611213, 4.148922178311624}, {1.3397916666666663, 
        3.669381473065538, 4.296293705640175}, {1.3397916666666665, 
        3.4978808136005624, 4.437040659476209}, {1.3397916666666658, 
        3.3209866754524735, 4.570946018218454}, {1.3397916666666665, 
        3.138971816560753, 4.697803309509381}, {1.3397916666666665, 
        2.9521168906451116, 4.817416928600621}, {1.3397916666666667, 
        2.760710014457796, 4.929602439961304}, {1.3397916666666663, 
        2.5650463235284398, 5.034186861664279}, {1.3397916666666667, 
        2.365427517086469, 5.131008932111709}, {1.3397916666666667, 
        2.1621613928627577, 5.21991935868877}, {1.3397916666666663, 
        1.9555613724878356, 5.300781047962036}, {1.3397916666666667, 
        1.7459460182184532, 5.3734693170676175}, {1.3397916666666667, 
        1.53363854173767, 5.437872085963107}, {1.3397916666666667, 
        1.318966305785866, 5.493890050246873}, {1.3397916666666667, 
        1.1022603193911251, 5.541436834278252}, {1.3397916666666667, 
        0.8838547274773048, 5.580439124362528}, {1.3397916666666658, 
        0.664086295636783, 5.610836781795334}, {1.3397916666666658, 
        0.4432938908623243, 5.632582935592174}, {1.3397916666666672, 
        0.22181795903873797, 5.645644054760084}, {1.3397916666666667, 
        3.459512949548216*^-16, 5.65}, {1.3397916666666672, 
        -0.2218179590387373, 5.645644054760084}, {1.3397916666666658, 
        -0.44329389086232357, 5.632582935592174}, {1.3397916666666658, 
        -0.6640862956367823, 5.610836781795334}, {1.3397916666666667, 
        -0.8838547274773042, 5.580439124362528}, {1.3397916666666672, 
        -1.1022603193911245, 5.541436834278252}, {1.3397916666666658, 
        -1.3189663057858652, 5.493890050246874}, {1.3397916666666667, 
        -1.5336385417376694, 5.437872085963107}, {1.3397916666666663, 
        -1.7459460182184525, 5.373469317067618}, {1.3397916666666663, 
        -1.9555613724878351, 5.300781047962036}, {1.3397916666666667, 
        -2.162161392862757, 5.21991935868877}, {1.3397916666666658, 
        -2.3654275170864674, 5.131008932111711}, {1.3397916666666667, 
        -2.565046323528439, 5.034186861664279}, {1.3397916666666663, 
        -2.7607100144577963, 4.929602439961304}, {1.3397916666666665, 
        -2.9521168906451107, 4.817416928600622}, {1.3397916666666665, 
        -3.138971816560751, 4.697803309509382}, {1.3397916666666667, 
        -3.3209866754524726, 4.570946018218454}, {1.3397916666666667, 
        -3.497880813600563, 4.437040659476208}, {1.339791666666666, 
        -3.6693814730655374, 4.296293705640176}, {1.3397916666666663, 
        -3.83522421226112, 4.148922178311625}, {1.3397916666666663, 
        -3.9951533137039936, 3.995153313703994}, {1.3397916666666667, 
        -4.148922178311624, 3.835224212261121}, {1.3397916666666658, 
        -4.296293705640175, 3.6693814730655387}, {1.3397916666666663, 
        -4.437040659476208, 3.4978808136005632}, {1.3397916666666667, 
        -4.570946018218453, 3.320986675452474}, {1.3397916666666667, 
        -4.697803309509381, 3.1389718165607525}, {1.339791666666667, 
        -4.817416928600621, 2.9521168906451116}, {1.3397916666666665, 
        -4.929602439961303, 2.760710014457797}, {1.3397916666666665, 
        -5.034186861664279, 2.5650463235284398}, {1.3397916666666663, 
        -5.13100893211171, 2.3654275170864683}, {1.3397916666666665, 
        -5.21991935868877, 2.162161392862758}, {1.3397916666666667, 
        -5.300781047962035, 1.9555613724878373}, {1.3397916666666667, 
        -5.3734693170676175, 1.7459460182184536}, {1.3397916666666667, 
        -5.437872085963107, 1.533638541737669}, {1.3397916666666665, 
        -5.493890050246873, 1.3189663057858663}, {1.3397916666666665, 
        -5.541436834278252, 1.1022603193911267}, {1.3397916666666665, 
        -5.580439124362528, 0.8838547274773051}, {1.339791666666666, 
        -5.610836781795334, 0.6640862956367822}, {1.339791666666666, 
        -5.632582935592174, 0.4432938908623247}, {1.339791666666667, 
        -5.645644054760084, 0.22181795903873958}, {1.3397916666666667, 
        -5.65, 6.919025899096432*^-16}, {1.339791666666667, 
        -5.645644054760084, -0.22181795903873822}, 
       {1.339791666666666, -5.632582935592174, -0.44329389086232324}, 
       {1.3397916666666663, -5.610836781795334, -0.6640862956367808}, 
       {1.3397916666666667, -5.580439124362528, -0.8838547274773036}, 
       {1.3397916666666667, -5.541436834278252, -1.1022603193911253}, 
       {1.3397916666666658, -5.493890050246874, -1.318966305785865}, 
       {1.3397916666666663, -5.437872085963108, -1.533638541737668}, 
       {1.3397916666666663, -5.373469317067618, -1.7459460182184523}, 
       {1.3397916666666663, -5.300781047962036, -1.955561372487836}, 
       {1.339791666666666, -5.219919358688771, -2.1621613928627568}, 
       {1.339791666666666, -5.131008932111711, -2.365427517086467}, 
       {1.3397916666666667, -5.034186861664279, -2.565046323528439}, 
       {1.3397916666666667, -4.929602439961304, -2.760710014457796}, 
       {1.3397916666666667, -4.817416928600622, -2.9521168906451103}, 
       {1.3397916666666665, -4.697803309509382, -3.138971816560751}, 
       {1.3397916666666665, -4.570946018218454, -3.3209866754524726}, 
       {1.3397916666666667, -4.437040659476208, -3.497880813600563}, 
       {1.3397916666666663, -4.296293705640176, -3.6693814730655374}, 
       {1.3397916666666667, -4.148922178311625, -3.8352242122611195}, 
       {1.3397916666666658, -3.9951533137039945, -3.9951533137039936}, 
       {1.3397916666666665, -3.835224212261121, -4.148922178311624}, 
       {1.3397916666666663, -3.6693814730655405, -4.296293705640173}, 
       {1.3397916666666658, -3.497880813600564, -4.437040659476208}, 
       {1.3397916666666665, -3.320986675452474, -4.570946018218453}, 
       {1.3397916666666665, -3.1389718165607525, -4.697803309509381}, 
       {1.3397916666666658, -2.95211689064511, -4.817416928600623}, 
       {1.3397916666666663, -2.7607100144577976, -4.929602439961303}, 
       {1.3397916666666663, -2.56504632352844, -5.034186861664279}, 
       {1.3397916666666663, -2.3654275170864683, -5.13100893211171}, 
       {1.3397916666666667, -2.1621613928627603, -5.219919358688769}, 
       {1.3397916666666667, -1.9555613724878376, -5.300781047962035}, 
       {1.3397916666666667, -1.7459460182184539, -5.3734693170676175}, 
       {1.3397916666666667, -1.5336385417376694, -5.437872085963107}, 
       {1.3397916666666663, -1.318966305785864, -5.493890050246874}, 
       {1.3397916666666663, -1.1022603193911271, -5.541436834278252}, 
       {1.3397916666666663, -0.8838547274773054, -5.580439124362528}, 
       {1.3397916666666658, -0.6640862956367825, -5.610836781795334}, 
       {1.3397916666666658, -0.4432938908623275, -5.632582935592174}, 
       {1.3397916666666667, -0.22181795903873994, -5.645644054760084}, 
       {1.3397916666666667, -1.0378538848644648*^-15, -5.65}, 
       {1.3397916666666672, 0.22181795903873786, -5.645644054760084}, 
       {1.3397916666666658, 0.44329389086232546, -5.632582935592174}, 
       {1.3397916666666663, 0.6640862956367805, -5.610836781795334}, 
       {1.3397916666666667, 0.8838547274773033, -5.580439124362528}, 
       {1.3397916666666667, 1.102260319391125, -5.541436834278252}, 
       {1.3397916666666667, 1.318966305785862, -5.493890050246874}, 
       {1.3397916666666663, 1.5336385417376674, -5.437872085963108}, 
       {1.3397916666666667, 1.7459460182184519, -5.373469317067618}, 
       {1.3397916666666663, 1.9555613724878356, -5.300781047962036}, 
       {1.3397916666666663, 2.1621613928627585, -5.21991935868877}, 
       {1.3397916666666663, 2.3654275170864665, -5.131008932111711}, 
       {1.3397916666666667, 2.565046323528439, -5.034186861664279}, 
       {1.3397916666666667, 2.760710014457796, -4.929602439961304}, 
       {1.3397916666666667, 2.9521168906451085, -4.817416928600623}, 
       {1.3397916666666665, 3.1389718165607507, -4.697803309509382}, 
       {1.3397916666666667, 3.320986675452472, -4.570946018218454}, 
       {1.3397916666666665, 3.4978808136005624, -4.437040659476209}, 
       {1.3397916666666663, 3.669381473065539, -4.296293705640174}, 
       {1.3397916666666667, 3.8352242122611195, -4.148922178311625}, 
       {1.3397916666666665, 3.9951533137039927, -3.9951533137039945}, 
       {1.3397916666666663, 4.148922178311624, -3.8352242122611213}, 
       {1.3397916666666667, 4.296293705640172, -3.669381473065541}, 
       {1.3397916666666667, 4.4370406594762075, -3.497880813600564}, 
       {1.3397916666666663, 4.570946018218453, -3.320986675452475}, 
       {1.3397916666666667, 4.697803309509381, -3.1389718165607525}, 
       {1.3397916666666667, 4.817416928600622, -2.9521168906451103}, 
       {1.339791666666667, 4.929602439961302, -2.760710014457798}, 
       {1.339791666666666, 5.034186861664279, -2.5650463235284406}, 
       {1.3397916666666672, 5.131008932111709, -2.3654275170864687}, 
       {1.3397916666666663, 5.219919358688769, -2.1621613928627608}, 
       {1.3397916666666665, 5.300781047962035, -1.9555613724878378}, 
       {1.3397916666666667, 5.3734693170676175, -1.745946018218454}, 
       {1.3397916666666667, 5.437872085963107, -1.5336385417376697}, 
       {1.339791666666666, 5.493890050246874, -1.3189663057858645}, 
       {1.3397916666666665, 5.541436834278252, -1.1022603193911273}, 
       {1.3397916666666665, 5.580439124362528, -0.8838547274773058}, 
       {1.339791666666666, 5.610836781795334, -0.6640862956367828}, 
       {1.3397916666666658, 5.632582935592174, -0.4432938908623278}, 
       {1.339791666666667, 5.645644054760084, -0.2218179590387403}, 
       {1.3397916666666667, 5.65, -1.3838051798192863*^-15}}, 
      {{9.414603431411972, 11.95, 0.}, {9.414603431411981, 
        11.940786983076638, 0.46915479832086987}, {9.41460343141197, 
        11.913162138110879, 0.937586193947747}, {9.414603431411978, 
        11.867168060611368, 1.4045718996211598}, {9.414603431411978, 
        11.802875670111895, 1.8693918572307588}, {9.414603431411978, 
        11.720384100818602, 2.3313293480927326}, {9.414603431411978, 
        11.619820548752234, 2.789672098078069}, {9.414603431411981, 
        11.501340075621084, 3.243713375887637}, {9.414603431411983, 
        11.365125369727084, 3.692753082780621}, {9.414603431411967, 
        11.211386464273685, 4.136098832076041}, {9.414603431411965, 
        11.040360413509877, 4.573067016762822}, {9.414603431411981, 
        10.85231092720972, 5.002983863572266}, {9.41460343141197, 
        10.647527964050996, 5.425186471887583}, {9.41460343141196, 
        10.426327284519926, 5.839023835888611}, {9.414603431411976, 
        10.189049964031401, 6.243857848355588}, {9.41460343141198, 
        9.936061867015415, 6.639064284584245}, {9.414603431411972, 
        9.66775308278062, 7.024033764895053}, {9.414603431411976, 
        9.384537324024901, 7.398172694252516}, {9.414603431411967, 
        9.08685128892037, 7.760904177545695}, {9.414603431411987, 
        8.775153987756442, 8.111668909118652}, {9.414603431411972, 
        8.449926035179242, 8.449926035179242}, {9.414603431411972, 
        8.111668909118654, 8.775153987756442}, {9.414603431411967, 
        7.760904177545695, 9.08685128892037}, {9.41460343141198, 
        7.398172694252516, 9.384537324024901}, {9.414603431411972, 
        7.024033764895053, 9.66775308278062}, {9.414603431411972, 
        6.639064284584247, 9.936061867015415}, {9.414603431411967, 
        6.2438578483555895, 10.189049964031401}, {9.414603431411967, 
        5.839023835888612, 10.426327284519925}, {9.414603431411987, 
        5.425186471887584, 10.647527964050994}, {9.41460343141198, 
        5.002983863572266, 10.85231092720972}, {9.41460343141196, 
        4.573067016762823, 11.040360413509877}, {9.41460343141196, 
        4.1360988320760415, 11.211386464273685}, {9.414603431411987, 
        3.6927530827806216, 11.365125369727084}, {9.414603431411972, 
        3.243713375887638, 11.501340075621084}, {9.414603431411972, 
        2.78967209807807, 11.619820548752234}, {9.414603431411972, 
        2.3313293480927335, 11.720384100818602}, {9.414603431411972, 
        1.8693918572307595, 11.802875670111895}, {9.414603431411972, 
        1.4045718996211605, 11.867168060611368}, {9.414603431411972, 
        0.9375861939477477, 11.913162138110879}, {9.414603431411987, 
        0.46915479832087054, 11.940786983076638}, {9.414603431411972, 
        7.317022964088704*^-16, 11.95}, {9.414603431411987, 
        -0.4691547983208691, 11.940786983076638}, {9.414603431411972, 
        -0.9375861939477462, 11.913162138110879}, {9.414603431411972, 
        -1.404571899621159, 11.867168060611368}, {9.414603431411972, 
        -1.8693918572307582, 11.802875670111895}, {9.414603431411987, 
        -2.3313293480927317, 11.720384100818602}, {9.41460343141196, 
        -2.7896720980780687, 11.619820548752235}, {9.414603431411987, 
        -3.2437133758876366, 11.501340075621084}, {9.414603431411972, 
        -3.6927530827806203, 11.365125369727085}, {9.414603431411972, 
        -4.13609883207604, 11.211386464273685}, {9.414603431411967, 
        -4.573067016762822, 11.040360413509877}, {9.414603431411967, 
        -5.002983863572262, 10.852310927209723}, {9.414603431411972, 
        -5.425186471887582, 10.647527964050996}, {9.414603431411967, 
        -5.839023835888613, 10.426327284519925}, {9.414603431411967, 
        -6.243857848355588, 10.189049964031403}, {9.414603431411967, 
        -6.639064284584243, 9.936061867015418}, {9.41460343141198, 
        -7.024033764895052, 9.66775308278062}, {9.414603431411967, 
        -7.398172694252517, 9.384537324024901}, {9.41460343141198, 
        -7.760904177545693, 9.08685128892037}, {9.414603431411967, 
        -8.11166890911865, 8.775153987756445}, {9.414603431411972, 
        -8.449926035179242, 8.449926035179242}, {9.414603431411967, 
        -8.775153987756443, 8.111668909118652}, {9.41460343141196, 
        -9.08685128892037, 7.7609041775456955}, {9.414603431411972, 
        -9.3845373240249, 7.398172694252518}, {9.414603431411964, 
        -9.66775308278062, 7.024033764895055}, {9.414603431411967, 
        -9.936061867015416, 6.639064284584245}, {9.414603431411967, 
        -10.189049964031401, 6.2438578483555895}, {9.414603431411976, 
        -10.426327284519923, 5.839023835888614}, {9.414603431411981, 
        -10.647527964050994, 5.425186471887585}, {9.414603431411969, 
        -10.852310927209722, 5.002983863572264}, {9.414603431411956, 
        -11.040360413509877, 4.573067016762824}, {9.414603431411969, 
        -11.211386464273684, 4.136098832076045}, {9.41460343141198, 
        -11.365125369727084, 3.6927530827806225}, {9.414603431411985, 
        -11.501340075621084, 3.2437133758876358}, {9.414603431411972, 
        -11.619820548752234, 2.789672098078071}, {9.414603431411969, 
        -11.720384100818602, 2.3313293480927366}, {9.414603431411974, 
        -11.802875670111895, 1.8693918572307602}, {9.41460343141198, 
        -11.867168060611368, 1.4045718996211587}, {9.414603431411969, 
        -11.913162138110879, 0.9375861939477486}, {9.41460343141198, 
        -11.940786983076638, 0.4691547983208739}, {9.414603431411972, 
        -11.95, 1.4634045928177408*^-15}, {9.414603431411981, 
        -11.940786983076638, -0.46915479832087104}, 
       {9.414603431411972, -11.913162138110879, -0.9375861939477456}, 
       {9.414603431411983, -11.867168060611368, -1.4045718996211556}, 
       {9.41460343141198, -11.802875670111895, -1.869391857230757}, 
       {9.414603431411974, -11.720384100818602, -2.331329348092734}, 
       {9.414603431411967, -11.619820548752235, -2.789672098078068}, 
       {9.41460343141198, -11.501340075621085, -3.243713375887633}, 
       {9.414603431411976, -11.365125369727085, -3.69275308278062}, 
       {9.41460343141196, -11.211386464273685, -4.136098832076042}, 
       {9.414603431411969, -11.040360413509877, -4.573067016762821}, 
       {9.414603431411969, -10.852310927209723, -5.002983863572261}, 
       {9.414603431411974, -10.647527964050996, -5.425186471887582}, 
       {9.414603431411969, -10.426327284519925, -5.839023835888612}, 
       {9.414603431411967, -10.189049964031403, -6.243857848355587}, 
       {9.414603431411964, -9.936061867015418, -6.639064284584243}, 
       {9.414603431411967, -9.667753082780623, -7.024033764895052}, 
       {9.414603431411969, -9.384537324024901, -7.398172694252517}, 
       {9.41460343141198, -9.08685128892037, -7.760904177545693}, 
       {9.414603431411967, -8.775153987756445, -8.11166890911865}, 
       {9.41460343141196, -8.449926035179244, -8.449926035179242}, 
       {9.414603431411987, -8.111668909118652, -8.775153987756442}, 
       {9.414603431411972, -7.7609041775457, -9.086851288920364}, 
       {9.414603431411967, -7.398172694252519, -9.3845373240249}, 
       {9.41460343141196, -7.024033764895055, -9.66775308278062}, 
       {9.41460343141198, -6.639064284584245, -9.936061867015415}, 
       {9.41460343141198, -6.243857848355585, -10.189049964031403}, 
       {9.414603431411972, -5.839023835888615, -10.426327284519923}, 
       {9.41460343141198, -5.425186471887585, -10.647527964050994}, 
       {9.414603431411967, -5.002983863572265, -10.852310927209722}, 
       {9.414603431411972, -4.573067016762829, -11.040360413509873}, 
       {9.414603431411967, -4.136098832076045, -11.211386464273684}, 
       {9.414603431411972, -3.692753082780623, -11.365125369727084}, 
       {9.414603431411987, -3.2437133758876366, -11.501340075621084}, 
       {9.414603431411972, -2.7896720980780665, -11.619820548752235}, 
       {9.414603431411972, -2.3313293480927375, -11.720384100818602}, 
       {9.414603431411972, -1.8693918572307608, -11.802875670111895}, 
       {9.414603431411972, -1.4045718996211594, -11.867168060611368}, 
       {9.41460343141196, -0.9375861939477544, -11.913162138110879}, 
       {9.414603431411972, -0.46915479832087464, -11.940786983076638}, 
       {9.414603431411972, -2.195106889226611*^-15, -11.95}, 
       {9.414603431411987, 0.46915479832087026, -11.940786983076638}, 
       {9.414603431411972, 0.9375861939477502, -11.913162138110879}, 
       {9.414603431411987, 1.404571899621155, -11.867168060611368}, 
       {9.414603431411987, 1.8693918572307564, -11.802875670111895}, 
       {9.414603431411972, 2.331329348092733, -11.720384100818602}, 
       {9.414603431411972, 2.789672098078062, -11.619820548752237}, 
       {9.414603431411987, 3.2437133758876326, -11.501340075621085}, 
       {9.414603431411972, 3.692753082780619, -11.365125369727085}, 
       {9.41460343141196, 4.1360988320760415, -11.211386464273685}, 
       {9.414603431411972, 4.573067016762825, -11.040360413509875}, 
       {9.414603431411972, 5.00298386357226, -10.852310927209723}, 
       {9.414603431411972, 5.425186471887582, -10.647527964050996}, 
       {9.414603431411967, 5.839023835888612, -10.426327284519925}, 
       {9.414603431411972, 6.243857848355582, -10.189049964031405}, 
       {9.414603431411967, 6.639064284584242, -9.936061867015418}, 
       {9.41460343141198, 7.024033764895051, -9.667753082780623}, 
       {9.41460343141198, 7.398172694252516, -9.384537324024901}, 
       {9.41460343141196, 7.760904177545697, -9.086851288920368}, 
       {9.414603431411967, 8.11166890911865, -8.775153987756445}, 
       {9.414603431411972, 8.44992603517924, -8.449926035179244}, 
       {9.414603431411972, 8.775153987756442, -8.111668909118654}, 
       {9.414603431411964, 9.086851288920364, -7.760904177545701}, 
       {9.41460343141198, 9.384537324024897, -7.398172694252519}, 
       {9.414603431411956, 9.66775308278062, -7.024033764895056}, 
       {9.41460343141198, 9.936061867015415, -6.639064284584245}, 
       {9.414603431411967, 10.189049964031403, -6.243857848355587}, 
       {9.414603431411987, 10.426327284519921, -5.839023835888616}, 
       {9.414603431411976, 10.647527964050994, -5.425186471887586}, 
       {9.414603431411981, 10.85231092720972, -5.002983863572266}, 
       {9.414603431411969, 11.040360413509873, -4.57306701676283}, 
       {9.414603431411987, 11.211386464273682, -4.136098832076046}, 
       {9.414603431411974, 11.365125369727084, -3.692753082780624}, 
       {9.414603431411981, 11.501340075621084, -3.243713375887637}, 
       {9.41460343141197, 11.619820548752235, -2.789672098078067}, 
       {9.414603431411967, 11.720384100818602, -2.331329348092738}, 
       {9.414603431411972, 11.802875670111895, -1.8693918572307615}, 
       {9.414603431411978, 11.867168060611368, -1.40457189962116}, 
       {9.414603431411964, 11.913162138110879, -0.9375861939477551}, 
       {9.41460343141198, 11.940786983076638, -0.4691547983208754}, 
       {9.414603431411972, 11.95, -2.9268091856354816*^-15}}}]}}, 
  ControlType -> None}, Initialization :> 
  ( raytracefunction118640200831284558148930 = 
    Compile[{{th, _Real}, {x, _Real}, {y, _Real}}, 
     Module[{activeregion, allcreatedamplitudes, allcreatedrays, 
       allowzeroraylength, alternateindex, amplitude, axismagnitude, 
       axismatrix, clonedata, clonegenerationnumber, cloneinput, 
       clonenumber, cloneposition, clonereportedrays, clonerotation, 
       clonescale, clonescalevector, clonesorthistogram, 
       clonetraceinput, clonetraceoutput, closestdistances, 
       closestposition, closestpositions, closestraylength, 
       completedray, componentnumber, cosangle, crossmatrix, 
       deflecteddummyrayspresent, deflectedlocalrays, deflectedrays, 
       deflectedrayspresent, dummymatrix, dummymatrixlist, dummyvector, 
       frontid, generationlimit, generationnumber, holeintersections, 
       holeQ, holeQlist, hor, index, index1, index2, inrays, intensity, 
       intensityscale, intersectionnumber, intersections, 
       intersectionslist, intersectionspresent, 
       localdummyoutrayspresent, localoutrays, localoutrayspresent, 
       magnitude, maxclonegenerationnumber, maximumposition, 
       minimumraylength, minresonateraylength, n12, newcomponentnumber, 
       newdeflectedrays, newdistance, newsurfaceid, newsurfacenumber, 
       nonintersectingrays, normalizedpolarization, oldgenerationnumber, 
       opticallength, originalray, originalraytilt, originalrotation, 
       originalsurfnorm, outrays, parallelamplitude, PAxis, 
       perpendicularamplitude, phaseshift, pol1, pol2, pol3, 
       previoustilt, propagate, propagatedrays, r1, r2, r3, r4, r5, r6, 
       r7, r8, r9, ray1, ray2, ray3, LocRayL, rayslot, raysreported, 
       raytiltx, raytiltz, reporteddummyrayspresent, reportedlocalrays, 
       reportedrays, reportedrayspresent, resonateintersections, 
       resonatenumber, resonateraylength, rex, rey, rez, rotationaxis, 
       rsx, LocRSx, rsy, LocRSy, rsz, LocRSz, RTx, LocRTy, LocRTz, rx, 
       rxhlp, ry, ryhlp, rz, rzhlp, LocSCx, LocSCy, sid, sinangle, sno1, 
       sno2, sno3, sno4, surfaceid, surfacenumber, 
       surfacerotationmatrix, surfacetranslationvector, surfnorm, symr1, 
       symr2, symr3, symr4, symr5, symr6, symr7, symr8, symr9, 
       tempclonedata, terminatedeflection, thresholdintensity, 
       tiltmagnitude, transmatrix, LocTV1, LocTV10, LocTV2, LocTV3, 
       LocTV4, LocTV5, LocTV6, LocTV7, LocTV8, LocTV9, u, 
       unfilteredintersections, unit, uu, ver, wavelength, XAxis, xunit, 
       YAxis, yunit, ZAxis, zunit}, activeregion = 1.; 
       allcreatedamplitudes = {{0. + 0.*I, 0. + 0.*I, 0. + 0.*I}}; 
       allcreatedrays = {{1.}}; allowzeroraylength = True; 
       alternateindex = 1.; amplitude = {1. + 0.*I, 0. + 0.*I, 
         0. + 0.*I}; axismagnitude = 1.; axismatrix = 
        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; clonedata = {{1.}}; 
       clonegenerationnumber = 1.; cloneinput = {1.}; clonenumber = 1; 
       cloneposition = {0., 0., 0.}; clonereportedrays = {{1.}}; 
       clonerotation = {{1.}}; clonescale = 1.; clonescalevector = {1.}; 
       clonesorthistogram = {1}; clonetraceinput = {{1.}}; 
       clonetraceoutput = {{1.}}; closestdistances = {1.}; 
       closestposition = 0; closestpositions = {0}; 
       closestraylength = 1.; completedray = {1.}; 
       componentnumber = -1.; cosangle = 1.; crossmatrix = 
        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; 
       deflecteddummyrayspresent = False; deflectedlocalrays = {{1.}}; 
       deflectedrays = {{1.}}; deflectedrayspresent = False; 
       dummymatrix = {{1.}}; dummymatrixlist = {{{1.}}}; 
       dummyvector = {1.}; frontid = 1.; generationlimit = 200.; 
       generationnumber = 1.; holeintersections = {{-1., 0., 0.}}; 
       holeQ = False; holeQlist = {0}; hor = 1. + 0.*I; index = 1.; 
       index1 = 1.; index2 = 1.; inrays = {{1.}}; intensity = 1.; 
       intensityscale = 1.; intersectionnumber = 1.; 
       intersections = {{-1., 0., 0.}}; intersectionslist = 
        {{{-1., 0., 0.}}}; intersectionspresent = False; 
       localdummyoutrayspresent = False; localoutrays = {{1.}}; 
       localoutrayspresent = False; magnitude = 1.; 
       maxclonegenerationnumber = 1.; maximumposition = 1; 
       minimumraylength = 0.0001; minresonateraylength = 1.; n12 = 1.; 
       newcomponentnumber = -1.; newdeflectedrays = {{1.}}; 
       newdistance = 1.; newsurfaceid = -1.; newsurfacenumber = -1.; 
       nonintersectingrays = {{1.}}; normalizedpolarization = {1., 1.}; 
       oldgenerationnumber = 1.; opticallength = 1.; originalray = {1.}; 
       originalraytilt = {1.}; originalrotation = {{1., 0., 0.}, 
         {0., 1., 0.}, {0., 0., 1.}}; originalsurfnorm = {{1.}}; 
       outrays = {{1.}}; parallelamplitude = 1. + 0.*I; 
       PAxis = {1., 0., 0.}; perpendicularamplitude = 1. + 0.*I; 
       phaseshift = 0.; pol1 = 1.; pol2 = 1.; pol3 = 1.; 
       previoustilt = {1., 0., 0.}; propagate = True; 
       propagatedrays = {{1.}}; r1 = 1.; r2 = 1.; r3 = 1.; r4 = 1.; 
       r5 = 1.; r6 = 1.; r7 = 1.; r8 = 1.; r9 = 1.; ray1 = 1.; 
       ray2 = 1.; ray3 = 1.; LocRayL = 1.; rayslot = 1.; 
       raysreported = False; raytiltx = 1.; raytiltz = 1.; 
       reporteddummyrayspresent = False; reportedlocalrays = {{1.}}; 
       reportedrays = {{1.}}; reportedrayspresent = False; 
       resonateintersections = {{-1., 0., 0.}}; resonatenumber = 0; 
       resonateraylength = 1.; rex = 1.; rey = 1.; rez = 1.; rsx = 1.; 
       LocRSx = 1.; rsy = 1.; LocRSy = 1.; rsz = 1.; LocRSz = 1.; 
       RTx = 1.; LocRTy = 1.; LocRTz = 1.; rx = 1.; rxhlp = 1.; ry = 1.; 
       ryhlp = 1.; rz = 1.; rzhlp = 1.; LocSCx = 1.; LocSCy = 1.; 
       sid = 1.; sinangle = 1.; sno1 = 1.; sno2 = 1.; sno3 = 1.; 
       sno4 = 1.; surfaceid = -1.; surfacenumber = -1.; 
       surfacerotationmatrix = {{1., 0., 0.}, {0., 1., 0.}, 
         {0., 0., 1.}}; surfacetranslationvector = {0., 0., 0.}; 
       surfnorm = {{1.}}; symr1 = 1.; symr2 = 1.; symr3 = 1.; 
       symr4 = 1.; symr5 = 1.; symr6 = 1.; symr7 = 1.; symr8 = 1.; 
       symr9 = 1.; tempclonedata = {{1.}}; terminatedeflection = False; 
       thresholdintensity = 1.; tiltmagnitude = 1.; 
       transmatrix = {{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}}; 
       LocTV1 = 1.; LocTV10 = 1.; LocTV2 = 1.; LocTV3 = 1.; LocTV4 = 1.; 
       LocTV5 = 1.; LocTV6 = 1.; LocTV7 = 1.; LocTV8 = 1.; LocTV9 = 1.; 
       u = {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; 
       unfilteredintersections = {{-1., 0., 0.}}; 
       unit = {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; 
       uu = {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; ver = 0. + 0.*I; 
       wavelength = 1.; XAxis = {1., 0., 0.}; xunit = 1.; 
       YAxis = {1., 0., 0.}; yunit = 1.; ZAxis = {1., 0., 0.}; 
       zunit = 1.; propagatedrays = 
        Join[{symr1, symr2, symr3, symr4, symr5, symr6, symr7, symr8, 
            symr9} = {Cos[Degree*th], Sin[Degree*th], 0, 
            -Sin[Degree*th], Cos[Degree*th], 0, 0, 0, 1}; 
          (({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
               r8, r9, wavelength, intensity, intensityscale, ray1, 
               index, opticallength, phaseshift, componentnumber, 
               surfacenumber, surfaceid, ray2, ray3, sid, frontid, sno1, 
               sno2, sno3, sno4, rayslot, oldgenerationnumber, 
               intersectionnumber, pol1, pol2, pol3} = #1; 
             {LocTV1, LocTV2, LocTV3} = {rsx*symr1 + rsy*symr4 + 
                rsz*symr7 + x, rsx*symr2 + rsy*symr5 + rsz*symr8 + y, 
               rsx*symr3 + rsy*symr6 + rsz*symr9}; {rsx, rsy, rsz} = 
              {LocTV1, LocTV2, LocTV3}; {LocTV1, LocTV2, LocTV3} = 
              {rex*symr1 + rey*symr4 + rez*symr7 + x, rex*symr2 + 
                rey*symr5 + rez*symr8 + y, rex*symr3 + rey*symr6 + 
                rez*symr9}; {rex, rey, rez} = {LocTV1, LocTV2, LocTV3}; 
             {LocTV1, LocTV2, LocTV3} = {r1*symr1 + r2*symr4 + r3*symr7, 
               r1*symr2 + r2*symr5 + r3*symr8, r1*symr3 + r2*symr6 + 
                r3*symr9}; {LocTV4, LocTV5, LocTV6} = {r4*symr1 + 
                r5*symr4 + r6*symr7, r4*symr2 + r5*symr5 + r6*symr8, 
               r4*symr3 + r5*symr6 + r6*symr9}; {LocTV7, LocTV8, 
               LocTV9} = {r7*symr1 + r8*symr4 + r9*symr7, r7*symr2 + 
                r8*symr5 + r9*symr8, r7*symr3 + r8*symr6 + r9*symr9}; 
             {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
              {{LocTV1, LocTV2, LocTV3}, {LocTV4, LocTV5, LocTV6}, {
                LocTV7, LocTV8, LocTV9}}; {rsx, rsy, rsz, rex, rey, rez, 
              r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
              intensityscale, ray1, index, opticallength, phaseshift, 
              componentnumber, surfacenumber, surfaceid, ray2, ray3, 
              sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
              generationnumber, intersectionnumber, pol1, pol2, 
              pol3}) & ) /@ {{0., -1.5, 0., 0., -1.5, 0., 1., 0., 0., 
             0., 1., 0., 0., 0., 1., 0.532, 100., 0.09090909090909091, 
             0., 1.00026945145708, 0., 0., 1., 0., 0., 0., 0., 100431., 
             100431., 1., 11., 1., 0., 1., 0., 0., 0., 1., 0.}, 
            {0., -1.2, 0., 0., -1.2, 0., 1., 0., 0., 0., 1., 0., 0., 0., 
             1., 0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 
             0., 0., 1., 0., 0., 0., 0., 100431., 100431., 2., 11., 2., 
             0., 1., 0., 0., 0., 1., 0.}, {0., -0.8999999999999999, 0., 
             0., -0.8999999999999999, 0., 1., 0., 0., 0., 1., 0., 0., 
             0., 1., 0.532, 100., 0.09090909090909091, 0., 
             1.00026945145708, 0., 0., 1., 0., 0., 0., 0., 100431., 
             100431., 3., 11., 3., 0., 1., 0., 0., 0., 1., 0.}, 
            {0., -0.5999999999999999, 0., 0., -0.5999999999999999, 0., 
             1., 0., 0., 0., 1., 0., 0., 0., 1., 0.532, 100., 
             0.09090909090909091, 0., 1.00026945145708, 0., 0., 1., 0., 
             0., 0., 0., 100431., 100431., 4., 11., 4., 0., 1., 0., 0., 
             0., 1., 0.}, {0., -0.2999999999999998, 0., 0., 
             -0.2999999999999998, 0., 1., 0., 0., 0., 1., 0., 0., 0., 
             1., 0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 
             0., 0., 1., 0., 0., 0., 0., 100431., 100431., 5., 11., 5., 
             0., 1., 0., 0., 0., 1., 0.}, {0., 2.220446049250313*^-16, 
             0., 0., 2.220446049250313*^-16, 0., 1., 0., 0., 0., 1., 0., 
             0., 0., 1., 0.532, 100., 0.09090909090909091, 0., 
             1.00026945145708, 0., 0., 1., 0., 0., 0., 0., 100431., 
             100431., 6., 11., 6., 0., 1., 0., 0., 0., 1., 0.}, 
            {0., 0.30000000000000027, 0., 0., 0.30000000000000027, 0., 
             1., 0., 0., 0., 1., 0., 0., 0., 1., 0.532, 100., 
             0.09090909090909091, 0., 1.00026945145708, 0., 0., 1., 0., 
             0., 0., 0., 100431., 100431., 7., 11., 7., 0., 1., 0., 0., 
             0., 1., 0.}, {0., 0.6000000000000005, 0., 0., 
             0.6000000000000005, 0., 1., 0., 0., 0., 1., 0., 0., 0., 1., 
             0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 0., 
             0., 1., 0., 0., 0., 0., 100431., 100431., 8., 11., 8., 0., 
             1., 0., 0., 0., 1., 0.}, {0., 0.9000000000000004, 0., 0., 
             0.9000000000000004, 0., 1., 0., 0., 0., 1., 0., 0., 0., 1., 
             0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 0., 
             0., 1., 0., 0., 0., 0., 100431., 100431., 9., 11., 9., 0., 
             1., 0., 0., 0., 1., 0.}, {0., 1.2000000000000002, 0., 0., 
             1.2000000000000002, 0., 1., 0., 0., 0., 1., 0., 0., 0., 1., 
             0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 0., 
             0., 1., 0., 0., 0., 0., 100431., 100431., 10., 11., 10., 
             0., 1., 0., 0., 0., 1., 0.}, {0., 1.5000000000000004, 0., 
             0., 1.5000000000000004, 0., 1., 0., 0., 0., 1., 0., 0., 0., 
             1., 0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 
             0., 0., 1., 0., 0., 0., 0., 100431., 100431., 11., 11., 
             11., 0., 1., 0., 0., 0., 1., 0.}}]; propagatedrays = 
        (({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
             r9, wavelength, intensity, intensityscale, ray1, index, 
             opticallength, phaseshift, componentnumber, surfacenumber, 
             surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, 
             sno4, rayslot, oldgenerationnumber, intersectionnumber, 
             pol1, pol2, pol3} = #1; componentnumber = 1.; frontid = 1.; 
           {rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
            r8, r9, wavelength, intensity, intensityscale, ray1, index, 
            opticallength, phaseshift, componentnumber, surfacenumber, 
            surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
            rayslot, generationnumber, intersectionnumber, pol1, pol2, 
            pol3}) & ) /@ propagatedrays; thresholdintensity = 1.; 
       generationlimit = 200.; reportedrays = 
        {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
          r9, wavelength, intensity, intensityscale, ray1, index, 
          opticallength, phaseshift, componentnumber, surfacenumber, 
          surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
          rayslot, generationnumber, intersectionnumber, pol1, pol2, 
          pol3}}; generationnumber = 0.; (generationnumber += 1.; 
        reportedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, 
           r4, r5, r6, r7, r8, r9, wavelength, 0, intensityscale, ray1, 
           index, opticallength, phaseshift, componentnumber, 
           surfacenumber, surfaceid, ray2, ray3, sid, frontid, sno1, 
           sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; deflectedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, intensity, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; (deflectedrayspresent = False; reportedrayspresent = 
          False; deflecteddummyrayspresent = False; 
         reporteddummyrayspresent = False; {deflectedlocalrays, 
           reportedlocalrays} = Transpose[
           ((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                 r8, r9, wavelength, intensity, intensityscale, ray1, 
                 index, opticallength, phaseshift, componentnumber, 
                 surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                 sno1, sno2, sno3, sno4, rayslot, oldgenerationnumber, 
                 intersectionnumber, pol1, pol2, pol3} = #1; index1 = 
                index; xunit = r1; yunit = r2; zunit = r3; xunit = 
                Chop[xunit]; yunit = Chop[yunit]; zunit = Chop[zunit]; 
               magnitude = (xunit^2 + yunit^2 + zunit^2)^2^(-1); xunit = 
                xunit/magnitude; yunit = yunit/magnitude; zunit = 
                zunit/magnitude; rx = 3.5999999999999996 + rex; ry = 
                rey; rz = rez; rx = Chop[rx]; ry = Chop[ry]; rz = 
                Chop[rz]; terminatedeflection = False; intersections = 
                {{-1., 0., 0.}}); If[intensity > thresholdintensity, 
               deflectedrayspresent = True; (intersections = 
                  Block[{LocRayL, LocSCx, LocSCy}, LocRayL = 1. + I*0.; 
                    LocSCx = 1. + I*0.; LocSCy = 1. + I*0.; 
                    Re[Select[{{-1. + 0.*I, 0. + 0.*I, 0. + 0.*I}, 
                       {(386.*xunit - 37.*rx*xunit - 50.*ry*yunit - 
                        50.*rz*zunit - 1.4142135623730951*Sqrt[
                        74498.*xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*
                        xunit^2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*
                        xunit*yunit + 19300.*rx*yunit^2 - 925.*rx^2*
                        yunit^2 - 1250.*rz^2*yunit^2 - 19300.*rz*xunit*
                        zunit + 1850.*rx*rz*xunit*zunit + 2500.*ry*rz*
                        yunit*zunit + 19300.*rx*zunit^2 - 925.*rx^2*
                        zunit^2 - 1250.*ry^2*zunit^2])/(37.*xunit^2 + 
                        50.*yunit^2 + 50.*zunit^2), (37.*ry*xunit^2 + 
                        386.*xunit*yunit - 37.*rx*xunit*yunit - 50.*rz*
                        yunit*zunit + 50.*ry*zunit^2 - 
                        1.4142135623730951*yunit*Sqrt[74498.*xunit^2 - 
                        925.*ry^2*xunit^2 - 925.*rz^2*xunit^2 - 19300.*
                        ry*xunit*yunit + 1850.*rx*ry*xunit*yunit + 
                        19300.*rx*yunit^2 - 925.*rx^2*yunit^2 - 1250.*
                        rz^2*yunit^2 - 19300.*rz*xunit*zunit + 1850.*rx*
                        rz*xunit*zunit + 2500.*ry*rz*yunit*zunit + 
                        19300.*rx*zunit^2 - 925.*rx^2*zunit^2 - 1250.*
                        ry^2*zunit^2])/(37.*xunit^2 + 50.*yunit^2 + 
                        50.*zunit^2), (37.*rz*xunit^2 + 50.*rz*yunit^2 + 
                        386.*xunit*zunit - 37.*rx*xunit*zunit - 50.*ry*
                        yunit*zunit - 1.4142135623730951*zunit*Sqrt[
                        74498.*xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*
                        xunit^2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*
                        xunit*yunit + 19300.*rx*yunit^2 - 925.*rx^2*
                        yunit^2 - 1250.*rz^2*yunit^2 - 19300.*rz*xunit*
                        zunit + 1850.*rx*rz*xunit*zunit + 2500.*ry*rz*
                        yunit*zunit + 19300.*rx*zunit^2 - 925.*rx^2*
                        zunit^2 - 1250.*ry^2*zunit^2])/(37.*xunit^2 + 
                        50.*yunit^2 + 50.*zunit^2)}, {(386.*xunit - 
                        37.*rx*xunit - 50.*ry*yunit - 50.*rz*zunit + 
                        1.4142135623730951*Sqrt[74498.*xunit^2 - 925.*
                        ry^2*xunit^2 - 925.*rz^2*xunit^2 - 19300.*ry*
                        xunit*yunit + 1850.*rx*ry*xunit*yunit + 19300.*
                        rx*yunit^2 - 925.*rx^2*yunit^2 - 1250.*rz^2*
                        yunit^2 - 19300.*rz*xunit*zunit + 1850.*rx*rz*
                        xunit*zunit + 2500.*ry*rz*yunit*zunit + 19300.*
                        rx*zunit^2 - 925.*rx^2*zunit^2 - 1250.*ry^2*
                        zunit^2])/(37.*xunit^2 + 50.*yunit^2 + 50.*
                        zunit^2), (37.*ry*xunit^2 + 386.*xunit*yunit - 
                        37.*rx*xunit*yunit - 50.*rz*yunit*zunit + 
                        50.*ry*zunit^2 + 1.4142135623730951*yunit*
                        Sqrt[74498.*xunit^2 - 925.*ry^2*xunit^2 - 
                        925.*rz^2*xunit^2 - 19300.*ry*xunit*yunit + 
                        1850.*rx*ry*xunit*yunit + 19300.*rx*yunit^2 - 
                        925.*rx^2*yunit^2 - 1250.*rz^2*yunit^2 - 19300.*
                        rz*xunit*zunit + 1850.*rx*rz*xunit*zunit + 
                        2500.*ry*rz*yunit*zunit + 19300.*rx*zunit^2 - 
                        925.*rx^2*zunit^2 - 1250.*ry^2*zunit^2])/
                        (37.*xunit^2 + 50.*yunit^2 + 50.*zunit^2), 
                        (37.*rz*xunit^2 + 50.*rz*yunit^2 + 386.*xunit*
                        zunit - 37.*rx*xunit*zunit - 50.*ry*yunit*
                        zunit + 1.4142135623730951*zunit*Sqrt[74498.*
                        xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*xunit^
                        2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*xunit*
                        yunit + 19300.*rx*yunit^2 - 925.*rx^2*yunit^2 - 
                        1250.*rz^2*yunit^2 - 19300.*rz*xunit*zunit + 
                        1850.*rx*rz*xunit*zunit + 2500.*ry*rz*yunit*
                        zunit + 19300.*rx*zunit^2 - 925.*rx^2*zunit^2 - 
                        1250.*ry^2*zunit^2])/(37.*xunit^2 + 50.*yunit^
                        2 + 50.*zunit^2)}}, ({LocRayL, LocSCx, LocSCy} = 
                        #1; {LocRayL, LocSCx, LocSCy} == {-1., 0., 
                        0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[Re[LocRayL]]] >= 0. && Abs[ry + LocRayL*
                        yunit - LocSCx] + Abs[rz + LocRayL*zunit - 
                        LocSCy] + Abs[rx + LocRayL*xunit - (25*(LocSCx^
                        2 + LocSCy^2))/(193*(1 + Sqrt[1 - (925*(LocSCx^
                        2 + LocSCy^2))/74498]))] < 1.*^-7 && 
                        Re[LocSCx]^2 + Re[LocSCy]^2 <= 39.0625)) & ]]]; 
                 AppendTo[intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100987.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 1., 
                     100987.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 1., 100987.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -3.5999999999999996 + rxhlp; rey = ryhlp; 
                   rez = rzhlp; rex = Chop[rex]; rey = Chop[rey]; 
                   rez = Chop[rez]; intersectionnumber = 
                    intersectionnumber + 1.; opticallength = 
                    opticallength + ray1*index1; completedray = 
                    {rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                     r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., (-0.0016083472422043674*ray2^3)/
                        (Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])^2) - (0.0016083472422043674*
                        ray2*ray3^2)/(Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)])^2) - 
                        (0.2590673575129534*ray2)/(1. + Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]), 
                        (-0.0016083472422043674*ray2^2*ray3)/(Sqrt[
                        1. - 0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) - (0.0016083472422043674*ray3^3)/
                        (Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])^2) - (0.2590673575129534*
                        ray3)/(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])}, {(0.0016083472422043674*
                        ray2*(ray2^2 + ray3^2))/(Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) + (0.2590673575129534*ray2)/(1. + 
                        Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]), 1., 0.}, {(0.0016083472422043674*ray3*
                        (ray2^2 + ray3^2))/(Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) + (0.2590673575129534*ray3)/(1. + 
                        Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]), 0., 1.}}]; If[surfnorm[[1]] == {0., 0., 
                        0.} || surfnorm[[2]] == {0., 0., 0.} || 
                      surfnorm[[3]] == {0., 0., 0.}, surfnorm = 
                       1.*Re[{{1., (-0.0016083472422043674*(1.*^-6 + 
                        ray2)^3)/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.0016083472422043674*(1.*^-6 + ray2)*(1.*^-6 + 
                        ray3)^2)/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.2590673575129534*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 
                        (-0.0016083472422043674*(1.*^-6 + ray2)^2*
                        (1.*^-6 + ray3))/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.0016083472422043674*(1.*^-6 + ray3)^3)/
                        (Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.2590673575129534*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])}, {(0.0016083472422043674*
                        (1.*^-6 + ray2)*((1.*^-6 + ray2)^2 + (1.*^-6 + 
                        ray3)^2))/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) + 
                        (0.2590673575129534*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 1., 0.}, 
                        {(0.0016083472422043674*(1.*^-6 + ray3)*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2))/
                        (Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.2590673575129534*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = 
                     {-3.5999999999999996, 0, 0}; activeregion = 1.; 
                    completedray = {rsx, rsy, rsz, rex, rey, rez, r1, 
                      r2, r3, r4, r5, r6, r7, r8, r9, wavelength, 
                      intensity, intensityscale, ray1, index, 
                      opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.5392664079781753 - 
                        0.7232199521975703*wavelength + 
                        1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        Sqrt[1.0005281111748805 - 2.364805676582992*^-10*
                        wavelength^2 + 2.9781670902982902*^-6/wavelength^
                        2 + 2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]; 
                        If[Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = Sqrt[1.0005281111748805 - 
                        2.364805676582992*^-10*wavelength^2 + 
                        2.9781670902982902*^-6/wavelength^2 + 
                        2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]], 
                     index2 = Sqrt[1.0005281111748805 - 
                        2.364805676582992*^-10*wavelength^2 + 
                        2.9781670902982902*^-6/wavelength^2 + 
                        2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]; index1 = 
                       index; If[Abs[index2 - index1] < 0.01, 
                       alternateindex = 1.5392664079781753 - 
                        0.7232199521975703*wavelength + 
                        1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                3.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{TempVar, TempVar1, TempVar2, 
                    TempVar3, LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                    TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                     {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                    TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                      6.5*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                      2*rx*6.5; TempVar3 = Re[TempVar3]; 
                    If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 25. && Abs[ry + LocRayL*
                        yunit - LocSCx] + Abs[rz + LocRayL*zunit - 
                        LocSCy] + Abs[-6.5 + rx + LocRayL*xunit + Sqrt[
                        42.25 - LocSCx^2 - LocSCy^2]] < 1.*^-7, 
                        {LocRayL, LocSCx, LocSCy}, {-1., 0., 0.}], 
                        {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        25. && Abs[ry + LocRayL*yunit - LocSCx] + 
                        Abs[rz + LocRayL*zunit - LocSCy] + Abs[-6.5 + 
                        rx + LocRayL*xunit + Sqrt[42.25 - LocSCx^2 - 
                        LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, LocSCy}, 
                        {-1., 0., 0.}]}; If[TempVar[[1]] == TempVar[[
                        2]], {TempVar[[1]]}, TempVar], {{-1., 0., 
                       0.}}]]; AppendTo[intersections, {-1., 0., 0.}]; 
                 holeQ = False; If[ !(Chop[surfaceid - 100988.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 2., 
                     100988.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 2., 100988.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -3.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., -(ray2/(42.25 - ray2^2 - ray3^2)^
                        2^(-1)), -(ray3/(42.25 - ray2^2 - ray3^2)^
                        2^(-1))}, {ray2/(42.25 - ray2^2 - ray3^2)^
                        2^(-1), 1., 0.}, {ray3/(42.25 - ray2^2 - ray3^2)^
                        2^(-1), 0., 1.}}]; dummymatrix = (#1 & ) /@ 
                      surfnorm; surfnorm = (#1/Sqrt[#1 . #1] & ) /@ 
                      dummymatrix; surfacerotationmatrix = {{1., 0, 0}, 
                      {0, 1., 0}, {0, 0, 1.}}; 
                    surfacetranslationvector = {-3.05, 0, 0}; 
                    activeregion = 1.; completedray = {rsx, rsy, rsz, 
                      rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.5532682085807892 - 
                        1.0054245500487249*wavelength + 
                        1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3], index2 = 
                       1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                0.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = If[Chop[xunit] != 0, 
                   {(If[N[Chop[#1[[1]]]] >= 0. && #1[[2]]^2 + #1[[3]]^
                        2 <= 6.25, {#1[[1]], #1[[2]], #1[[3]]}, 
                       {-1., 0., 0.}] & )[{-(rx/xunit), ry - (rx*yunit)/
                        xunit, rz - (rx*zunit)/xunit}]}, {{-1., 0., 
                     0.}}]; AppendTo[intersections, {-1., 0., 0.}]; 
                 holeQ = False; If[ !(Chop[surfaceid - 100989.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 3., 
                     100989.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 3., 100989.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -0.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {-0.05, 0, 
                      0}; activeregion = 0.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; 
                    allcreatedrays = {{rsx, rsy, rsz, rex, rey, rez, r1, 
                       r2, r3, r4, r5, r6, r7, r8, r9, wavelength, 
                       intensity, intensityscale, ray1, index, 
                       opticallength, phaseshift, componentnumber, 
                       surfacenumber, surfaceid, ray2, ray3, sid, 
                       frontid, sno1, sno2, sno3, sno4, rayslot, 
                       generationnumber, intersectionnumber, pol1, pol2, 
                       pol3}})); {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                0.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = If[Chop[xunit] != 0, 
                   {(If[N[Chop[#1[[1]]]] >= 0. && #1[[2]]^2 + #1[[3]]^
                        2 <= 25., {#1[[1]], #1[[2]], #1[[3]]}, {-1., 0., 
                        0.}] & )[{-(rx/xunit), ry - (rx*yunit)/xunit, 
                      rz - (rx*zunit)/xunit}]}, {{-1., 0., 0.}}]; 
                 AppendTo[intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100990.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]; intersections = 
                  Union[(If[#1[[2]]^2 + #1[[3]]^2 <= 6.25, holeQ = True; 
                       {-1., 0., 0.}, #1] & ) /@ 
                    unfilteredintersections]; If[Length[intersections] > 
                   1, dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 4., 
                     100990.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 4., 100990.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -0.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {-0.05, 0, 
                      0}; activeregion = 0.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; intensity = 
                     0.; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}})); {First[allcreatedrays], 
                   completedray}, reporteddummyrayspresent = True; 
                  {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                    r6, r7, r8, r9, wavelength, intensity, 
                    intensityscale, ray1, index, opticallength, 
                    phaseshift, componentnumber, surfacenumber, 
                    surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                    sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = rex; ry = 
                rey; rz = rez; rx = Chop[rx]; ry = Chop[ry]; rz = 
                Chop[rz]; terminatedeflection = False; intersections = 
                {{-1., 0., 0.}}); If[intensity > thresholdintensity, 
               deflectedrayspresent = True; (intersections = 
                  Block[{surfaceapprox, tempapprox, intersects, LocRayL, 
                    LocSCx, LocSCy}, LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; surfaceapprox = {{-1., 0., 0.}}; 
                    tempapprox = {{-1., 0., 0.}}; intersects = 
                     {{-1., 0., 0.}}; surfaceapprox = Block[{TempVar, 
                       TempVar1, TempVar2, TempVar3, LocRayL, LocSCx, 
                       LocSCy}, TempVar1 = 1.; TempVar2 = 1.; TempVar3 = 
                        1.; TempVar = {{-1., 0., 0.}}; LocRayL = 1.; 
                       LocSCx = 1.; LocSCy = 1.; TempVar1 = rx^2 + 
                        ry^2 + rz^2; TempVar2 = rx*xunit + ry*yunit + 
                        rz*zunit - 10.2*xunit; TempVar3 = -TempVar1 + 
                        TempVar2^2 + 2*rx*10.2; TempVar3 = Re[TempVar3]; 
                       If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[-10.2 + rx + 
                        LocRayL*xunit + Sqrt[104.03999999999999 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}], {LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 + TempVar3, ry + 
                        (-TempVar2 + TempVar3)*yunit, rz + (-TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[-10.2 + rx + 
                        LocRayL*xunit + Sqrt[104.03999999999999 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                        {{-1., 0., 0.}}]]; tempapprox = Union[Join[
                       (Take[#1, 3] & ) /@ surfaceapprox, {{-1., 0., 
                        0.}}]]; If[Length[Select[tempapprox, 
                        Chop[First[#1]] <= 0 & ]] != Length[tempapprox], 
                     surfaceapprox = Select[tempapprox, 
                       Chop[First[#1]] > 0 & ], surfaceapprox = 
                      {{-1., 0., 0.}}]; If[surfaceapprox != {{-1., 0., 
                        0.}}, intersects = {{-1., 0., 0.}}; Scan[
                       (AppendTo[intersects, {LocRayL, LocSCx, LocSCy} = 
                        {#1[[1]], #1[[2]], #1[[3]]}; If[Plus @@ Abs[
                        {rx + LocRayL*xunit, ry + LocRayL*yunit, rz + 
                        LocRayL*zunit} - {(0.09803921568627452*(LocSCx^
                        2 + LocSCy^2))/(1 + Sqrt[1 + 
                        0.020488273740868906*(LocSCx^2 + LocSCy^2)]), 
                        LocSCx, LocSCy}] < 1.*^-9, {LocRayL, LocSCx, 
                        LocSCy}, LocRayL = 0.99*LocRayL; Function[{rx, 
                        ry, rz, xunit, yunit, zunit, startpoint}, Block[
                        {values, stepsizes, fvector, success, steps, 
                        denominator}, values = {1.}; stepsizes = {1.}; 
                        fvector = {1.}; success = False; steps = 0; 
                        denominator = 1.; stepsizes = Table[
                        1.0000000000000001*^-7, {3}]; values = 
                        startpoint; While[steps < 50 && (success = True; 
                        (If[Abs[#1] > 1.*^-9, success = False; 1., 
                        1.] & ) /@ stepsizes;  !success), steps = 
                        steps + 1; fvector = {rx + xunit*values[[1]], 
                        ry + yunit*values[[1]], rz + zunit*values[[
                        1]]} - {(0.09803921568627452*(values[[2]]^2 + 
                        values[[3]]^2))/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]), values[[2]], values[[3]]}; 
                        denominator = xunit - yunit*((
                        (0.002008654288320481*values[[2]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1) - zunit*(((0.002008654288320481*
                        values[[3]]*(values[[2]]^2 + values[[3]]^2))/
                        (Sqrt[1 + 0.020488273740868906*(values[[2]]^2 + 
                        values[[3]]^2)]*(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)])^2) - (0.19607843137254904*values[[3]])/
                        (1 + Sqrt[1 + 0.020488273740868906*(values[[2]]^
                        2 + values[[3]]^2)]))*-1); If[Chop[
                        denominator] != 0, denominator, denominator = 
                        1.]; stepsizes = -(#1 . fvector & ) /@ ({{1, 
                        -(((0.002008654288320481*values[[2]]*(values[[
                        2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1), -(((0.002008654288320481*values[[
                        3]]*(values[[2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1)}, {yunit, -xunit - 
                        ((0.002008654288320481*values[[3]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*zunit, ((0.002008654288320481*values[[
                        3]]*(values[[2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*yunit}, {zunit, ((0.002008654288320481*
                        values[[2]]*(values[[2]]^2 + values[[3]]^2))/
                        (Sqrt[1 + 0.020488273740868906*(values[[2]]^2 + 
                        values[[3]]^2)]*(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)])^2) - (0.19607843137254904*values[[2]])/
                        (1 + Sqrt[1 + 0.020488273740868906*(values[[2]]^
                        2 + values[[3]]^2)]))*zunit, -xunit - 
                        ((0.002008654288320481*values[[2]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*yunit}}/denominator); values = 
                        values + stepsizes]; If[steps >= 50, If[First[
                        values] > 0, values = -values; 1., 1.]; 
                        denominator = 1., 1.]; values]][rx, ry, rz, 
                        xunit, yunit, zunit, {LocRayL, LocSCx, 
                        LocSCy}]]]; {-1., 0., 0.}) & , surfaceapprox]; 
                      Union[Re[Select[intersects, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Plus @@ Abs[{rx + LocRayL*
                        xunit, ry + LocRayL*yunit, rz + LocRayL*zunit} - 
                        {(0.09803921568627452*(LocSCx^2 + LocSCy^2))/
                        (1 + Sqrt[1 + 0.020488273740868906*(LocSCx^2 + 
                        LocSCy^2)]), LocSCx, LocSCy}] < 1.*^-9)) & ]]], 
                     {{-1., 0., 0.}}]]; AppendTo[intersections, 
                  {-1., 0., 0.}]; holeQ = False; If[
                   !(Chop[surfaceid - 100991.] == 0. || N[Chop[ray1]] < 
                      0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 5., 
                     100991.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 5., 100991.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = rxhlp; rey = ryhlp; rez = rzhlp; rex = 
                    Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., (0.002008654288320481*ray2^3)/
                        (Sqrt[1. + 0.020488273740868906*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])^2) + (0.002008654288320481*
                        ray2*ray3^2)/(Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)])^2) - 
                        (0.19607843137254904*ray2)/(1. + Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]), 
                        (0.002008654288320481*ray2^2*ray3)/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.002008654288320481*ray3^3)/
                        (Sqrt[1. + 0.020488273740868906*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])^2) - (0.19607843137254904*
                        ray3)/(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])}, {(-0.002008654288320481*
                        ray2*(ray2^2 + ray3^2))/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.19607843137254904*ray2)/
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)]), 1., 0.}, {(-0.002008654288320481*ray3*
                        (ray2^2 + ray3^2))/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.19607843137254904*ray3)/
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)]), 0., 1.}}]; If[surfnorm[[1]] == 
                       {0., 0., 0.} || surfnorm[[2]] == {0., 0., 0.} || 
                      surfnorm[[3]] == {0., 0., 0.}, surfnorm = 
                       1.*Re[{{1., (0.002008654288320481*(1.*^-6 + ray2)^
                        3)/(Sqrt[1. + 0.020488273740868906*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.002008654288320481*
                        (1.*^-6 + ray2)*(1.*^-6 + ray3)^2)/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.19607843137254904*
                        (1.*^-6 + ray2))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), (0.002008654288320481*
                        (1.*^-6 + ray2)^2*(1.*^-6 + ray3))/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.002008654288320481*
                        (1.*^-6 + ray3)^3)/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.19607843137254904*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])}, {(-0.002008654288320481*
                        (1.*^-6 + ray2)*((1.*^-6 + ray2)^2 + (1.*^-6 + 
                        ray3)^2))/(Sqrt[1. + 0.020488273740868906*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) + 
                        (0.19607843137254904*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. + 0.020488273740868906*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 1., 0.}, 
                        {(-0.002008654288320481*(1.*^-6 + ray3)*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2))/
                        (Sqrt[1. + 0.020488273740868906*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.19607843137254904*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1, 0, 0}, {0, 1, 0}, 
                      {0, 0, 1}}; surfacetranslationvector = {0, 0, 0}; 
                    activeregion = 1.; completedray = {rsx, rsy, rsz, 
                      rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.6765916828635454 - 
                        1.1701284013462314*wavelength + 
                        1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3], index2 = 
                       1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                -4. + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{surfaceapprox, tempapprox, 
                    intersects, LocRayL, LocSCx, LocSCy}, LocRayL = 1.; 
                    LocSCx = 1.; LocSCy = 1.; surfaceapprox = 
                     {{-1., 0., 0.}}; tempapprox = {{-1., 0., 0.}}; 
                    intersects = {{-1., 0., 0.}}; surfaceapprox = 
                     Block[{TempVar, TempVar1, TempVar2, TempVar3, 
                       LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                       TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                        {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                       LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                       TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                        -6.*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                        2*rx*-6.; TempVar3 = Re[TempVar3]; If[
                        N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[6. + rx + LocRayL*
                        xunit - Sqrt[36. - LocSCx^2 - LocSCy^2]] < 
                        1.*^-7, {LocRayL, LocSCx, LocSCy}, {-1., 0., 
                        0.}], {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Abs[ry + LocRayL*yunit - 
                        LocSCx] + Abs[rz + LocRayL*zunit - LocSCy] + 
                        Abs[6. + rx + LocRayL*xunit - Sqrt[36. - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                        {{-1., 0., 0.}}]]; tempapprox = Union[Join[
                       (Take[#1, 3] & ) /@ surfaceapprox, {{-1., 0., 
                        0.}}]]; If[Length[Select[tempapprox, 
                        Chop[First[#1]] <= 0 & ]] != Length[tempapprox], 
                     surfaceapprox = Select[tempapprox, 
                       Chop[First[#1]] > 0 & ], surfaceapprox = 
                      {{-1., 0., 0.}}]; If[surfaceapprox != {{-1., 0., 
                        0.}}, intersects = {{-1., 0., 0.}}; Scan[
                       (AppendTo[intersects, {LocRayL, LocSCx, LocSCy} = 
                        {#1[[1]], #1[[2]], #1[[3]]}; If[Plus @@ Abs[
                        {rx + LocRayL*xunit, ry + LocRayL*yunit, rz + 
                        LocRayL*zunit} - {(-0.16666666666666666*(LocSCx^
                        2 + LocSCy^2))/(1 + Sqrt[Plus[1]]), LocSCx, 
                        LocSCy}] < 1.*^-9, {LocRayL, LocSCx, LocSCy}, 
                        LocRayL = 0.99*LocRayL; Function[{rx, ry, rz, 
                        xunit, yunit, zunit, startpoint}, Block[{values, 
                        stepsizes, fvector, success, steps, 
                        denominator}, values = {1.}; stepsizes = {1.}; 
                        fvector = {1.}; success = False; steps = 0; 
                        denominator = 1.; stepsizes = Table[
                        1.0000000000000001*^-7, {3}]; values = 
                        startpoint; While[steps < 50 && (success = True; 
                        (If[Abs[#1] > 1.*^-9, success = False; 1., 
                        1.] & ) /@ stepsizes;  !success), steps = 
                        steps + 1; fvector = {rx + xunit*values[[1]], 
                        ry + yunit*values[[1]], rz + zunit*values[[
                        1]]} - {(-0.16666666666666666*(values[[2]]^2 + 
                        values[[3]]^2))/(1 + Sqrt[Plus[1]]), values[[
                        2]], values[[3]]}; denominator = xunit - yunit*
                        ((Plus[(0.3333333333333333*values[[2]])/(1 + 
                        Sqrt[Plus[1]])])*-1) - zunit*((Plus[
                        (0.3333333333333333*values[[3]])/(1 + Sqrt[Plus[
                        1]])])*-1); If[Chop[denominator] != 0, 
                        denominator, denominator = 1.]; stepsizes = 
                        -(#1 . fvector & ) /@ ({{1, -((Plus[
                        (0.3333333333333333*values[[2]])/(1 + Sqrt[Plus[
                        1]])])*-1), -((Plus[(0.3333333333333333*values[[
                        3]])/(1 + Sqrt[Plus[1]])])*-1)}, {yunit, 
                        -xunit - (Plus[(0.3333333333333333*values[[3]])/
                        (1 + Sqrt[Plus[1]])])*zunit, (Plus[
                        (0.3333333333333333*values[[3]])/(1 + Sqrt[Plus[
                        1]])])*yunit}, {zunit, (Plus[(0.3333333333333333*
                        values[[2]])/(1 + Sqrt[Plus[1]])])*zunit, 
                        -xunit - (Plus[(0.3333333333333333*values[[2]])/
                        (1 + Sqrt[Plus[1]])])*yunit}}/denominator); 
                        values = values + stepsizes]; If[steps >= 50, 
                        If[First[values] > 0, values = -values; 1., 1.]; 
                        denominator = 1., 1.]; values]][rx, ry, rz, 
                        xunit, yunit, zunit, {LocRayL, LocSCx, 
                        LocSCy}]]]; {-1., 0., 0.}) & , surfaceapprox]; 
                      Union[Re[Select[intersects, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Plus @@ Abs[{rx + LocRayL*
                        xunit, ry + LocRayL*yunit, rz + LocRayL*zunit} - 
                        {(-0.16666666666666666*(LocSCx^2 + LocSCy^2))/
                        (1 + Sqrt[Plus[1]]), LocSCx, LocSCy}] < 
                        1.*^-9)) & ]]], {{-1., 0., 0.}}]]; AppendTo[
                  intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100992.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 6., 
                     100992.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 6., 100992.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = 4. + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., Plus[(0.3333333333333333*ray2)/(1. + 
                        Sqrt[Plus[1.]])], Plus[(0.3333333333333333*ray3)/
                        (1. + Sqrt[Plus[1.]])]}, {Plus[
                        (-0.3333333333333333*ray2)/(1. + Sqrt[Plus[
                        1.]])], 1., 0.}, {Plus[(-0.3333333333333333*
                        ray3)/(1. + Sqrt[Plus[1.]])], 0., 1.}}]; 
                    If[surfnorm[[1]] == {0., 0., 0.} || surfnorm[[2]] == 
                       {0., 0., 0.} || surfnorm[[3]] == {0., 0., 0.}, 
                     surfnorm = 1.*Re[{{1., Plus[(0.3333333333333333*
                        (1.*^-6 + ray2))/(1. + Sqrt[Plus[1.]])], Plus[
                        (0.3333333333333333*(1.*^-6 + ray3))/(1. + 
                        Sqrt[Plus[1.]])]}, {Plus[(-0.3333333333333333*
                        (1.*^-6 + ray2))/(1. + Sqrt[Plus[1.]])], 1., 
                        0.}, {Plus[(-0.3333333333333333*(1.*^-6 + ray3))/
                        (1. + Sqrt[Plus[1.]])], 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {4., 0, 
                      0}; activeregion = 1.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; ZAxis = 
                     First[surfnorm]*Sign[First[surfnorm] . {r1, r2, 
                        r3}]; raytiltz = ZAxis . {r1, r2, r3}; 
                    raytiltx = 1 - raytiltz^2; If[raytiltx < 
                      2.220446049250313*^-16, raytiltx = 0., raytiltx = 
                      Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - ZAxis*
                       raytiltz; If[Abs[raytiltx] < 1.*^-7, XAxis = 
                      surfnorm[[2]], XAxis = XAxis/raytiltx]; YAxis = 
                     {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*XAxis[[3]], 
                      ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*XAxis[[3]], 
                      -(ZAxis[[2]]*XAxis[[1]]) + ZAxis[[1]]*XAxis[[2]]}; 
                    YAxis = YAxis/Sqrt[YAxis . YAxis]; PAxis = 
                     ZAxis*{r1, r2, r3} . XAxis - XAxis*{r1, r2, r3} . 
                        ZAxis; PAxis = PAxis/Sqrt[PAxis . PAxis]; 
                    normalizedpolarization = {pol1, pol2, pol3}[[
                      {1, 2}]]; normalizedpolarization = 
                     normalizedpolarization/Sqrt[
                       normalizedpolarization . normalizedpolarization]; 
                    allcreatedamplitudes = {{I*0., I*0., I*0.}}; 
                    amplitude = Sqrt[intensity]*(normalizedpolarization[[
                        1]]*{r4, r5, r6} + normalizedpolarization[[2]]*
                        {r7, r8, r9}*Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.499266407978439 - 
                        0.7232199521991957*wavelength + 
                        1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3], index2 = 
                       1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.499266407978439 - 0.7232199521991957*
                        wavelength + 1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.499266407978439 - 0.7232199521991957*
                        wavelength + 1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                -20.3203 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{TempVar, TempVar1, TempVar2, 
                    TempVar3, LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                    TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                     {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                    TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                      -12*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                      2*rx*-12; TempVar3 = Re[TempVar3]; 
                    If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 142.80249999999998 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[12 + rx + LocRayL*
                        xunit - Sqrt[144 - LocSCx^2 - LocSCy^2]] < 
                        1.*^-7, {LocRayL, LocSCx, LocSCy}, {-1., 0., 
                        0.}], {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        142.80249999999998 && Abs[ry + LocRayL*yunit - 
                        LocSCx] + Abs[rz + LocRayL*zunit - LocSCy] + 
                        Abs[12 + rx + LocRayL*xunit - Sqrt[144 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                     {{-1., 0., 0.}}]]; AppendTo[intersections, 
                  {-1., 0., 0.}]; holeQ = False; If[
                   !(Chop[surfaceid - 100993.] == 0. || N[Chop[ray1]] < 
                      0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 7., 
                     100993.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 7., 100993.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = 20.3203 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., -(-(ray2/(144 - ray2^2 - ray3^2)^
                        2^(-1))), -(-(ray3/(144 - ray2^2 - ray3^2)^
                        2^(-1)))}, {-(ray2/(144 - ray2^2 - ray3^2)^
                        2^(-1)), 1., 0.}, {-(ray3/(144 - ray2^2 - 
                        ray3^2)^2^(-1)), 0., 1.}}]; dummymatrix = 
                     (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {20.3203, 
                      0, 0}; activeregion = 0.; completedray = 
                     {rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                      r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; 
                    componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; intensity = 0.; allcreatedrays = 
                     {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                       r6, r7, r8, r9, wavelength, intensity, 
                       intensityscale, ray1, index, opticallength, 
                       phaseshift, componentnumber, surfacenumber, 
                       surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                       sno3, sno4, rayslot, generationnumber, 
                       intersectionnumber, pol1, pol2, pol3}})); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                -4. + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{surfaceapprox, tempapprox, 
                    intersects, LocRayL, LocSCx, LocSCy}, LocRayL = 1.; 
                    LocSCx = 1.; LocSCy = 1.; surfaceapprox = 
                     {{-1., 0., 0.}}; tempapprox = {{-1., 0., 0.}}; 
                    intersects = {{-1., 0., 0.}}; surfaceapprox = 
                     Block[{TempVar, TempVar1, TempVar2, TempVar3, 
                       LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                       TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                        {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                       LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                       TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                        -6.*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                        2*rx*-6.; TempVar3 = Re[TempVar3]; If[
                        N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[6. + rx + LocRayL*
                        xunit - Sqrt[36. - LocSCx^2 - LocSCy^2]] < 
                        1.*^-7, {LocRayL, LocSCx, LocSCy}, {-1., 0., 
                        0.}], {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Abs[ry + LocRayL*yunit - 
                        LocSCx] + Abs[rz + LocRayL*zunit - LocSCy] + 
                        Abs[6. + rx + LocRayL*xunit - Sqrt[36. - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                        {{-1., 0., 0.}}]]; tempapprox = Union[Join[
                       (Take[#1, 3] & ) /@ surfaceapprox, {{-1., 0., 
                        0.}}]]; If[Length[Select[tempapprox, 
                        Chop[First[#1]] <= 0 & ]] != Length[tempapprox], 
                     surfaceapprox = Select[tempapprox, 
                       Chop[First[#1]] > 0 & ], surfaceapprox = 
                      {{-1., 0., 0.}}]; If[surfaceapprox != {{-1., 0., 
                        0.}}, intersects = {{-1., 0., 0.}}; Scan[
                       (AppendTo[intersects, {LocRayL, LocSCx, LocSCy} = 
                        {#1[[1]], #1[[2]], #1[[3]]}; If[Plus @@ Abs[
                        {rx + LocRayL*xunit, ry + LocRayL*yunit, rz + 
                        LocRayL*zunit} - {(-0.16666666666666666*(LocSCx^
                        2 + LocSCy^2))/(1 + Sqrt[Plus[1]]), LocSCx, 
                        LocSCy}] < 1.*^-9, {LocRayL, LocSCx, LocSCy}, 
                        LocRayL = 0.99*LocRayL; Function[{rx, ry, rz, 
                        xunit, yunit, zunit, startpoint}, Block[{values, 
                        stepsizes, fvector, success, steps, 
                        denominator}, values = {1.}; stepsizes = {1.}; 
                        fvector = {1.}; success = False; steps = 0; 
                        denominator = 1.; stepsizes = Table[
                        1.0000000000000001*^-7, {3}]; values = 
                        startpoint; While[steps < 50 && (success = True; 
                        (If[Abs[#1] > 1.*^-9, success = False; 1., 
                        1.] & ) /@ stepsizes;  !success), steps = 
                        steps + 1; fvector = {rx + xunit*values[[1]], 
                        ry + yunit*values[[1]], rz + zunit*values[[
                        1]]} - {(-0.16666666666666666*(values[[2]]^2 + 
                        values[[3]]^2))/(1 + Sqrt[Plus[1]]), values[[
                        2]], values[[3]]}; denominator = xunit - yunit*
                        ((Plus[(0.3333333333333333*values[[2]])/(1 + 
                        Sqrt[Plus[1]])])*-1) - zunit*((Plus[
                        (0.3333333333333333*values[[3]])/(1 + Sqrt[Plus[
                        1]])])*-1); If[Chop[denominator] != 0, 
                        denominator, denominator = 1.]; stepsizes = 
                        -(#1 . fvector & ) /@ ({{1, -((Plus[
                        (0.3333333333333333*values[[2]])/(1 + Sqrt[Plus[
                        1]])])*-1), -((Plus[(0.3333333333333333*values[[
                        3]])/(1 + Sqrt[Plus[1]])])*-1)}, {yunit, 
                        -xunit - (Plus[(0.3333333333333333*values[[3]])/
                        (1 + Sqrt[Plus[1]])])*zunit, (Plus[
                        (0.3333333333333333*values[[3]])/(1 + Sqrt[Plus[
                        1]])])*yunit}, {zunit, (Plus[(0.3333333333333333*
                        values[[2]])/(1 + Sqrt[Plus[1]])])*zunit, 
                        -xunit - (Plus[(0.3333333333333333*values[[2]])/
                        (1 + Sqrt[Plus[1]])])*yunit}}/denominator); 
                        values = values + stepsizes]; If[steps >= 50, 
                        If[First[values] > 0, values = -values; 1., 1.]; 
                        denominator = 1., 1.]; values]][rx, ry, rz, 
                        xunit, yunit, zunit, {LocRayL, LocSCx, 
                        LocSCy}]]]; {-1., 0., 0.}) & , surfaceapprox]; 
                      Union[Re[Select[intersects, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Plus @@ Abs[{rx + LocRayL*
                        xunit, ry + LocRayL*yunit, rz + LocRayL*zunit} - 
                        {(-0.16666666666666666*(LocSCx^2 + LocSCy^2))/
                        (1 + Sqrt[Plus[1]]), LocSCx, LocSCy}] < 
                        1.*^-9)) & ]]], {{-1., 0., 0.}}]]; AppendTo[
                  intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100994.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 8., 
                     100994.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 8., 100994.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = 4. + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., Plus[(0.3333333333333333*ray2)/(1. + 
                        Sqrt[Plus[1.]])], Plus[(0.3333333333333333*ray3)/
                        (1. + Sqrt[Plus[1.]])]}, {Plus[
                        (-0.3333333333333333*ray2)/(1. + Sqrt[Plus[
                        1.]])], 1., 0.}, {Plus[(-0.3333333333333333*
                        ray3)/(1. + Sqrt[Plus[1.]])], 0., 1.}}]; 
                    If[surfnorm[[1]] == {0., 0., 0.} || surfnorm[[2]] == 
                       {0., 0., 0.} || surfnorm[[3]] == {0., 0., 0.}, 
                     surfnorm = 1.*Re[{{1., Plus[(0.3333333333333333*
                        (1.*^-6 + ray2))/(1. + Sqrt[Plus[1.]])], Plus[
                        (0.3333333333333333*(1.*^-6 + ray3))/(1. + 
                        Sqrt[Plus[1.]])]}, {Plus[(-0.3333333333333333*
                        (1.*^-6 + ray2))/(1. + Sqrt[Plus[1.]])], 1., 
                        0.}, {Plus[(-0.3333333333333333*(1.*^-6 + ray3))/
                        (1. + Sqrt[Plus[1.]])], 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {4., 0, 
                      0}; activeregion = 1.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; ZAxis = 
                     First[surfnorm]*Sign[First[surfnorm] . {r1, r2, 
                        r3}]; raytiltz = ZAxis . {r1, r2, r3}; 
                    raytiltx = 1 - raytiltz^2; If[raytiltx < 
                      2.220446049250313*^-16, raytiltx = 0., raytiltx = 
                      Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - ZAxis*
                       raytiltz; If[Abs[raytiltx] < 1.*^-7, XAxis = 
                      surfnorm[[2]], XAxis = XAxis/raytiltx]; YAxis = 
                     {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*XAxis[[3]], 
                      ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*XAxis[[3]], 
                      -(ZAxis[[2]]*XAxis[[1]]) + ZAxis[[1]]*XAxis[[2]]}; 
                    YAxis = YAxis/Sqrt[YAxis . YAxis]; PAxis = 
                     ZAxis*{r1, r2, r3} . XAxis - XAxis*{r1, r2, r3} . 
                        ZAxis; PAxis = PAxis/Sqrt[PAxis . PAxis]; 
                    normalizedpolarization = {pol1, pol2, pol3}[[
                      {1, 2}]]; normalizedpolarization = 
                     normalizedpolarization/Sqrt[
                       normalizedpolarization . normalizedpolarization]; 
                    allcreatedamplitudes = {{I*0., I*0., I*0.}}; 
                    amplitude = Sqrt[intensity]*(normalizedpolarization[[
                        1]]*{r4, r5, r6} + normalizedpolarization[[2]]*
                        {r7, r8, r9}*Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.499266407978439 - 
                        0.7232199521991957*wavelength + 
                        1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3], index2 = 
                       1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.499266407978439 - 0.7232199521991957*
                        wavelength + 1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.499266407978439 - 0.7232199521991957*
                        wavelength + 1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = rex; ry = 
                rey; rz = rez; rx = Chop[rx]; ry = Chop[ry]; rz = 
                Chop[rz]; terminatedeflection = False; intersections = 
                {{-1., 0., 0.}}); If[intensity > thresholdintensity, 
               deflectedrayspresent = True; (intersections = 
                  Block[{surfaceapprox, tempapprox, intersects, LocRayL, 
                    LocSCx, LocSCy}, LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; surfaceapprox = {{-1., 0., 0.}}; 
                    tempapprox = {{-1., 0., 0.}}; intersects = 
                     {{-1., 0., 0.}}; surfaceapprox = Block[{TempVar, 
                       TempVar1, TempVar2, TempVar3, LocRayL, LocSCx, 
                       LocSCy}, TempVar1 = 1.; TempVar2 = 1.; TempVar3 = 
                        1.; TempVar = {{-1., 0., 0.}}; LocRayL = 1.; 
                       LocSCx = 1.; LocSCy = 1.; TempVar1 = rx^2 + 
                        ry^2 + rz^2; TempVar2 = rx*xunit + ry*yunit + 
                        rz*zunit - 10.2*xunit; TempVar3 = -TempVar1 + 
                        TempVar2^2 + 2*rx*10.2; TempVar3 = Re[TempVar3]; 
                       If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[-10.2 + rx + 
                        LocRayL*xunit + Sqrt[104.03999999999999 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}], {LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 + TempVar3, ry + 
                        (-TempVar2 + TempVar3)*yunit, rz + (-TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[-10.2 + rx + 
                        LocRayL*xunit + Sqrt[104.03999999999999 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                        {{-1., 0., 0.}}]]; tempapprox = Union[Join[
                       (Take[#1, 3] & ) /@ surfaceapprox, {{-1., 0., 
                        0.}}]]; If[Length[Select[tempapprox, 
                        Chop[First[#1]] <= 0 & ]] != Length[tempapprox], 
                     surfaceapprox = Select[tempapprox, 
                       Chop[First[#1]] > 0 & ], surfaceapprox = 
                      {{-1., 0., 0.}}]; If[surfaceapprox != {{-1., 0., 
                        0.}}, intersects = {{-1., 0., 0.}}; Scan[
                       (AppendTo[intersects, {LocRayL, LocSCx, LocSCy} = 
                        {#1[[1]], #1[[2]], #1[[3]]}; If[Plus @@ Abs[
                        {rx + LocRayL*xunit, ry + LocRayL*yunit, rz + 
                        LocRayL*zunit} - {(0.09803921568627452*(LocSCx^
                        2 + LocSCy^2))/(1 + Sqrt[1 + 
                        0.020488273740868906*(LocSCx^2 + LocSCy^2)]), 
                        LocSCx, LocSCy}] < 1.*^-9, {LocRayL, LocSCx, 
                        LocSCy}, LocRayL = 0.99*LocRayL; Function[{rx, 
                        ry, rz, xunit, yunit, zunit, startpoint}, Block[
                        {values, stepsizes, fvector, success, steps, 
                        denominator}, values = {1.}; stepsizes = {1.}; 
                        fvector = {1.}; success = False; steps = 0; 
                        denominator = 1.; stepsizes = Table[
                        1.0000000000000001*^-7, {3}]; values = 
                        startpoint; While[steps < 50 && (success = True; 
                        (If[Abs[#1] > 1.*^-9, success = False; 1., 
                        1.] & ) /@ stepsizes;  !success), steps = 
                        steps + 1; fvector = {rx + xunit*values[[1]], 
                        ry + yunit*values[[1]], rz + zunit*values[[
                        1]]} - {(0.09803921568627452*(values[[2]]^2 + 
                        values[[3]]^2))/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]), values[[2]], values[[3]]}; 
                        denominator = xunit - yunit*((
                        (0.002008654288320481*values[[2]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1) - zunit*(((0.002008654288320481*
                        values[[3]]*(values[[2]]^2 + values[[3]]^2))/
                        (Sqrt[1 + 0.020488273740868906*(values[[2]]^2 + 
                        values[[3]]^2)]*(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)])^2) - (0.19607843137254904*values[[3]])/
                        (1 + Sqrt[1 + 0.020488273740868906*(values[[2]]^
                        2 + values[[3]]^2)]))*-1); If[Chop[
                        denominator] != 0, denominator, denominator = 
                        1.]; stepsizes = -(#1 . fvector & ) /@ ({{1, 
                        -(((0.002008654288320481*values[[2]]*(values[[
                        2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1), -(((0.002008654288320481*values[[
                        3]]*(values[[2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1)}, {yunit, -xunit - 
                        ((0.002008654288320481*values[[3]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*zunit, ((0.002008654288320481*values[[
                        3]]*(values[[2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*yunit}, {zunit, ((0.002008654288320481*
                        values[[2]]*(values[[2]]^2 + values[[3]]^2))/
                        (Sqrt[1 + 0.020488273740868906*(values[[2]]^2 + 
                        values[[3]]^2)]*(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)])^2) - (0.19607843137254904*values[[2]])/
                        (1 + Sqrt[1 + 0.020488273740868906*(values[[2]]^
                        2 + values[[3]]^2)]))*zunit, -xunit - 
                        ((0.002008654288320481*values[[2]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*yunit}}/denominator); values = 
                        values + stepsizes]; If[steps >= 50, If[First[
                        values] > 0, values = -values; 1., 1.]; 
                        denominator = 1., 1.]; values]][rx, ry, rz, 
                        xunit, yunit, zunit, {LocRayL, LocSCx, 
                        LocSCy}]]]; {-1., 0., 0.}) & , surfaceapprox]; 
                      Union[Re[Select[intersects, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Plus @@ Abs[{rx + LocRayL*
                        xunit, ry + LocRayL*yunit, rz + LocRayL*zunit} - 
                        {(0.09803921568627452*(LocSCx^2 + LocSCy^2))/
                        (1 + Sqrt[1 + 0.020488273740868906*(LocSCx^2 + 
                        LocSCy^2)]), LocSCx, LocSCy}] < 1.*^-9)) & ]]], 
                     {{-1., 0., 0.}}]]; AppendTo[intersections, 
                  {-1., 0., 0.}]; holeQ = False; If[
                   !(Chop[surfaceid - 100995.] == 0. || N[Chop[ray1]] < 
                      0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 9., 
                     100995.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 9., 100995.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = rxhlp; rey = ryhlp; rez = rzhlp; rex = 
                    Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., (0.002008654288320481*ray2^3)/
                        (Sqrt[1. + 0.020488273740868906*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])^2) + (0.002008654288320481*
                        ray2*ray3^2)/(Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)])^2) - 
                        (0.19607843137254904*ray2)/(1. + Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]), 
                        (0.002008654288320481*ray2^2*ray3)/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.002008654288320481*ray3^3)/
                        (Sqrt[1. + 0.020488273740868906*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])^2) - (0.19607843137254904*
                        ray3)/(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])}, {(-0.002008654288320481*
                        ray2*(ray2^2 + ray3^2))/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.19607843137254904*ray2)/
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)]), 1., 0.}, {(-0.002008654288320481*ray3*
                        (ray2^2 + ray3^2))/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.19607843137254904*ray3)/
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)]), 0., 1.}}]; If[surfnorm[[1]] == 
                       {0., 0., 0.} || surfnorm[[2]] == {0., 0., 0.} || 
                      surfnorm[[3]] == {0., 0., 0.}, surfnorm = 
                       1.*Re[{{1., (0.002008654288320481*(1.*^-6 + ray2)^
                        3)/(Sqrt[1. + 0.020488273740868906*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.002008654288320481*
                        (1.*^-6 + ray2)*(1.*^-6 + ray3)^2)/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.19607843137254904*
                        (1.*^-6 + ray2))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), (0.002008654288320481*
                        (1.*^-6 + ray2)^2*(1.*^-6 + ray3))/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.002008654288320481*
                        (1.*^-6 + ray3)^3)/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.19607843137254904*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])}, {(-0.002008654288320481*
                        (1.*^-6 + ray2)*((1.*^-6 + ray2)^2 + (1.*^-6 + 
                        ray3)^2))/(Sqrt[1. + 0.020488273740868906*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) + 
                        (0.19607843137254904*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. + 0.020488273740868906*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 1., 0.}, 
                        {(-0.002008654288320481*(1.*^-6 + ray3)*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2))/
                        (Sqrt[1. + 0.020488273740868906*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.19607843137254904*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1, 0, 0}, {0, 1, 0}, 
                      {0, 0, 1}}; surfacetranslationvector = {0, 0, 0}; 
                    activeregion = 1.; completedray = {rsx, rsy, rsz, 
                      rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.6765916828635454 - 
                        1.1701284013462314*wavelength + 
                        1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3], index2 = 
                       1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                0.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = If[Chop[xunit] != 0, 
                   {(If[N[Chop[#1[[1]]]] >= 0. && #1[[2]]^2 + #1[[3]]^
                        2 <= 6.25, {#1[[1]], #1[[2]], #1[[3]]}, 
                       {-1., 0., 0.}] & )[{-(rx/xunit), ry - (rx*yunit)/
                        xunit, rz - (rx*zunit)/xunit}]}, {{-1., 0., 
                     0.}}]; AppendTo[intersections, {-1., 0., 0.}]; 
                 holeQ = False; If[ !(Chop[surfaceid - 100996.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 10., 
                     100996.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 10., 100996.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -0.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {-0.05, 0, 
                      0}; activeregion = 0.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; 
                    allcreatedrays = {{rsx, rsy, rsz, rex, rey, rez, r1, 
                       r2, r3, r4, r5, r6, r7, r8, r9, wavelength, 
                       intensity, intensityscale, ray1, index, 
                       opticallength, phaseshift, componentnumber, 
                       surfacenumber, surfaceid, ray2, ray3, sid, 
                       frontid, sno1, sno2, sno3, sno4, rayslot, 
                       generationnumber, intersectionnumber, pol1, pol2, 
                       pol3}})); {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                0.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = If[Chop[xunit] != 0, 
                   {(If[N[Chop[#1[[1]]]] >= 0. && #1[[2]]^2 + #1[[3]]^
                        2 <= 25., {#1[[1]], #1[[2]], #1[[3]]}, {-1., 0., 
                        0.}] & )[{-(rx/xunit), ry - (rx*yunit)/xunit, 
                      rz - (rx*zunit)/xunit}]}, {{-1., 0., 0.}}]; 
                 AppendTo[intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100997.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]; intersections = 
                  Union[(If[#1[[2]]^2 + #1[[3]]^2 <= 6.25, holeQ = True; 
                       {-1., 0., 0.}, #1] & ) /@ 
                    unfilteredintersections]; If[Length[intersections] > 
                   1, dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 11., 
                     100997.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 11., 100997.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -0.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {-0.05, 0, 
                      0}; activeregion = 0.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; intensity = 
                     0.; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}})); {First[allcreatedrays], 
                   completedray}, reporteddummyrayspresent = True; 
                  {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                    r6, r7, r8, r9, wavelength, intensity, 
                    intensityscale, ray1, index, opticallength, 
                    phaseshift, componentnumber, surfacenumber, 
                    surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                    sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                3.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{TempVar, TempVar1, TempVar2, 
                    TempVar3, LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                    TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                     {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                    TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                      6.5*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                      2*rx*6.5; TempVar3 = Re[TempVar3]; 
                    If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 25. && Abs[ry + LocRayL*
                        yunit - LocSCx] + Abs[rz + LocRayL*zunit - 
                        LocSCy] + Abs[-6.5 + rx + LocRayL*xunit + Sqrt[
                        42.25 - LocSCx^2 - LocSCy^2]] < 1.*^-7, 
                        {LocRayL, LocSCx, LocSCy}, {-1., 0., 0.}], 
                        {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        25. && Abs[ry + LocRayL*yunit - LocSCx] + 
                        Abs[rz + LocRayL*zunit - LocSCy] + Abs[-6.5 + 
                        rx + LocRayL*xunit + Sqrt[42.25 - LocSCx^2 - 
                        LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, LocSCy}, 
                        {-1., 0., 0.}]}; If[TempVar[[1]] == TempVar[[
                        2]], {TempVar[[1]]}, TempVar], {{-1., 0., 
                       0.}}]]; AppendTo[intersections, {-1., 0., 0.}]; 
                 holeQ = False; If[ !(Chop[surfaceid - 100998.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 12., 
                     100998.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 12., 100998.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -3.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., -(ray2/(42.25 - ray2^2 - ray3^2)^
                        2^(-1)), -(ray3/(42.25 - ray2^2 - ray3^2)^
                        2^(-1))}, {ray2/(42.25 - ray2^2 - ray3^2)^
                        2^(-1), 1., 0.}, {ray3/(42.25 - ray2^2 - ray3^2)^
                        2^(-1), 0., 1.}}]; dummymatrix = (#1 & ) /@ 
                      surfnorm; surfnorm = (#1/Sqrt[#1 . #1] & ) /@ 
                      dummymatrix; surfacerotationmatrix = {{1., 0, 0}, 
                      {0, 1., 0}, {0, 0, 1.}}; 
                    surfacetranslationvector = {-3.05, 0, 0}; 
                    activeregion = 1.; completedray = {rsx, rsy, rsz, 
                      rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.5532682085807892 - 
                        1.0054245500487249*wavelength + 
                        1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3], index2 = 
                       1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                3.5999999999999996 + rex; ry = rey; rz = rez; rx = 
                Chop[rx]; ry = Chop[ry]; rz = Chop[rz]; 
               terminatedeflection = False; intersections = 
                {{-1., 0., 0.}}); If[intensity > thresholdintensity, 
               deflectedrayspresent = True; (intersections = 
                  Block[{LocRayL, LocSCx, LocSCy}, LocRayL = 1. + I*0.; 
                    LocSCx = 1. + I*0.; LocSCy = 1. + I*0.; 
                    Re[Select[{{-1. + 0.*I, 0. + 0.*I, 0. + 0.*I}, 
                       {(386.*xunit - 37.*rx*xunit - 50.*ry*yunit - 
                        50.*rz*zunit - 1.4142135623730951*Sqrt[
                        74498.*xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*
                        xunit^2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*
                        xunit*yunit + 19300.*rx*yunit^2 - 925.*rx^2*
                        yunit^2 - 1250.*rz^2*yunit^2 - 19300.*rz*xunit*
                        zunit + 1850.*rx*rz*xunit*zunit + 2500.*ry*rz*
                        yunit*zunit + 19300.*rx*zunit^2 - 925.*rx^2*
                        zunit^2 - 1250.*ry^2*zunit^2])/(37.*xunit^2 + 
                        50.*yunit^2 + 50.*zunit^2), (37.*ry*xunit^2 + 
                        386.*xunit*yunit - 37.*rx*xunit*yunit - 50.*rz*
                        yunit*zunit + 50.*ry*zunit^2 - 
                        1.4142135623730951*yunit*Sqrt[74498.*xunit^2 - 
                        925.*ry^2*xunit^2 - 925.*rz^2*xunit^2 - 19300.*
                        ry*xunit*yunit + 1850.*rx*ry*xunit*yunit + 
                        19300.*rx*yunit^2 - 925.*rx^2*yunit^2 - 1250.*
                        rz^2*yunit^2 - 19300.*rz*xunit*zunit + 1850.*rx*
                        rz*xunit*zunit + 2500.*ry*rz*yunit*zunit + 
                        19300.*rx*zunit^2 - 925.*rx^2*zunit^2 - 1250.*
                        ry^2*zunit^2])/(37.*xunit^2 + 50.*yunit^2 + 
                        50.*zunit^2), (37.*rz*xunit^2 + 50.*rz*yunit^2 + 
                        386.*xunit*zunit - 37.*rx*xunit*zunit - 50.*ry*
                        yunit*zunit - 1.4142135623730951*zunit*Sqrt[
                        74498.*xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*
                        xunit^2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*
                        xunit*yunit + 19300.*rx*yunit^2 - 925.*rx^2*
                        yunit^2 - 1250.*rz^2*yunit^2 - 19300.*rz*xunit*
                        zunit + 1850.*rx*rz*xunit*zunit + 2500.*ry*rz*
                        yunit*zunit + 19300.*rx*zunit^2 - 925.*rx^2*
                        zunit^2 - 1250.*ry^2*zunit^2])/(37.*xunit^2 + 
                        50.*yunit^2 + 50.*zunit^2)}, {(386.*xunit - 
                        37.*rx*xunit - 50.*ry*yunit - 50.*rz*zunit + 
                        1.4142135623730951*Sqrt[74498.*xunit^2 - 925.*
                        ry^2*xunit^2 - 925.*rz^2*xunit^2 - 19300.*ry*
                        xunit*yunit + 1850.*rx*ry*xunit*yunit + 19300.*
                        rx*yunit^2 - 925.*rx^2*yunit^2 - 1250.*rz^2*
                        yunit^2 - 19300.*rz*xunit*zunit + 1850.*rx*rz*
                        xunit*zunit + 2500.*ry*rz*yunit*zunit + 19300.*
                        rx*zunit^2 - 925.*rx^2*zunit^2 - 1250.*ry^2*
                        zunit^2])/(37.*xunit^2 + 50.*yunit^2 + 50.*
                        zunit^2), (37.*ry*xunit^2 + 386.*xunit*yunit - 
                        37.*rx*xunit*yunit - 50.*rz*yunit*zunit + 
                        50.*ry*zunit^2 + 1.4142135623730951*yunit*
                        Sqrt[74498.*xunit^2 - 925.*ry^2*xunit^2 - 
                        925.*rz^2*xunit^2 - 19300.*ry*xunit*yunit + 
                        1850.*rx*ry*xunit*yunit + 19300.*rx*yunit^2 - 
                        925.*rx^2*yunit^2 - 1250.*rz^2*yunit^2 - 19300.*
                        rz*xunit*zunit + 1850.*rx*rz*xunit*zunit + 
                        2500.*ry*rz*yunit*zunit + 19300.*rx*zunit^2 - 
                        925.*rx^2*zunit^2 - 1250.*ry^2*zunit^2])/
                        (37.*xunit^2 + 50.*yunit^2 + 50.*zunit^2), 
                        (37.*rz*xunit^2 + 50.*rz*yunit^2 + 386.*xunit*
                        zunit - 37.*rx*xunit*zunit - 50.*ry*yunit*
                        zunit + 1.4142135623730951*zunit*Sqrt[74498.*
                        xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*xunit^
                        2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*xunit*
                        yunit + 19300.*rx*yunit^2 - 925.*rx^2*yunit^2 - 
                        1250.*rz^2*yunit^2 - 19300.*rz*xunit*zunit + 
                        1850.*rx*rz*xunit*zunit + 2500.*ry*rz*yunit*
                        zunit + 19300.*rx*zunit^2 - 925.*rx^2*zunit^2 - 
                        1250.*ry^2*zunit^2])/(37.*xunit^2 + 50.*yunit^
                        2 + 50.*zunit^2)}}, ({LocRayL, LocSCx, LocSCy} = 
                        #1; {LocRayL, LocSCx, LocSCy} == {-1., 0., 
                        0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[Re[LocRayL]]] >= 0. && Abs[ry + LocRayL*
                        yunit - LocSCx] + Abs[rz + LocRayL*zunit - 
                        LocSCy] + Abs[rx + LocRayL*xunit - (25*(LocSCx^
                        2 + LocSCy^2))/(193*(1 + Sqrt[1 - (925*(LocSCx^
                        2 + LocSCy^2))/74498]))] < 1.*^-7 && 
                        Re[LocSCx]^2 + Re[LocSCy]^2 <= 39.0625)) & ]]]; 
                 AppendTo[intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100999.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 13., 
                     100999.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 13., 100999.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -3.5999999999999996 + rxhlp; rey = ryhlp; 
                   rez = rzhlp; rex = Chop[rex]; rey = Chop[rey]; 
                   rez = Chop[rez]; intersectionnumber = 
                    intersectionnumber + 1.; opticallength = 
                    opticallength + ray1*index1; completedray = 
                    {rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                     r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., (-0.0016083472422043674*ray2^3)/
                        (Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])^2) - (0.0016083472422043674*
                        ray2*ray3^2)/(Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)])^2) - 
                        (0.2590673575129534*ray2)/(1. + Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]), 
                        (-0.0016083472422043674*ray2^2*ray3)/(Sqrt[
                        1. - 0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) - (0.0016083472422043674*ray3^3)/
                        (Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])^2) - (0.2590673575129534*
                        ray3)/(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])}, {(0.0016083472422043674*
                        ray2*(ray2^2 + ray3^2))/(Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) + (0.2590673575129534*ray2)/(1. + 
                        Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]), 1., 0.}, {(0.0016083472422043674*ray3*
                        (ray2^2 + ray3^2))/(Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) + (0.2590673575129534*ray3)/(1. + 
                        Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]), 0., 1.}}]; If[surfnorm[[1]] == {0., 0., 
                        0.} || surfnorm[[2]] == {0., 0., 0.} || 
                      surfnorm[[3]] == {0., 0., 0.}, surfnorm = 
                       1.*Re[{{1., (-0.0016083472422043674*(1.*^-6 + 
                        ray2)^3)/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.0016083472422043674*(1.*^-6 + ray2)*(1.*^-6 + 
                        ray3)^2)/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.2590673575129534*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 
                        (-0.0016083472422043674*(1.*^-6 + ray2)^2*
                        (1.*^-6 + ray3))/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.0016083472422043674*(1.*^-6 + ray3)^3)/
                        (Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.2590673575129534*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])}, {(0.0016083472422043674*
                        (1.*^-6 + ray2)*((1.*^-6 + ray2)^2 + (1.*^-6 + 
                        ray3)^2))/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) + 
                        (0.2590673575129534*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 1., 0.}, 
                        {(0.0016083472422043674*(1.*^-6 + ray3)*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2))/
                        (Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.2590673575129534*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = 
                     {-3.5999999999999996, 0, 0}; activeregion = 1.; 
                    completedray = {rsx, rsy, rsz, rex, rey, rez, r1, 
                      r2, r3, r4, r5, r6, r7, r8, r9, wavelength, 
                      intensity, intensityscale, ray1, index, 
                      opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.5392664079781753 - 
                        0.7232199521975703*wavelength + 
                        1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        Sqrt[1.0005281111748805 - 2.364805676582992*^-10*
                        wavelength^2 + 2.9781670902982902*^-6/wavelength^
                        2 + 2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]; 
                        If[Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = Sqrt[1.0005281111748805 - 
                        2.364805676582992*^-10*wavelength^2 + 
                        2.9781670902982902*^-6/wavelength^2 + 
                        2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]], 
                     index2 = Sqrt[1.0005281111748805 - 
                        2.364805676582992*^-10*wavelength^2 + 
                        2.9781670902982902*^-6/wavelength^2 + 
                        2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]; index1 = 
                       index; If[Abs[index2 - index1] < 0.01, 
                       alternateindex = 1.5392664079781753 - 
                        0.7232199521975703*wavelength + 
                        1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       If[Length[reportedrays] > 2, reportedrays = Drop[reportedrays, 
          2], reportedrays]; ({#1[[1]], #1[[2]], #1[[3]], #1[[4]], 
          #1[[5]], #1[[6]]} & ) /@ reportedrays]]; 
   raytracefunction21864020083128460953516 = 
    Compile[{{th, _Real}, {x, _Real}, {y, _Real}}, 
     Module[{activeregion, allcreatedamplitudes, allcreatedrays, 
       allowzeroraylength, alternateindex, amplitude, axismagnitude, 
       axismatrix, clonedata, clonegenerationnumber, cloneinput, 
       clonenumber, cloneposition, clonereportedrays, clonerotation, 
       clonescale, clonescalevector, clonesorthistogram, 
       clonetraceinput, clonetraceoutput, closestdistances, 
       closestposition, closestpositions, closestraylength, 
       completedray, componentnumber, cosangle, crossmatrix, 
       deflecteddummyrayspresent, deflectedlocalrays, deflectedrays, 
       deflectedrayspresent, dummymatrix, dummymatrixlist, dummyvector, 
       frontid, generationlimit, generationnumber, holeintersections, 
       holeQ, holeQlist, hor, index, index1, index2, inrays, intensity, 
       intensityscale, intersectionnumber, intersections, 
       intersectionslist, intersectionspresent, 
       localdummyoutrayspresent, localoutrays, localoutrayspresent, 
       magnitude, maxclonegenerationnumber, maximumposition, 
       minimumraylength, minresonateraylength, n12, newcomponentnumber, 
       newdeflectedrays, newdistance, newsurfaceid, newsurfacenumber, 
       nonintersectingrays, normalizedpolarization, oldgenerationnumber, 
       opticallength, originalray, originalraytilt, originalrotation, 
       originalsurfnorm, outrays, parallelamplitude, PAxis, 
       perpendicularamplitude, phaseshift, pol1, pol2, pol3, 
       previoustilt, propagate, propagatedrays, r1, r2, r3, r4, r5, r6, 
       r7, r8, r9, ray1, ray2, ray3, LocRayL, rayslot, raysreported, 
       raytiltx, raytiltz, reporteddummyrayspresent, reportedlocalrays, 
       reportedrays, reportedrayspresent, resonateintersections, 
       resonatenumber, resonateraylength, rex, rey, rez, rotationaxis, 
       rsx, LocRSx, rsy, LocRSy, rsz, LocRSz, RTx, LocRTy, LocRTz, rx, 
       rxhlp, ry, ryhlp, rz, rzhlp, LocSCx, LocSCy, sid, sinangle, sno1, 
       sno2, sno3, sno4, surfaceid, surfacenumber, 
       surfacerotationmatrix, surfacetranslationvector, surfnorm, symr1, 
       symr2, symr3, symr4, symr5, symr6, symr7, symr8, symr9, 
       tempclonedata, terminatedeflection, thresholdintensity, 
       tiltmagnitude, transmatrix, LocTV1, LocTV10, LocTV2, LocTV3, 
       LocTV4, LocTV5, LocTV6, LocTV7, LocTV8, LocTV9, u, 
       unfilteredintersections, unit, uu, ver, wavelength, XAxis, xunit, 
       YAxis, yunit, ZAxis, zunit}, activeregion = 1.; 
       allcreatedamplitudes = {{0. + 0.*I, 0. + 0.*I, 0. + 0.*I}}; 
       allcreatedrays = {{1.}}; allowzeroraylength = True; 
       alternateindex = 1.; amplitude = {1. + 0.*I, 0. + 0.*I, 
         0. + 0.*I}; axismagnitude = 1.; axismatrix = 
        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; clonedata = {{1.}}; 
       clonegenerationnumber = 1.; cloneinput = {1.}; clonenumber = 1; 
       cloneposition = {0., 0., 0.}; clonereportedrays = {{1.}}; 
       clonerotation = {{1.}}; clonescale = 1.; clonescalevector = {1.}; 
       clonesorthistogram = {1}; clonetraceinput = {{1.}}; 
       clonetraceoutput = {{1.}}; closestdistances = {1.}; 
       closestposition = 0; closestpositions = {0}; 
       closestraylength = 1.; completedray = {1.}; 
       componentnumber = -1.; cosangle = 1.; crossmatrix = 
        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; 
       deflecteddummyrayspresent = False; deflectedlocalrays = {{1.}}; 
       deflectedrays = {{1.}}; deflectedrayspresent = False; 
       dummymatrix = {{1.}}; dummymatrixlist = {{{1.}}}; 
       dummyvector = {1.}; frontid = 1.; generationlimit = 200.; 
       generationnumber = 1.; holeintersections = {{-1., 0., 0.}}; 
       holeQ = False; holeQlist = {0}; hor = 1. + 0.*I; index = 1.; 
       index1 = 1.; index2 = 1.; inrays = {{1.}}; intensity = 1.; 
       intensityscale = 1.; intersectionnumber = 1.; 
       intersections = {{-1., 0., 0.}}; intersectionslist = 
        {{{-1., 0., 0.}}}; intersectionspresent = False; 
       localdummyoutrayspresent = False; localoutrays = {{1.}}; 
       localoutrayspresent = False; magnitude = 1.; 
       maxclonegenerationnumber = 1.; maximumposition = 1; 
       minimumraylength = 0.0001; minresonateraylength = 1.; n12 = 1.; 
       newcomponentnumber = -1.; newdeflectedrays = {{1.}}; 
       newdistance = 1.; newsurfaceid = -1.; newsurfacenumber = -1.; 
       nonintersectingrays = {{1.}}; normalizedpolarization = {1., 1.}; 
       oldgenerationnumber = 1.; opticallength = 1.; originalray = {1.}; 
       originalraytilt = {1.}; originalrotation = {{1., 0., 0.}, 
         {0., 1., 0.}, {0., 0., 1.}}; originalsurfnorm = {{1.}}; 
       outrays = {{1.}}; parallelamplitude = 1. + 0.*I; 
       PAxis = {1., 0., 0.}; perpendicularamplitude = 1. + 0.*I; 
       phaseshift = 0.; pol1 = 1.; pol2 = 1.; pol3 = 1.; 
       previoustilt = {1., 0., 0.}; propagate = True; 
       propagatedrays = {{1.}}; r1 = 1.; r2 = 1.; r3 = 1.; r4 = 1.; 
       r5 = 1.; r6 = 1.; r7 = 1.; r8 = 1.; r9 = 1.; ray1 = 1.; 
       ray2 = 1.; ray3 = 1.; LocRayL = 1.; rayslot = 1.; 
       raysreported = False; raytiltx = 1.; raytiltz = 1.; 
       reporteddummyrayspresent = False; reportedlocalrays = {{1.}}; 
       reportedrays = {{1.}}; reportedrayspresent = False; 
       resonateintersections = {{-1., 0., 0.}}; resonatenumber = 0; 
       resonateraylength = 1.; rex = 1.; rey = 1.; rez = 1.; rsx = 1.; 
       LocRSx = 1.; rsy = 1.; LocRSy = 1.; rsz = 1.; LocRSz = 1.; 
       RTx = 1.; LocRTy = 1.; LocRTz = 1.; rx = 1.; rxhlp = 1.; ry = 1.; 
       ryhlp = 1.; rz = 1.; rzhlp = 1.; LocSCx = 1.; LocSCy = 1.; 
       sid = 1.; sinangle = 1.; sno1 = 1.; sno2 = 1.; sno3 = 1.; 
       sno4 = 1.; surfaceid = -1.; surfacenumber = -1.; 
       surfacerotationmatrix = {{1., 0., 0.}, {0., 1., 0.}, 
         {0., 0., 1.}}; surfacetranslationvector = {0., 0., 0.}; 
       surfnorm = {{1.}}; symr1 = 1.; symr2 = 1.; symr3 = 1.; 
       symr4 = 1.; symr5 = 1.; symr6 = 1.; symr7 = 1.; symr8 = 1.; 
       symr9 = 1.; tempclonedata = {{1.}}; terminatedeflection = False; 
       thresholdintensity = 1.; tiltmagnitude = 1.; 
       transmatrix = {{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}}; 
       LocTV1 = 1.; LocTV10 = 1.; LocTV2 = 1.; LocTV3 = 1.; LocTV4 = 1.; 
       LocTV5 = 1.; LocTV6 = 1.; LocTV7 = 1.; LocTV8 = 1.; LocTV9 = 1.; 
       u = {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; 
       unfilteredintersections = {{-1., 0., 0.}}; 
       unit = {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; 
       uu = {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}; ver = 0. + 0.*I; 
       wavelength = 1.; XAxis = {1., 0., 0.}; xunit = 1.; 
       YAxis = {1., 0., 0.}; yunit = 1.; ZAxis = {1., 0., 0.}; 
       zunit = 1.; propagatedrays = 
        Join[{symr1, symr2, symr3, symr4, symr5, symr6, symr7, symr8, 
            symr9} = {Cos[Degree*th], Sin[Degree*th], 0, 
            -Sin[Degree*th], Cos[Degree*th], 0, 0, 0, 1}; 
          (({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
               r8, r9, wavelength, intensity, intensityscale, ray1, 
               index, opticallength, phaseshift, componentnumber, 
               surfacenumber, surfaceid, ray2, ray3, sid, frontid, sno1, 
               sno2, sno3, sno4, rayslot, oldgenerationnumber, 
               intersectionnumber, pol1, pol2, pol3} = #1; 
             {LocTV1, LocTV2, LocTV3} = {rsx*symr1 + rsy*symr4 + 
                rsz*symr7 + x, rsx*symr2 + rsy*symr5 + rsz*symr8 + y, 
               rsx*symr3 + rsy*symr6 + rsz*symr9}; {rsx, rsy, rsz} = 
              {LocTV1, LocTV2, LocTV3}; {LocTV1, LocTV2, LocTV3} = 
              {rex*symr1 + rey*symr4 + rez*symr7 + x, rex*symr2 + 
                rey*symr5 + rez*symr8 + y, rex*symr3 + rey*symr6 + 
                rez*symr9}; {rex, rey, rez} = {LocTV1, LocTV2, LocTV3}; 
             {LocTV1, LocTV2, LocTV3} = {r1*symr1 + r2*symr4 + r3*symr7, 
               r1*symr2 + r2*symr5 + r3*symr8, r1*symr3 + r2*symr6 + 
                r3*symr9}; {LocTV4, LocTV5, LocTV6} = {r4*symr1 + 
                r5*symr4 + r6*symr7, r4*symr2 + r5*symr5 + r6*symr8, 
               r4*symr3 + r5*symr6 + r6*symr9}; {LocTV7, LocTV8, 
               LocTV9} = {r7*symr1 + r8*symr4 + r9*symr7, r7*symr2 + 
                r8*symr5 + r9*symr8, r7*symr3 + r8*symr6 + r9*symr9}; 
             {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
              {{LocTV1, LocTV2, LocTV3}, {LocTV4, LocTV5, LocTV6}, {
                LocTV7, LocTV8, LocTV9}}; {rsx, rsy, rsz, rex, rey, rez, 
              r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
              intensityscale, ray1, index, opticallength, phaseshift, 
              componentnumber, surfacenumber, surfaceid, ray2, ray3, 
              sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
              generationnumber, intersectionnumber, pol1, pol2, 
              pol3}) & ) /@ {{0., -1.5, 0., 0., -1.5, 0., 1., 0., 0., 
             0., 1., 0., 0., 0., 1., 0.532, 100., 0.09090909090909091, 
             0., 1.00026945145708, 0., 0., 1., 0., 0., 0., 0., 100431., 
             100431., 1., 11., 1., 0., 1., 0., 0., 0., 1., 0.}, 
            {0., -1.2, 0., 0., -1.2, 0., 1., 0., 0., 0., 1., 0., 0., 0., 
             1., 0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 
             0., 0., 1., 0., 0., 0., 0., 100431., 100431., 2., 11., 2., 
             0., 1., 0., 0., 0., 1., 0.}, {0., -0.8999999999999999, 0., 
             0., -0.8999999999999999, 0., 1., 0., 0., 0., 1., 0., 0., 
             0., 1., 0.532, 100., 0.09090909090909091, 0., 
             1.00026945145708, 0., 0., 1., 0., 0., 0., 0., 100431., 
             100431., 3., 11., 3., 0., 1., 0., 0., 0., 1., 0.}, 
            {0., -0.5999999999999999, 0., 0., -0.5999999999999999, 0., 
             1., 0., 0., 0., 1., 0., 0., 0., 1., 0.532, 100., 
             0.09090909090909091, 0., 1.00026945145708, 0., 0., 1., 0., 
             0., 0., 0., 100431., 100431., 4., 11., 4., 0., 1., 0., 0., 
             0., 1., 0.}, {0., -0.2999999999999998, 0., 0., 
             -0.2999999999999998, 0., 1., 0., 0., 0., 1., 0., 0., 0., 
             1., 0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 
             0., 0., 1., 0., 0., 0., 0., 100431., 100431., 5., 11., 5., 
             0., 1., 0., 0., 0., 1., 0.}, {0., 2.220446049250313*^-16, 
             0., 0., 2.220446049250313*^-16, 0., 1., 0., 0., 0., 1., 0., 
             0., 0., 1., 0.532, 100., 0.09090909090909091, 0., 
             1.00026945145708, 0., 0., 1., 0., 0., 0., 0., 100431., 
             100431., 6., 11., 6., 0., 1., 0., 0., 0., 1., 0.}, 
            {0., 0.30000000000000027, 0., 0., 0.30000000000000027, 0., 
             1., 0., 0., 0., 1., 0., 0., 0., 1., 0.532, 100., 
             0.09090909090909091, 0., 1.00026945145708, 0., 0., 1., 0., 
             0., 0., 0., 100431., 100431., 7., 11., 7., 0., 1., 0., 0., 
             0., 1., 0.}, {0., 0.6000000000000005, 0., 0., 
             0.6000000000000005, 0., 1., 0., 0., 0., 1., 0., 0., 0., 1., 
             0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 0., 
             0., 1., 0., 0., 0., 0., 100431., 100431., 8., 11., 8., 0., 
             1., 0., 0., 0., 1., 0.}, {0., 0.9000000000000004, 0., 0., 
             0.9000000000000004, 0., 1., 0., 0., 0., 1., 0., 0., 0., 1., 
             0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 0., 
             0., 1., 0., 0., 0., 0., 100431., 100431., 9., 11., 9., 0., 
             1., 0., 0., 0., 1., 0.}, {0., 1.2000000000000002, 0., 0., 
             1.2000000000000002, 0., 1., 0., 0., 0., 1., 0., 0., 0., 1., 
             0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 0., 
             0., 1., 0., 0., 0., 0., 100431., 100431., 10., 11., 10., 
             0., 1., 0., 0., 0., 1., 0.}, {0., 1.5000000000000004, 0., 
             0., 1.5000000000000004, 0., 1., 0., 0., 0., 1., 0., 0., 0., 
             1., 0.532, 100., 0.09090909090909091, 0., 1.00026945145708, 
             0., 0., 1., 0., 0., 0., 0., 100431., 100431., 11., 11., 
             11., 0., 1., 0., 0., 0., 1., 0.}}]; propagatedrays = 
        (({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
             r9, wavelength, intensity, intensityscale, ray1, index, 
             opticallength, phaseshift, componentnumber, surfacenumber, 
             surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, 
             sno4, rayslot, oldgenerationnumber, intersectionnumber, 
             pol1, pol2, pol3} = #1; componentnumber = 1.; frontid = 1.; 
           {rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
            r8, r9, wavelength, intensity, intensityscale, ray1, index, 
            opticallength, phaseshift, componentnumber, surfacenumber, 
            surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
            rayslot, generationnumber, intersectionnumber, pol1, pol2, 
            pol3}) & ) /@ propagatedrays; thresholdintensity = 1.; 
       generationlimit = 200.; reportedrays = 
        {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
          r9, wavelength, intensity, intensityscale, ray1, index, 
          opticallength, phaseshift, componentnumber, surfacenumber, 
          surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
          rayslot, generationnumber, intersectionnumber, pol1, pol2, 
          pol3}}; generationnumber = 0.; (generationnumber += 1.; 
        reportedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, 
           r4, r5, r6, r7, r8, r9, wavelength, 0, intensityscale, ray1, 
           index, opticallength, phaseshift, componentnumber, 
           surfacenumber, surfaceid, ray2, ray3, sid, frontid, sno1, 
           sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; deflectedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, intensity, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; (deflectedrayspresent = False; reportedrayspresent = 
          False; deflecteddummyrayspresent = False; 
         reporteddummyrayspresent = False; {deflectedlocalrays, 
           reportedlocalrays} = Transpose[
           ((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                 r8, r9, wavelength, intensity, intensityscale, ray1, 
                 index, opticallength, phaseshift, componentnumber, 
                 surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                 sno1, sno2, sno3, sno4, rayslot, oldgenerationnumber, 
                 intersectionnumber, pol1, pol2, pol3} = #1; index1 = 
                index; xunit = r1; yunit = r2; zunit = r3; xunit = 
                Chop[xunit]; yunit = Chop[yunit]; zunit = Chop[zunit]; 
               magnitude = (xunit^2 + yunit^2 + zunit^2)^2^(-1); xunit = 
                xunit/magnitude; yunit = yunit/magnitude; zunit = 
                zunit/magnitude; rx = 3.5999999999999996 + rex; ry = 
                rey; rz = rez; rx = Chop[rx]; ry = Chop[ry]; rz = 
                Chop[rz]; terminatedeflection = False; intersections = 
                {{-1., 0., 0.}}); If[intensity > thresholdintensity, 
               deflectedrayspresent = True; (intersections = 
                  Block[{LocRayL, LocSCx, LocSCy}, LocRayL = 1. + I*0.; 
                    LocSCx = 1. + I*0.; LocSCy = 1. + I*0.; 
                    Re[Select[{{-1. + 0.*I, 0. + 0.*I, 0. + 0.*I}, 
                       {(386.*xunit - 37.*rx*xunit - 50.*ry*yunit - 
                        50.*rz*zunit - 1.4142135623730951*Sqrt[
                        74498.*xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*
                        xunit^2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*
                        xunit*yunit + 19300.*rx*yunit^2 - 925.*rx^2*
                        yunit^2 - 1250.*rz^2*yunit^2 - 19300.*rz*xunit*
                        zunit + 1850.*rx*rz*xunit*zunit + 2500.*ry*rz*
                        yunit*zunit + 19300.*rx*zunit^2 - 925.*rx^2*
                        zunit^2 - 1250.*ry^2*zunit^2])/(37.*xunit^2 + 
                        50.*yunit^2 + 50.*zunit^2), (37.*ry*xunit^2 + 
                        386.*xunit*yunit - 37.*rx*xunit*yunit - 50.*rz*
                        yunit*zunit + 50.*ry*zunit^2 - 
                        1.4142135623730951*yunit*Sqrt[74498.*xunit^2 - 
                        925.*ry^2*xunit^2 - 925.*rz^2*xunit^2 - 19300.*
                        ry*xunit*yunit + 1850.*rx*ry*xunit*yunit + 
                        19300.*rx*yunit^2 - 925.*rx^2*yunit^2 - 1250.*
                        rz^2*yunit^2 - 19300.*rz*xunit*zunit + 1850.*rx*
                        rz*xunit*zunit + 2500.*ry*rz*yunit*zunit + 
                        19300.*rx*zunit^2 - 925.*rx^2*zunit^2 - 1250.*
                        ry^2*zunit^2])/(37.*xunit^2 + 50.*yunit^2 + 
                        50.*zunit^2), (37.*rz*xunit^2 + 50.*rz*yunit^2 + 
                        386.*xunit*zunit - 37.*rx*xunit*zunit - 50.*ry*
                        yunit*zunit - 1.4142135623730951*zunit*Sqrt[
                        74498.*xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*
                        xunit^2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*
                        xunit*yunit + 19300.*rx*yunit^2 - 925.*rx^2*
                        yunit^2 - 1250.*rz^2*yunit^2 - 19300.*rz*xunit*
                        zunit + 1850.*rx*rz*xunit*zunit + 2500.*ry*rz*
                        yunit*zunit + 19300.*rx*zunit^2 - 925.*rx^2*
                        zunit^2 - 1250.*ry^2*zunit^2])/(37.*xunit^2 + 
                        50.*yunit^2 + 50.*zunit^2)}, {(386.*xunit - 
                        37.*rx*xunit - 50.*ry*yunit - 50.*rz*zunit + 
                        1.4142135623730951*Sqrt[74498.*xunit^2 - 925.*
                        ry^2*xunit^2 - 925.*rz^2*xunit^2 - 19300.*ry*
                        xunit*yunit + 1850.*rx*ry*xunit*yunit + 19300.*
                        rx*yunit^2 - 925.*rx^2*yunit^2 - 1250.*rz^2*
                        yunit^2 - 19300.*rz*xunit*zunit + 1850.*rx*rz*
                        xunit*zunit + 2500.*ry*rz*yunit*zunit + 19300.*
                        rx*zunit^2 - 925.*rx^2*zunit^2 - 1250.*ry^2*
                        zunit^2])/(37.*xunit^2 + 50.*yunit^2 + 50.*
                        zunit^2), (37.*ry*xunit^2 + 386.*xunit*yunit - 
                        37.*rx*xunit*yunit - 50.*rz*yunit*zunit + 
                        50.*ry*zunit^2 + 1.4142135623730951*yunit*
                        Sqrt[74498.*xunit^2 - 925.*ry^2*xunit^2 - 
                        925.*rz^2*xunit^2 - 19300.*ry*xunit*yunit + 
                        1850.*rx*ry*xunit*yunit + 19300.*rx*yunit^2 - 
                        925.*rx^2*yunit^2 - 1250.*rz^2*yunit^2 - 19300.*
                        rz*xunit*zunit + 1850.*rx*rz*xunit*zunit + 
                        2500.*ry*rz*yunit*zunit + 19300.*rx*zunit^2 - 
                        925.*rx^2*zunit^2 - 1250.*ry^2*zunit^2])/
                        (37.*xunit^2 + 50.*yunit^2 + 50.*zunit^2), 
                        (37.*rz*xunit^2 + 50.*rz*yunit^2 + 386.*xunit*
                        zunit - 37.*rx*xunit*zunit - 50.*ry*yunit*
                        zunit + 1.4142135623730951*zunit*Sqrt[74498.*
                        xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*xunit^
                        2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*xunit*
                        yunit + 19300.*rx*yunit^2 - 925.*rx^2*yunit^2 - 
                        1250.*rz^2*yunit^2 - 19300.*rz*xunit*zunit + 
                        1850.*rx*rz*xunit*zunit + 2500.*ry*rz*yunit*
                        zunit + 19300.*rx*zunit^2 - 925.*rx^2*zunit^2 - 
                        1250.*ry^2*zunit^2])/(37.*xunit^2 + 50.*yunit^
                        2 + 50.*zunit^2)}}, ({LocRayL, LocSCx, LocSCy} = 
                        #1; {LocRayL, LocSCx, LocSCy} == {-1., 0., 
                        0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[Re[LocRayL]]] >= 0. && Abs[ry + LocRayL*
                        yunit - LocSCx] + Abs[rz + LocRayL*zunit - 
                        LocSCy] + Abs[rx + LocRayL*xunit - (25*(LocSCx^
                        2 + LocSCy^2))/(193*(1 + Sqrt[1 - (925*(LocSCx^
                        2 + LocSCy^2))/74498]))] < 1.*^-7 && 
                        Re[LocSCx]^2 + Re[LocSCy]^2 <= 39.0625)) & ]]]; 
                 AppendTo[intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100987.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 1., 
                     100987.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 1., 100987.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -3.5999999999999996 + rxhlp; rey = ryhlp; 
                   rez = rzhlp; rex = Chop[rex]; rey = Chop[rey]; 
                   rez = Chop[rez]; intersectionnumber = 
                    intersectionnumber + 1.; opticallength = 
                    opticallength + ray1*index1; completedray = 
                    {rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                     r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., (-0.0016083472422043674*ray2^3)/
                        (Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])^2) - (0.0016083472422043674*
                        ray2*ray3^2)/(Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)])^2) - 
                        (0.2590673575129534*ray2)/(1. + Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]), 
                        (-0.0016083472422043674*ray2^2*ray3)/(Sqrt[
                        1. - 0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) - (0.0016083472422043674*ray3^3)/
                        (Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])^2) - (0.2590673575129534*
                        ray3)/(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])}, {(0.0016083472422043674*
                        ray2*(ray2^2 + ray3^2))/(Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) + (0.2590673575129534*ray2)/(1. + 
                        Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]), 1., 0.}, {(0.0016083472422043674*ray3*
                        (ray2^2 + ray3^2))/(Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) + (0.2590673575129534*ray3)/(1. + 
                        Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]), 0., 1.}}]; If[surfnorm[[1]] == {0., 0., 
                        0.} || surfnorm[[2]] == {0., 0., 0.} || 
                      surfnorm[[3]] == {0., 0., 0.}, surfnorm = 
                       1.*Re[{{1., (-0.0016083472422043674*(1.*^-6 + 
                        ray2)^3)/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.0016083472422043674*(1.*^-6 + ray2)*(1.*^-6 + 
                        ray3)^2)/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.2590673575129534*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 
                        (-0.0016083472422043674*(1.*^-6 + ray2)^2*
                        (1.*^-6 + ray3))/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.0016083472422043674*(1.*^-6 + ray3)^3)/
                        (Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.2590673575129534*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])}, {(0.0016083472422043674*
                        (1.*^-6 + ray2)*((1.*^-6 + ray2)^2 + (1.*^-6 + 
                        ray3)^2))/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) + 
                        (0.2590673575129534*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 1., 0.}, 
                        {(0.0016083472422043674*(1.*^-6 + ray3)*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2))/
                        (Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.2590673575129534*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = 
                     {-3.5999999999999996, 0, 0}; activeregion = 1.; 
                    completedray = {rsx, rsy, rsz, rex, rey, rez, r1, 
                      r2, r3, r4, r5, r6, r7, r8, r9, wavelength, 
                      intensity, intensityscale, ray1, index, 
                      opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.5392664079781753 - 
                        0.7232199521975703*wavelength + 
                        1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        Sqrt[1.0005281111748805 - 2.364805676582992*^-10*
                        wavelength^2 + 2.9781670902982902*^-6/wavelength^
                        2 + 2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]; 
                        If[Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = Sqrt[1.0005281111748805 - 
                        2.364805676582992*^-10*wavelength^2 + 
                        2.9781670902982902*^-6/wavelength^2 + 
                        2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]], 
                     index2 = Sqrt[1.0005281111748805 - 
                        2.364805676582992*^-10*wavelength^2 + 
                        2.9781670902982902*^-6/wavelength^2 + 
                        2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]; index1 = 
                       index; If[Abs[index2 - index1] < 0.01, 
                       alternateindex = 1.5392664079781753 - 
                        0.7232199521975703*wavelength + 
                        1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                3.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{TempVar, TempVar1, TempVar2, 
                    TempVar3, LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                    TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                     {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                    TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                      6.5*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                      2*rx*6.5; TempVar3 = Re[TempVar3]; 
                    If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 25. && Abs[ry + LocRayL*
                        yunit - LocSCx] + Abs[rz + LocRayL*zunit - 
                        LocSCy] + Abs[-6.5 + rx + LocRayL*xunit + Sqrt[
                        42.25 - LocSCx^2 - LocSCy^2]] < 1.*^-7, 
                        {LocRayL, LocSCx, LocSCy}, {-1., 0., 0.}], 
                        {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        25. && Abs[ry + LocRayL*yunit - LocSCx] + 
                        Abs[rz + LocRayL*zunit - LocSCy] + Abs[-6.5 + 
                        rx + LocRayL*xunit + Sqrt[42.25 - LocSCx^2 - 
                        LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, LocSCy}, 
                        {-1., 0., 0.}]}; If[TempVar[[1]] == TempVar[[
                        2]], {TempVar[[1]]}, TempVar], {{-1., 0., 
                       0.}}]]; AppendTo[intersections, {-1., 0., 0.}]; 
                 holeQ = False; If[ !(Chop[surfaceid - 100988.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 2., 
                     100988.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 2., 100988.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -3.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., -(ray2/(42.25 - ray2^2 - ray3^2)^
                        2^(-1)), -(ray3/(42.25 - ray2^2 - ray3^2)^
                        2^(-1))}, {ray2/(42.25 - ray2^2 - ray3^2)^
                        2^(-1), 1., 0.}, {ray3/(42.25 - ray2^2 - ray3^2)^
                        2^(-1), 0., 1.}}]; dummymatrix = (#1 & ) /@ 
                      surfnorm; surfnorm = (#1/Sqrt[#1 . #1] & ) /@ 
                      dummymatrix; surfacerotationmatrix = {{1., 0, 0}, 
                      {0, 1., 0}, {0, 0, 1.}}; 
                    surfacetranslationvector = {-3.05, 0, 0}; 
                    activeregion = 1.; completedray = {rsx, rsy, rsz, 
                      rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.5532682085807892 - 
                        1.0054245500487249*wavelength + 
                        1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3], index2 = 
                       1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                0.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = If[Chop[xunit] != 0, 
                   {(If[N[Chop[#1[[1]]]] >= 0. && #1[[2]]^2 + #1[[3]]^
                        2 <= 6.25, {#1[[1]], #1[[2]], #1[[3]]}, 
                       {-1., 0., 0.}] & )[{-(rx/xunit), ry - (rx*yunit)/
                        xunit, rz - (rx*zunit)/xunit}]}, {{-1., 0., 
                     0.}}]; AppendTo[intersections, {-1., 0., 0.}]; 
                 holeQ = False; If[ !(Chop[surfaceid - 100989.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 3., 
                     100989.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 3., 100989.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -0.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {-0.05, 0, 
                      0}; activeregion = 0.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; 
                    allcreatedrays = {{rsx, rsy, rsz, rex, rey, rez, r1, 
                       r2, r3, r4, r5, r6, r7, r8, r9, wavelength, 
                       intensity, intensityscale, ray1, index, 
                       opticallength, phaseshift, componentnumber, 
                       surfacenumber, surfaceid, ray2, ray3, sid, 
                       frontid, sno1, sno2, sno3, sno4, rayslot, 
                       generationnumber, intersectionnumber, pol1, pol2, 
                       pol3}})); {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                0.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = If[Chop[xunit] != 0, 
                   {(If[N[Chop[#1[[1]]]] >= 0. && #1[[2]]^2 + #1[[3]]^
                        2 <= 25., {#1[[1]], #1[[2]], #1[[3]]}, {-1., 0., 
                        0.}] & )[{-(rx/xunit), ry - (rx*yunit)/xunit, 
                      rz - (rx*zunit)/xunit}]}, {{-1., 0., 0.}}]; 
                 AppendTo[intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100990.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]; intersections = 
                  Union[(If[#1[[2]]^2 + #1[[3]]^2 <= 6.25, holeQ = True; 
                       {-1., 0., 0.}, #1] & ) /@ 
                    unfilteredintersections]; If[Length[intersections] > 
                   1, dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 4., 
                     100990.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 4., 100990.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -0.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {-0.05, 0, 
                      0}; activeregion = 0.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; intensity = 
                     0.; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}})); {First[allcreatedrays], 
                   completedray}, reporteddummyrayspresent = True; 
                  {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                    r6, r7, r8, r9, wavelength, intensity, 
                    intensityscale, ray1, index, opticallength, 
                    phaseshift, componentnumber, surfacenumber, 
                    surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                    sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = rex; ry = 
                rey; rz = rez; rx = Chop[rx]; ry = Chop[ry]; rz = 
                Chop[rz]; terminatedeflection = False; intersections = 
                {{-1., 0., 0.}}); If[intensity > thresholdintensity, 
               deflectedrayspresent = True; (intersections = 
                  Block[{surfaceapprox, tempapprox, intersects, LocRayL, 
                    LocSCx, LocSCy}, LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; surfaceapprox = {{-1., 0., 0.}}; 
                    tempapprox = {{-1., 0., 0.}}; intersects = 
                     {{-1., 0., 0.}}; surfaceapprox = Block[{TempVar, 
                       TempVar1, TempVar2, TempVar3, LocRayL, LocSCx, 
                       LocSCy}, TempVar1 = 1.; TempVar2 = 1.; TempVar3 = 
                        1.; TempVar = {{-1., 0., 0.}}; LocRayL = 1.; 
                       LocSCx = 1.; LocSCy = 1.; TempVar1 = rx^2 + 
                        ry^2 + rz^2; TempVar2 = rx*xunit + ry*yunit + 
                        rz*zunit - 10.2*xunit; TempVar3 = -TempVar1 + 
                        TempVar2^2 + 2*rx*10.2; TempVar3 = Re[TempVar3]; 
                       If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[-10.2 + rx + 
                        LocRayL*xunit + Sqrt[104.03999999999999 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}], {LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 + TempVar3, ry + 
                        (-TempVar2 + TempVar3)*yunit, rz + (-TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[-10.2 + rx + 
                        LocRayL*xunit + Sqrt[104.03999999999999 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                        {{-1., 0., 0.}}]]; tempapprox = Union[Join[
                       (Take[#1, 3] & ) /@ surfaceapprox, {{-1., 0., 
                        0.}}]]; If[Length[Select[tempapprox, 
                        Chop[First[#1]] <= 0 & ]] != Length[tempapprox], 
                     surfaceapprox = Select[tempapprox, 
                       Chop[First[#1]] > 0 & ], surfaceapprox = 
                      {{-1., 0., 0.}}]; If[surfaceapprox != {{-1., 0., 
                        0.}}, intersects = {{-1., 0., 0.}}; Scan[
                       (AppendTo[intersects, {LocRayL, LocSCx, LocSCy} = 
                        {#1[[1]], #1[[2]], #1[[3]]}; If[Plus @@ Abs[
                        {rx + LocRayL*xunit, ry + LocRayL*yunit, rz + 
                        LocRayL*zunit} - {(0.09803921568627452*(LocSCx^
                        2 + LocSCy^2))/(1 + Sqrt[1 + 
                        0.020488273740868906*(LocSCx^2 + LocSCy^2)]), 
                        LocSCx, LocSCy}] < 1.*^-9, {LocRayL, LocSCx, 
                        LocSCy}, LocRayL = 0.99*LocRayL; Function[{rx, 
                        ry, rz, xunit, yunit, zunit, startpoint}, Block[
                        {values, stepsizes, fvector, success, steps, 
                        denominator}, values = {1.}; stepsizes = {1.}; 
                        fvector = {1.}; success = False; steps = 0; 
                        denominator = 1.; stepsizes = Table[
                        1.0000000000000001*^-7, {3}]; values = 
                        startpoint; While[steps < 50 && (success = True; 
                        (If[Abs[#1] > 1.*^-9, success = False; 1., 
                        1.] & ) /@ stepsizes;  !success), steps = 
                        steps + 1; fvector = {rx + xunit*values[[1]], 
                        ry + yunit*values[[1]], rz + zunit*values[[
                        1]]} - {(0.09803921568627452*(values[[2]]^2 + 
                        values[[3]]^2))/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]), values[[2]], values[[3]]}; 
                        denominator = xunit - yunit*((
                        (0.002008654288320481*values[[2]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1) - zunit*(((0.002008654288320481*
                        values[[3]]*(values[[2]]^2 + values[[3]]^2))/
                        (Sqrt[1 + 0.020488273740868906*(values[[2]]^2 + 
                        values[[3]]^2)]*(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)])^2) - (0.19607843137254904*values[[3]])/
                        (1 + Sqrt[1 + 0.020488273740868906*(values[[2]]^
                        2 + values[[3]]^2)]))*-1); If[Chop[
                        denominator] != 0, denominator, denominator = 
                        1.]; stepsizes = -(#1 . fvector & ) /@ ({{1, 
                        -(((0.002008654288320481*values[[2]]*(values[[
                        2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1), -(((0.002008654288320481*values[[
                        3]]*(values[[2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1)}, {yunit, -xunit - 
                        ((0.002008654288320481*values[[3]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*zunit, ((0.002008654288320481*values[[
                        3]]*(values[[2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*yunit}, {zunit, ((0.002008654288320481*
                        values[[2]]*(values[[2]]^2 + values[[3]]^2))/
                        (Sqrt[1 + 0.020488273740868906*(values[[2]]^2 + 
                        values[[3]]^2)]*(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)])^2) - (0.19607843137254904*values[[2]])/
                        (1 + Sqrt[1 + 0.020488273740868906*(values[[2]]^
                        2 + values[[3]]^2)]))*zunit, -xunit - 
                        ((0.002008654288320481*values[[2]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*yunit}}/denominator); values = 
                        values + stepsizes]; If[steps >= 50, If[First[
                        values] > 0, values = -values; 1., 1.]; 
                        denominator = 1., 1.]; values]][rx, ry, rz, 
                        xunit, yunit, zunit, {LocRayL, LocSCx, 
                        LocSCy}]]]; {-1., 0., 0.}) & , surfaceapprox]; 
                      Union[Re[Select[intersects, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Plus @@ Abs[{rx + LocRayL*
                        xunit, ry + LocRayL*yunit, rz + LocRayL*zunit} - 
                        {(0.09803921568627452*(LocSCx^2 + LocSCy^2))/
                        (1 + Sqrt[1 + 0.020488273740868906*(LocSCx^2 + 
                        LocSCy^2)]), LocSCx, LocSCy}] < 1.*^-9)) & ]]], 
                     {{-1., 0., 0.}}]]; AppendTo[intersections, 
                  {-1., 0., 0.}]; holeQ = False; If[
                   !(Chop[surfaceid - 100991.] == 0. || N[Chop[ray1]] < 
                      0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 5., 
                     100991.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 5., 100991.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = rxhlp; rey = ryhlp; rez = rzhlp; rex = 
                    Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., (0.002008654288320481*ray2^3)/
                        (Sqrt[1. + 0.020488273740868906*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])^2) + (0.002008654288320481*
                        ray2*ray3^2)/(Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)])^2) - 
                        (0.19607843137254904*ray2)/(1. + Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]), 
                        (0.002008654288320481*ray2^2*ray3)/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.002008654288320481*ray3^3)/
                        (Sqrt[1. + 0.020488273740868906*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])^2) - (0.19607843137254904*
                        ray3)/(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])}, {(-0.002008654288320481*
                        ray2*(ray2^2 + ray3^2))/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.19607843137254904*ray2)/
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)]), 1., 0.}, {(-0.002008654288320481*ray3*
                        (ray2^2 + ray3^2))/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.19607843137254904*ray3)/
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)]), 0., 1.}}]; If[surfnorm[[1]] == 
                       {0., 0., 0.} || surfnorm[[2]] == {0., 0., 0.} || 
                      surfnorm[[3]] == {0., 0., 0.}, surfnorm = 
                       1.*Re[{{1., (0.002008654288320481*(1.*^-6 + ray2)^
                        3)/(Sqrt[1. + 0.020488273740868906*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.002008654288320481*
                        (1.*^-6 + ray2)*(1.*^-6 + ray3)^2)/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.19607843137254904*
                        (1.*^-6 + ray2))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), (0.002008654288320481*
                        (1.*^-6 + ray2)^2*(1.*^-6 + ray3))/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.002008654288320481*
                        (1.*^-6 + ray3)^3)/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.19607843137254904*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])}, {(-0.002008654288320481*
                        (1.*^-6 + ray2)*((1.*^-6 + ray2)^2 + (1.*^-6 + 
                        ray3)^2))/(Sqrt[1. + 0.020488273740868906*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) + 
                        (0.19607843137254904*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. + 0.020488273740868906*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 1., 0.}, 
                        {(-0.002008654288320481*(1.*^-6 + ray3)*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2))/
                        (Sqrt[1. + 0.020488273740868906*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.19607843137254904*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1, 0, 0}, {0, 1, 0}, 
                      {0, 0, 1}}; surfacetranslationvector = {0, 0, 0}; 
                    activeregion = 1.; completedray = {rsx, rsy, rsz, 
                      rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.6765916828635454 - 
                        1.1701284013462314*wavelength + 
                        1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3], index2 = 
                       1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                -4. + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{surfaceapprox, tempapprox, 
                    intersects, LocRayL, LocSCx, LocSCy}, LocRayL = 1.; 
                    LocSCx = 1.; LocSCy = 1.; surfaceapprox = 
                     {{-1., 0., 0.}}; tempapprox = {{-1., 0., 0.}}; 
                    intersects = {{-1., 0., 0.}}; surfaceapprox = 
                     Block[{TempVar, TempVar1, TempVar2, TempVar3, 
                       LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                       TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                        {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                       LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                       TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                        -6.*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                        2*rx*-6.; TempVar3 = Re[TempVar3]; If[
                        N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[6. + rx + LocRayL*
                        xunit - Sqrt[36. - LocSCx^2 - LocSCy^2]] < 
                        1.*^-7, {LocRayL, LocSCx, LocSCy}, {-1., 0., 
                        0.}], {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Abs[ry + LocRayL*yunit - 
                        LocSCx] + Abs[rz + LocRayL*zunit - LocSCy] + 
                        Abs[6. + rx + LocRayL*xunit - Sqrt[36. - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                        {{-1., 0., 0.}}]]; tempapprox = Union[Join[
                       (Take[#1, 3] & ) /@ surfaceapprox, {{-1., 0., 
                        0.}}]]; If[Length[Select[tempapprox, 
                        Chop[First[#1]] <= 0 & ]] != Length[tempapprox], 
                     surfaceapprox = Select[tempapprox, 
                       Chop[First[#1]] > 0 & ], surfaceapprox = 
                      {{-1., 0., 0.}}]; If[surfaceapprox != {{-1., 0., 
                        0.}}, intersects = {{-1., 0., 0.}}; Scan[
                       (AppendTo[intersects, {LocRayL, LocSCx, LocSCy} = 
                        {#1[[1]], #1[[2]], #1[[3]]}; If[Plus @@ Abs[
                        {rx + LocRayL*xunit, ry + LocRayL*yunit, rz + 
                        LocRayL*zunit} - {(-0.16666666666666666*(LocSCx^
                        2 + LocSCy^2))/(1 + Sqrt[Plus[1]]), LocSCx, 
                        LocSCy}] < 1.*^-9, {LocRayL, LocSCx, LocSCy}, 
                        LocRayL = 0.99*LocRayL; Function[{rx, ry, rz, 
                        xunit, yunit, zunit, startpoint}, Block[{values, 
                        stepsizes, fvector, success, steps, 
                        denominator}, values = {1.}; stepsizes = {1.}; 
                        fvector = {1.}; success = False; steps = 0; 
                        denominator = 1.; stepsizes = Table[
                        1.0000000000000001*^-7, {3}]; values = 
                        startpoint; While[steps < 50 && (success = True; 
                        (If[Abs[#1] > 1.*^-9, success = False; 1., 
                        1.] & ) /@ stepsizes;  !success), steps = 
                        steps + 1; fvector = {rx + xunit*values[[1]], 
                        ry + yunit*values[[1]], rz + zunit*values[[
                        1]]} - {(-0.16666666666666666*(values[[2]]^2 + 
                        values[[3]]^2))/(1 + Sqrt[Plus[1]]), values[[
                        2]], values[[3]]}; denominator = xunit - yunit*
                        ((Plus[(0.3333333333333333*values[[2]])/(1 + 
                        Sqrt[Plus[1]])])*-1) - zunit*((Plus[
                        (0.3333333333333333*values[[3]])/(1 + Sqrt[Plus[
                        1]])])*-1); If[Chop[denominator] != 0, 
                        denominator, denominator = 1.]; stepsizes = 
                        -(#1 . fvector & ) /@ ({{1, -((Plus[
                        (0.3333333333333333*values[[2]])/(1 + Sqrt[Plus[
                        1]])])*-1), -((Plus[(0.3333333333333333*values[[
                        3]])/(1 + Sqrt[Plus[1]])])*-1)}, {yunit, 
                        -xunit - (Plus[(0.3333333333333333*values[[3]])/
                        (1 + Sqrt[Plus[1]])])*zunit, (Plus[
                        (0.3333333333333333*values[[3]])/(1 + Sqrt[Plus[
                        1]])])*yunit}, {zunit, (Plus[(0.3333333333333333*
                        values[[2]])/(1 + Sqrt[Plus[1]])])*zunit, 
                        -xunit - (Plus[(0.3333333333333333*values[[2]])/
                        (1 + Sqrt[Plus[1]])])*yunit}}/denominator); 
                        values = values + stepsizes]; If[steps >= 50, 
                        If[First[values] > 0, values = -values; 1., 1.]; 
                        denominator = 1., 1.]; values]][rx, ry, rz, 
                        xunit, yunit, zunit, {LocRayL, LocSCx, 
                        LocSCy}]]]; {-1., 0., 0.}) & , surfaceapprox]; 
                      Union[Re[Select[intersects, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Plus @@ Abs[{rx + LocRayL*
                        xunit, ry + LocRayL*yunit, rz + LocRayL*zunit} - 
                        {(-0.16666666666666666*(LocSCx^2 + LocSCy^2))/
                        (1 + Sqrt[Plus[1]]), LocSCx, LocSCy}] < 
                        1.*^-9)) & ]]], {{-1., 0., 0.}}]]; AppendTo[
                  intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100992.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 6., 
                     100992.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 6., 100992.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = 4. + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., Plus[(0.3333333333333333*ray2)/(1. + 
                        Sqrt[Plus[1.]])], Plus[(0.3333333333333333*ray3)/
                        (1. + Sqrt[Plus[1.]])]}, {Plus[
                        (-0.3333333333333333*ray2)/(1. + Sqrt[Plus[
                        1.]])], 1., 0.}, {Plus[(-0.3333333333333333*
                        ray3)/(1. + Sqrt[Plus[1.]])], 0., 1.}}]; 
                    If[surfnorm[[1]] == {0., 0., 0.} || surfnorm[[2]] == 
                       {0., 0., 0.} || surfnorm[[3]] == {0., 0., 0.}, 
                     surfnorm = 1.*Re[{{1., Plus[(0.3333333333333333*
                        (1.*^-6 + ray2))/(1. + Sqrt[Plus[1.]])], Plus[
                        (0.3333333333333333*(1.*^-6 + ray3))/(1. + 
                        Sqrt[Plus[1.]])]}, {Plus[(-0.3333333333333333*
                        (1.*^-6 + ray2))/(1. + Sqrt[Plus[1.]])], 1., 
                        0.}, {Plus[(-0.3333333333333333*(1.*^-6 + ray3))/
                        (1. + Sqrt[Plus[1.]])], 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {4., 0, 
                      0}; activeregion = 1.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; ZAxis = 
                     First[surfnorm]*Sign[First[surfnorm] . {r1, r2, 
                        r3}]; raytiltz = ZAxis . {r1, r2, r3}; 
                    raytiltx = 1 - raytiltz^2; If[raytiltx < 
                      2.220446049250313*^-16, raytiltx = 0., raytiltx = 
                      Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - ZAxis*
                       raytiltz; If[Abs[raytiltx] < 1.*^-7, XAxis = 
                      surfnorm[[2]], XAxis = XAxis/raytiltx]; YAxis = 
                     {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*XAxis[[3]], 
                      ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*XAxis[[3]], 
                      -(ZAxis[[2]]*XAxis[[1]]) + ZAxis[[1]]*XAxis[[2]]}; 
                    YAxis = YAxis/Sqrt[YAxis . YAxis]; PAxis = 
                     ZAxis*{r1, r2, r3} . XAxis - XAxis*{r1, r2, r3} . 
                        ZAxis; PAxis = PAxis/Sqrt[PAxis . PAxis]; 
                    normalizedpolarization = {pol1, pol2, pol3}[[
                      {1, 2}]]; normalizedpolarization = 
                     normalizedpolarization/Sqrt[
                       normalizedpolarization . normalizedpolarization]; 
                    allcreatedamplitudes = {{I*0., I*0., I*0.}}; 
                    amplitude = Sqrt[intensity]*(normalizedpolarization[[
                        1]]*{r4, r5, r6} + normalizedpolarization[[2]]*
                        {r7, r8, r9}*Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.499266407978439 - 
                        0.7232199521991957*wavelength + 
                        1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3], index2 = 
                       1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.499266407978439 - 0.7232199521991957*
                        wavelength + 1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.499266407978439 - 0.7232199521991957*
                        wavelength + 1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                -20.3203 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{TempVar, TempVar1, TempVar2, 
                    TempVar3, LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                    TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                     {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                    TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                      -12*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                      2*rx*-12; TempVar3 = Re[TempVar3]; 
                    If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 142.80249999999998 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[12 + rx + LocRayL*
                        xunit - Sqrt[144 - LocSCx^2 - LocSCy^2]] < 
                        1.*^-7, {LocRayL, LocSCx, LocSCy}, {-1., 0., 
                        0.}], {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        142.80249999999998 && Abs[ry + LocRayL*yunit - 
                        LocSCx] + Abs[rz + LocRayL*zunit - LocSCy] + 
                        Abs[12 + rx + LocRayL*xunit - Sqrt[144 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                     {{-1., 0., 0.}}]]; AppendTo[intersections, 
                  {-1., 0., 0.}]; holeQ = False; If[
                   !(Chop[surfaceid - 100993.] == 0. || N[Chop[ray1]] < 
                      0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 7., 
                     100993.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 7., 100993.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = 20.3203 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., -(-(ray2/(144 - ray2^2 - ray3^2)^
                        2^(-1))), -(-(ray3/(144 - ray2^2 - ray3^2)^
                        2^(-1)))}, {-(ray2/(144 - ray2^2 - ray3^2)^
                        2^(-1)), 1., 0.}, {-(ray3/(144 - ray2^2 - 
                        ray3^2)^2^(-1)), 0., 1.}}]; dummymatrix = 
                     (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {20.3203, 
                      0, 0}; activeregion = 0.; completedray = 
                     {rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                      r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; 
                    componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; intensity = 0.; allcreatedrays = 
                     {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                       r6, r7, r8, r9, wavelength, intensity, 
                       intensityscale, ray1, index, opticallength, 
                       phaseshift, componentnumber, surfacenumber, 
                       surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                       sno3, sno4, rayslot, generationnumber, 
                       intersectionnumber, pol1, pol2, pol3}})); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                -4. + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{surfaceapprox, tempapprox, 
                    intersects, LocRayL, LocSCx, LocSCy}, LocRayL = 1.; 
                    LocSCx = 1.; LocSCy = 1.; surfaceapprox = 
                     {{-1., 0., 0.}}; tempapprox = {{-1., 0., 0.}}; 
                    intersects = {{-1., 0., 0.}}; surfaceapprox = 
                     Block[{TempVar, TempVar1, TempVar2, TempVar3, 
                       LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                       TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                        {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                       LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                       TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                        -6.*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                        2*rx*-6.; TempVar3 = Re[TempVar3]; If[
                        N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[6. + rx + LocRayL*
                        xunit - Sqrt[36. - LocSCx^2 - LocSCy^2]] < 
                        1.*^-7, {LocRayL, LocSCx, LocSCy}, {-1., 0., 
                        0.}], {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Abs[ry + LocRayL*yunit - 
                        LocSCx] + Abs[rz + LocRayL*zunit - LocSCy] + 
                        Abs[6. + rx + LocRayL*xunit - Sqrt[36. - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                        {{-1., 0., 0.}}]]; tempapprox = Union[Join[
                       (Take[#1, 3] & ) /@ surfaceapprox, {{-1., 0., 
                        0.}}]]; If[Length[Select[tempapprox, 
                        Chop[First[#1]] <= 0 & ]] != Length[tempapprox], 
                     surfaceapprox = Select[tempapprox, 
                       Chop[First[#1]] > 0 & ], surfaceapprox = 
                      {{-1., 0., 0.}}]; If[surfaceapprox != {{-1., 0., 
                        0.}}, intersects = {{-1., 0., 0.}}; Scan[
                       (AppendTo[intersects, {LocRayL, LocSCx, LocSCy} = 
                        {#1[[1]], #1[[2]], #1[[3]]}; If[Plus @@ Abs[
                        {rx + LocRayL*xunit, ry + LocRayL*yunit, rz + 
                        LocRayL*zunit} - {(-0.16666666666666666*(LocSCx^
                        2 + LocSCy^2))/(1 + Sqrt[Plus[1]]), LocSCx, 
                        LocSCy}] < 1.*^-9, {LocRayL, LocSCx, LocSCy}, 
                        LocRayL = 0.99*LocRayL; Function[{rx, ry, rz, 
                        xunit, yunit, zunit, startpoint}, Block[{values, 
                        stepsizes, fvector, success, steps, 
                        denominator}, values = {1.}; stepsizes = {1.}; 
                        fvector = {1.}; success = False; steps = 0; 
                        denominator = 1.; stepsizes = Table[
                        1.0000000000000001*^-7, {3}]; values = 
                        startpoint; While[steps < 50 && (success = True; 
                        (If[Abs[#1] > 1.*^-9, success = False; 1., 
                        1.] & ) /@ stepsizes;  !success), steps = 
                        steps + 1; fvector = {rx + xunit*values[[1]], 
                        ry + yunit*values[[1]], rz + zunit*values[[
                        1]]} - {(-0.16666666666666666*(values[[2]]^2 + 
                        values[[3]]^2))/(1 + Sqrt[Plus[1]]), values[[
                        2]], values[[3]]}; denominator = xunit - yunit*
                        ((Plus[(0.3333333333333333*values[[2]])/(1 + 
                        Sqrt[Plus[1]])])*-1) - zunit*((Plus[
                        (0.3333333333333333*values[[3]])/(1 + Sqrt[Plus[
                        1]])])*-1); If[Chop[denominator] != 0, 
                        denominator, denominator = 1.]; stepsizes = 
                        -(#1 . fvector & ) /@ ({{1, -((Plus[
                        (0.3333333333333333*values[[2]])/(1 + Sqrt[Plus[
                        1]])])*-1), -((Plus[(0.3333333333333333*values[[
                        3]])/(1 + Sqrt[Plus[1]])])*-1)}, {yunit, 
                        -xunit - (Plus[(0.3333333333333333*values[[3]])/
                        (1 + Sqrt[Plus[1]])])*zunit, (Plus[
                        (0.3333333333333333*values[[3]])/(1 + Sqrt[Plus[
                        1]])])*yunit}, {zunit, (Plus[(0.3333333333333333*
                        values[[2]])/(1 + Sqrt[Plus[1]])])*zunit, 
                        -xunit - (Plus[(0.3333333333333333*values[[2]])/
                        (1 + Sqrt[Plus[1]])])*yunit}}/denominator); 
                        values = values + stepsizes]; If[steps >= 50, 
                        If[First[values] > 0, values = -values; 1., 1.]; 
                        denominator = 1., 1.]; values]][rx, ry, rz, 
                        xunit, yunit, zunit, {LocRayL, LocSCx, 
                        LocSCy}]]]; {-1., 0., 0.}) & , surfaceapprox]; 
                      Union[Re[Select[intersects, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Plus @@ Abs[{rx + LocRayL*
                        xunit, ry + LocRayL*yunit, rz + LocRayL*zunit} - 
                        {(-0.16666666666666666*(LocSCx^2 + LocSCy^2))/
                        (1 + Sqrt[Plus[1]]), LocSCx, LocSCy}] < 
                        1.*^-9)) & ]]], {{-1., 0., 0.}}]]; AppendTo[
                  intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100994.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 8., 
                     100994.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 8., 100994.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = 4. + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., Plus[(0.3333333333333333*ray2)/(1. + 
                        Sqrt[Plus[1.]])], Plus[(0.3333333333333333*ray3)/
                        (1. + Sqrt[Plus[1.]])]}, {Plus[
                        (-0.3333333333333333*ray2)/(1. + Sqrt[Plus[
                        1.]])], 1., 0.}, {Plus[(-0.3333333333333333*
                        ray3)/(1. + Sqrt[Plus[1.]])], 0., 1.}}]; 
                    If[surfnorm[[1]] == {0., 0., 0.} || surfnorm[[2]] == 
                       {0., 0., 0.} || surfnorm[[3]] == {0., 0., 0.}, 
                     surfnorm = 1.*Re[{{1., Plus[(0.3333333333333333*
                        (1.*^-6 + ray2))/(1. + Sqrt[Plus[1.]])], Plus[
                        (0.3333333333333333*(1.*^-6 + ray3))/(1. + 
                        Sqrt[Plus[1.]])]}, {Plus[(-0.3333333333333333*
                        (1.*^-6 + ray2))/(1. + Sqrt[Plus[1.]])], 1., 
                        0.}, {Plus[(-0.3333333333333333*(1.*^-6 + ray3))/
                        (1. + Sqrt[Plus[1.]])], 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {4., 0, 
                      0}; activeregion = 1.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; ZAxis = 
                     First[surfnorm]*Sign[First[surfnorm] . {r1, r2, 
                        r3}]; raytiltz = ZAxis . {r1, r2, r3}; 
                    raytiltx = 1 - raytiltz^2; If[raytiltx < 
                      2.220446049250313*^-16, raytiltx = 0., raytiltx = 
                      Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - ZAxis*
                       raytiltz; If[Abs[raytiltx] < 1.*^-7, XAxis = 
                      surfnorm[[2]], XAxis = XAxis/raytiltx]; YAxis = 
                     {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*XAxis[[3]], 
                      ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*XAxis[[3]], 
                      -(ZAxis[[2]]*XAxis[[1]]) + ZAxis[[1]]*XAxis[[2]]}; 
                    YAxis = YAxis/Sqrt[YAxis . YAxis]; PAxis = 
                     ZAxis*{r1, r2, r3} . XAxis - XAxis*{r1, r2, r3} . 
                        ZAxis; PAxis = PAxis/Sqrt[PAxis . PAxis]; 
                    normalizedpolarization = {pol1, pol2, pol3}[[
                      {1, 2}]]; normalizedpolarization = 
                     normalizedpolarization/Sqrt[
                       normalizedpolarization . normalizedpolarization]; 
                    allcreatedamplitudes = {{I*0., I*0., I*0.}}; 
                    amplitude = Sqrt[intensity]*(normalizedpolarization[[
                        1]]*{r4, r5, r6} + normalizedpolarization[[2]]*
                        {r7, r8, r9}*Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.499266407978439 - 
                        0.7232199521991957*wavelength + 
                        1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3], index2 = 
                       1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.499266407978439 - 0.7232199521991957*
                        wavelength + 1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.499266407978439 - 0.7232199521991957*
                        wavelength + 1.0984449372252627*wavelength^2 - 
                        0.5792106405003761*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = rex; ry = 
                rey; rz = rez; rx = Chop[rx]; ry = Chop[ry]; rz = 
                Chop[rz]; terminatedeflection = False; intersections = 
                {{-1., 0., 0.}}); If[intensity > thresholdintensity, 
               deflectedrayspresent = True; (intersections = 
                  Block[{surfaceapprox, tempapprox, intersects, LocRayL, 
                    LocSCx, LocSCy}, LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; surfaceapprox = {{-1., 0., 0.}}; 
                    tempapprox = {{-1., 0., 0.}}; intersects = 
                     {{-1., 0., 0.}}; surfaceapprox = Block[{TempVar, 
                       TempVar1, TempVar2, TempVar3, LocRayL, LocSCx, 
                       LocSCy}, TempVar1 = 1.; TempVar2 = 1.; TempVar3 = 
                        1.; TempVar = {{-1., 0., 0.}}; LocRayL = 1.; 
                       LocSCx = 1.; LocSCy = 1.; TempVar1 = rx^2 + 
                        ry^2 + rz^2; TempVar2 = rx*xunit + ry*yunit + 
                        rz*zunit - 10.2*xunit; TempVar3 = -TempVar1 + 
                        TempVar2^2 + 2*rx*10.2; TempVar3 = Re[TempVar3]; 
                       If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[-10.2 + rx + 
                        LocRayL*xunit + Sqrt[104.03999999999999 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}], {LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 + TempVar3, ry + 
                        (-TempVar2 + TempVar3)*yunit, rz + (-TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 31.922500000000003 && 
                        Abs[ry + LocRayL*yunit - LocSCx] + Abs[rz + 
                        LocRayL*zunit - LocSCy] + Abs[-10.2 + rx + 
                        LocRayL*xunit + Sqrt[104.03999999999999 - LocSCx^
                        2 - LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, 
                        LocSCy}, {-1., 0., 0.}]}; If[TempVar[[1]] == 
                        TempVar[[2]], {TempVar[[1]]}, TempVar], 
                        {{-1., 0., 0.}}]]; tempapprox = Union[Join[
                       (Take[#1, 3] & ) /@ surfaceapprox, {{-1., 0., 
                        0.}}]]; If[Length[Select[tempapprox, 
                        Chop[First[#1]] <= 0 & ]] != Length[tempapprox], 
                     surfaceapprox = Select[tempapprox, 
                       Chop[First[#1]] > 0 & ], surfaceapprox = 
                      {{-1., 0., 0.}}]; If[surfaceapprox != {{-1., 0., 
                        0.}}, intersects = {{-1., 0., 0.}}; Scan[
                       (AppendTo[intersects, {LocRayL, LocSCx, LocSCy} = 
                        {#1[[1]], #1[[2]], #1[[3]]}; If[Plus @@ Abs[
                        {rx + LocRayL*xunit, ry + LocRayL*yunit, rz + 
                        LocRayL*zunit} - {(0.09803921568627452*(LocSCx^
                        2 + LocSCy^2))/(1 + Sqrt[1 + 
                        0.020488273740868906*(LocSCx^2 + LocSCy^2)]), 
                        LocSCx, LocSCy}] < 1.*^-9, {LocRayL, LocSCx, 
                        LocSCy}, LocRayL = 0.99*LocRayL; Function[{rx, 
                        ry, rz, xunit, yunit, zunit, startpoint}, Block[
                        {values, stepsizes, fvector, success, steps, 
                        denominator}, values = {1.}; stepsizes = {1.}; 
                        fvector = {1.}; success = False; steps = 0; 
                        denominator = 1.; stepsizes = Table[
                        1.0000000000000001*^-7, {3}]; values = 
                        startpoint; While[steps < 50 && (success = True; 
                        (If[Abs[#1] > 1.*^-9, success = False; 1., 
                        1.] & ) /@ stepsizes;  !success), steps = 
                        steps + 1; fvector = {rx + xunit*values[[1]], 
                        ry + yunit*values[[1]], rz + zunit*values[[
                        1]]} - {(0.09803921568627452*(values[[2]]^2 + 
                        values[[3]]^2))/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]), values[[2]], values[[3]]}; 
                        denominator = xunit - yunit*((
                        (0.002008654288320481*values[[2]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1) - zunit*(((0.002008654288320481*
                        values[[3]]*(values[[2]]^2 + values[[3]]^2))/
                        (Sqrt[1 + 0.020488273740868906*(values[[2]]^2 + 
                        values[[3]]^2)]*(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)])^2) - (0.19607843137254904*values[[3]])/
                        (1 + Sqrt[1 + 0.020488273740868906*(values[[2]]^
                        2 + values[[3]]^2)]))*-1); If[Chop[
                        denominator] != 0, denominator, denominator = 
                        1.]; stepsizes = -(#1 . fvector & ) /@ ({{1, 
                        -(((0.002008654288320481*values[[2]]*(values[[
                        2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1), -(((0.002008654288320481*values[[
                        3]]*(values[[2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*-1)}, {yunit, -xunit - 
                        ((0.002008654288320481*values[[3]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*zunit, ((0.002008654288320481*values[[
                        3]]*(values[[2]]^2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[3]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*yunit}, {zunit, ((0.002008654288320481*
                        values[[2]]*(values[[2]]^2 + values[[3]]^2))/
                        (Sqrt[1 + 0.020488273740868906*(values[[2]]^2 + 
                        values[[3]]^2)]*(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)])^2) - (0.19607843137254904*values[[2]])/
                        (1 + Sqrt[1 + 0.020488273740868906*(values[[2]]^
                        2 + values[[3]]^2)]))*zunit, -xunit - 
                        ((0.002008654288320481*values[[2]]*(values[[2]]^
                        2 + values[[3]]^2))/(Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]*(1 + Sqrt[1 + 0.020488273740868906*
                        (values[[2]]^2 + values[[3]]^2)])^2) - 
                        (0.19607843137254904*values[[2]])/(1 + Sqrt[1 + 
                        0.020488273740868906*(values[[2]]^2 + values[[
                        3]]^2)]))*yunit}}/denominator); values = 
                        values + stepsizes]; If[steps >= 50, If[First[
                        values] > 0, values = -values; 1., 1.]; 
                        denominator = 1., 1.]; values]][rx, ry, rz, 
                        xunit, yunit, zunit, {LocRayL, LocSCx, 
                        LocSCy}]]]; {-1., 0., 0.}) & , surfaceapprox]; 
                      Union[Re[Select[intersects, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        31.922500000000003 && Plus @@ Abs[{rx + LocRayL*
                        xunit, ry + LocRayL*yunit, rz + LocRayL*zunit} - 
                        {(0.09803921568627452*(LocSCx^2 + LocSCy^2))/
                        (1 + Sqrt[1 + 0.020488273740868906*(LocSCx^2 + 
                        LocSCy^2)]), LocSCx, LocSCy}] < 1.*^-9)) & ]]], 
                     {{-1., 0., 0.}}]]; AppendTo[intersections, 
                  {-1., 0., 0.}]; holeQ = False; If[
                   !(Chop[surfaceid - 100995.] == 0. || N[Chop[ray1]] < 
                      0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 9., 
                     100995.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 9., 100995.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = rxhlp; rey = ryhlp; rez = rzhlp; rex = 
                    Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., (0.002008654288320481*ray2^3)/
                        (Sqrt[1. + 0.020488273740868906*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])^2) + (0.002008654288320481*
                        ray2*ray3^2)/(Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)])^2) - 
                        (0.19607843137254904*ray2)/(1. + Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]), 
                        (0.002008654288320481*ray2^2*ray3)/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.002008654288320481*ray3^3)/
                        (Sqrt[1. + 0.020488273740868906*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])^2) - (0.19607843137254904*
                        ray3)/(1. + Sqrt[1. + 0.020488273740868906*
                        (ray2^2 + ray3^2)])}, {(-0.002008654288320481*
                        ray2*(ray2^2 + ray3^2))/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.19607843137254904*ray2)/
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)]), 1., 0.}, {(-0.002008654288320481*ray3*
                        (ray2^2 + ray3^2))/(Sqrt[1. + 
                        0.020488273740868906*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)])^2) + (0.19607843137254904*ray3)/
                        (1. + Sqrt[1. + 0.020488273740868906*(ray2^2 + 
                        ray3^2)]), 0., 1.}}]; If[surfnorm[[1]] == 
                       {0., 0., 0.} || surfnorm[[2]] == {0., 0., 0.} || 
                      surfnorm[[3]] == {0., 0., 0.}, surfnorm = 
                       1.*Re[{{1., (0.002008654288320481*(1.*^-6 + ray2)^
                        3)/(Sqrt[1. + 0.020488273740868906*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.002008654288320481*
                        (1.*^-6 + ray2)*(1.*^-6 + ray3)^2)/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.19607843137254904*
                        (1.*^-6 + ray2))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), (0.002008654288320481*
                        (1.*^-6 + ray2)^2*(1.*^-6 + ray3))/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.002008654288320481*
                        (1.*^-6 + ray3)^3)/(Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.19607843137254904*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])}, {(-0.002008654288320481*
                        (1.*^-6 + ray2)*((1.*^-6 + ray2)^2 + (1.*^-6 + 
                        ray3)^2))/(Sqrt[1. + 0.020488273740868906*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. + 0.020488273740868906*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) + 
                        (0.19607843137254904*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. + 0.020488273740868906*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 1., 0.}, 
                        {(-0.002008654288320481*(1.*^-6 + ray3)*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2))/
                        (Sqrt[1. + 0.020488273740868906*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.19607843137254904*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. + 
                        0.020488273740868906*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1, 0, 0}, {0, 1, 0}, 
                      {0, 0, 1}}; surfacetranslationvector = {0, 0, 0}; 
                    activeregion = 1.; completedray = {rsx, rsy, rsz, 
                      rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.6765916828635454 - 
                        1.1701284013462314*wavelength + 
                        1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3], index2 = 
                       1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.6765916828635454 - 1.1701284013462314*
                        wavelength + 1.8245302544520878*wavelength^2 - 
                        0.9804493049132843*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                0.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = If[Chop[xunit] != 0, 
                   {(If[N[Chop[#1[[1]]]] >= 0. && #1[[2]]^2 + #1[[3]]^
                        2 <= 6.25, {#1[[1]], #1[[2]], #1[[3]]}, 
                       {-1., 0., 0.}] & )[{-(rx/xunit), ry - (rx*yunit)/
                        xunit, rz - (rx*zunit)/xunit}]}, {{-1., 0., 
                     0.}}]; AppendTo[intersections, {-1., 0., 0.}]; 
                 holeQ = False; If[ !(Chop[surfaceid - 100996.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 10., 
                     100996.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 10., 100996.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -0.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {-0.05, 0, 
                      0}; activeregion = 0.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; 
                    allcreatedrays = {{rsx, rsy, rsz, rex, rey, rez, r1, 
                       r2, r3, r4, r5, r6, r7, r8, r9, wavelength, 
                       intensity, intensityscale, ray1, index, 
                       opticallength, phaseshift, componentnumber, 
                       surfacenumber, surfaceid, ray2, ray3, sid, 
                       frontid, sno1, sno2, sno3, sno4, rayslot, 
                       generationnumber, intersectionnumber, pol1, pol2, 
                       pol3}})); {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                0.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = If[Chop[xunit] != 0, 
                   {(If[N[Chop[#1[[1]]]] >= 0. && #1[[2]]^2 + #1[[3]]^
                        2 <= 25., {#1[[1]], #1[[2]], #1[[3]]}, {-1., 0., 
                        0.}] & )[{-(rx/xunit), ry - (rx*yunit)/xunit, 
                      rz - (rx*zunit)/xunit}]}, {{-1., 0., 0.}}]; 
                 AppendTo[intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100997.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]; intersections = 
                  Union[(If[#1[[2]]^2 + #1[[3]]^2 <= 6.25, holeQ = True; 
                       {-1., 0., 0.}, #1] & ) /@ 
                    unfilteredintersections]; If[Length[intersections] > 
                   1, dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 11., 
                     100997.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 11., 100997.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -0.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = {-0.05, 0, 
                      0}; activeregion = 0.; completedray = {rsx, rsy, 
                      rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, 
                      r8, r9, wavelength, intensity, intensityscale, 
                      ray1, index, opticallength, phaseshift, 
                      componentnumber, surfacenumber, surfaceid, ray2, 
                      ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                      rayslot, generationnumber, intersectionnumber, 
                      pol1, pol2, pol3}; componentnumber = 
                     newcomponentnumber; surfacenumber = 
                     newsurfacenumber; surfaceid = newsurfaceid; 
                    originalray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                      r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                      intensityscale, ray1, index, opticallength, 
                      phaseshift, componentnumber, surfacenumber, 
                      surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                      sno3, sno4, rayslot, generationnumber, 
                      intersectionnumber, pol1, pol2, pol3}; intensity = 
                     0.; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}})); {First[allcreatedrays], 
                   completedray}, reporteddummyrayspresent = True; 
                  {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                    r6, r7, r8, r9, wavelength, intensity, 
                    intensityscale, ray1, index, opticallength, 
                    phaseshift, componentnumber, surfacenumber, 
                    surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                    sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                3.05 + rex; ry = rey; rz = rez; rx = Chop[rx]; ry = 
                Chop[ry]; rz = Chop[rz]; terminatedeflection = False; 
               intersections = {{-1., 0., 0.}}); If[intensity > 
                thresholdintensity, deflectedrayspresent = True; 
                (intersections = Block[{TempVar, TempVar1, TempVar2, 
                    TempVar3, LocRayL, LocSCx, LocSCy}, TempVar1 = 1.; 
                    TempVar2 = 1.; TempVar3 = 1.; TempVar = 
                     {{-1., 0., 0.}}; LocRayL = 1.; LocSCx = 1.; 
                    LocSCy = 1.; TempVar1 = rx^2 + ry^2 + rz^2; 
                    TempVar2 = rx*xunit + ry*yunit + rz*zunit - 
                      6.5*xunit; TempVar3 = -TempVar1 + TempVar2^2 + 
                      2*rx*6.5; TempVar3 = Re[TempVar3]; 
                    If[N[Chop[TempVar3]] >= 0., TempVar3 = Sqrt[
                        TempVar3]; TempVar = {{LocRayL, LocSCx, 
                        LocSCy} = {-TempVar2 - TempVar3, ry - 
                        (TempVar2 + TempVar3)*yunit, rz - (TempVar2 + 
                        TempVar3)*zunit}; If[N[Chop[LocRayL]] >= 0. && 
                        LocSCx^2 + LocSCy^2 <= 25. && Abs[ry + LocRayL*
                        yunit - LocSCx] + Abs[rz + LocRayL*zunit - 
                        LocSCy] + Abs[-6.5 + rx + LocRayL*xunit + Sqrt[
                        42.25 - LocSCx^2 - LocSCy^2]] < 1.*^-7, 
                        {LocRayL, LocSCx, LocSCy}, {-1., 0., 0.}], 
                        {LocRayL, LocSCx, LocSCy} = {-TempVar2 + 
                        TempVar3, ry + (-TempVar2 + TempVar3)*yunit, 
                        rz + (-TempVar2 + TempVar3)*zunit}; If[
                        N[Chop[LocRayL]] >= 0. && LocSCx^2 + LocSCy^2 <= 
                        25. && Abs[ry + LocRayL*yunit - LocSCx] + 
                        Abs[rz + LocRayL*zunit - LocSCy] + Abs[-6.5 + 
                        rx + LocRayL*xunit + Sqrt[42.25 - LocSCx^2 - 
                        LocSCy^2]] < 1.*^-7, {LocRayL, LocSCx, LocSCy}, 
                        {-1., 0., 0.}]}; If[TempVar[[1]] == TempVar[[
                        2]], {TempVar[[1]]}, TempVar], {{-1., 0., 
                       0.}}]]; AppendTo[intersections, {-1., 0., 0.}]; 
                 holeQ = False; If[ !(Chop[surfaceid - 100998.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 12., 
                     100998.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 12., 100998.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -3.05 + rxhlp; rey = ryhlp; rez = rzhlp; 
                   rex = Chop[rex]; rey = Chop[rey]; rez = Chop[rez]; 
                   intersectionnumber = intersectionnumber + 1.; 
                   opticallength = opticallength + ray1*index1; 
                   completedray = {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                     r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., -(ray2/(42.25 - ray2^2 - ray3^2)^
                        2^(-1)), -(ray3/(42.25 - ray2^2 - ray3^2)^
                        2^(-1))}, {ray2/(42.25 - ray2^2 - ray3^2)^
                        2^(-1), 1., 0.}, {ray3/(42.25 - ray2^2 - ray3^2)^
                        2^(-1), 0., 1.}}]; dummymatrix = (#1 & ) /@ 
                      surfnorm; surfnorm = (#1/Sqrt[#1 . #1] & ) /@ 
                      dummymatrix; surfacerotationmatrix = {{1., 0, 0}, 
                      {0, 1., 0}, {0, 0, 1.}}; 
                    surfacetranslationvector = {-3.05, 0, 0}; 
                    activeregion = 1.; completedray = {rsx, rsy, rsz, 
                      rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.5532682085807892 - 
                        1.0054245500487249*wavelength + 
                        1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3], index2 = 
                       1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5532682085807892 - 1.0054245500487249*
                        wavelength + 1.6027810806758462*wavelength^2 - 
                        0.8794405514273502*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       (generationnumber += 1.; reportedlocalrays = 
         {{rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, 
           r9, wavelength, 0, intensityscale, ray1, index, 
           opticallength, phaseshift, componentnumber, surfacenumber, 
           surfaceid, ray2, ray3, sid, frontid, sno1, sno2, sno3, sno4, 
           rayslot, generationnumber, intersectionnumber, pol1, pol2, 
           pol3}}; deflectedlocalrays = {{rsx, rsy, rsz, rex, rey, rez, 
           r1, r2, r3, r4, r5, r6, r7, r8, r9, wavelength, intensity, 
           intensityscale, ray1, index, opticallength, phaseshift, 
           componentnumber, surfacenumber, surfaceid, ray2, ray3, sid, 
           frontid, sno1, sno2, sno3, sno4, rayslot, generationnumber, 
           intersectionnumber, pol1, pol2, pol3}}; 
        (deflectedrayspresent = False; reportedrayspresent = False; 
         deflecteddummyrayspresent = False; reporteddummyrayspresent = 
          False; {deflectedlocalrays, reportedlocalrays} = 
          Transpose[((({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                 r5, r6, r7, r8, r9, wavelength, intensity, 
                 intensityscale, ray1, index, opticallength, phaseshift, 
                 componentnumber, surfacenumber, surfaceid, ray2, ray3, 
                 sid, frontid, sno1, sno2, sno3, sno4, rayslot, 
                 oldgenerationnumber, intersectionnumber, pol1, pol2, 
                 pol3} = #1; index1 = index; xunit = r1; yunit = r2; 
               zunit = r3; xunit = Chop[xunit]; yunit = Chop[yunit]; 
               zunit = Chop[zunit]; magnitude = (xunit^2 + yunit^2 + 
                  zunit^2)^2^(-1); xunit = xunit/magnitude; yunit = 
                yunit/magnitude; zunit = zunit/magnitude; rx = 
                3.5999999999999996 + rex; ry = rey; rz = rez; rx = 
                Chop[rx]; ry = Chop[ry]; rz = Chop[rz]; 
               terminatedeflection = False; intersections = 
                {{-1., 0., 0.}}); If[intensity > thresholdintensity, 
               deflectedrayspresent = True; (intersections = 
                  Block[{LocRayL, LocSCx, LocSCy}, LocRayL = 1. + I*0.; 
                    LocSCx = 1. + I*0.; LocSCy = 1. + I*0.; 
                    Re[Select[{{-1. + 0.*I, 0. + 0.*I, 0. + 0.*I}, 
                       {(386.*xunit - 37.*rx*xunit - 50.*ry*yunit - 
                        50.*rz*zunit - 1.4142135623730951*Sqrt[
                        74498.*xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*
                        xunit^2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*
                        xunit*yunit + 19300.*rx*yunit^2 - 925.*rx^2*
                        yunit^2 - 1250.*rz^2*yunit^2 - 19300.*rz*xunit*
                        zunit + 1850.*rx*rz*xunit*zunit + 2500.*ry*rz*
                        yunit*zunit + 19300.*rx*zunit^2 - 925.*rx^2*
                        zunit^2 - 1250.*ry^2*zunit^2])/(37.*xunit^2 + 
                        50.*yunit^2 + 50.*zunit^2), (37.*ry*xunit^2 + 
                        386.*xunit*yunit - 37.*rx*xunit*yunit - 50.*rz*
                        yunit*zunit + 50.*ry*zunit^2 - 
                        1.4142135623730951*yunit*Sqrt[74498.*xunit^2 - 
                        925.*ry^2*xunit^2 - 925.*rz^2*xunit^2 - 19300.*
                        ry*xunit*yunit + 1850.*rx*ry*xunit*yunit + 
                        19300.*rx*yunit^2 - 925.*rx^2*yunit^2 - 1250.*
                        rz^2*yunit^2 - 19300.*rz*xunit*zunit + 1850.*rx*
                        rz*xunit*zunit + 2500.*ry*rz*yunit*zunit + 
                        19300.*rx*zunit^2 - 925.*rx^2*zunit^2 - 1250.*
                        ry^2*zunit^2])/(37.*xunit^2 + 50.*yunit^2 + 
                        50.*zunit^2), (37.*rz*xunit^2 + 50.*rz*yunit^2 + 
                        386.*xunit*zunit - 37.*rx*xunit*zunit - 50.*ry*
                        yunit*zunit - 1.4142135623730951*zunit*Sqrt[
                        74498.*xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*
                        xunit^2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*
                        xunit*yunit + 19300.*rx*yunit^2 - 925.*rx^2*
                        yunit^2 - 1250.*rz^2*yunit^2 - 19300.*rz*xunit*
                        zunit + 1850.*rx*rz*xunit*zunit + 2500.*ry*rz*
                        yunit*zunit + 19300.*rx*zunit^2 - 925.*rx^2*
                        zunit^2 - 1250.*ry^2*zunit^2])/(37.*xunit^2 + 
                        50.*yunit^2 + 50.*zunit^2)}, {(386.*xunit - 
                        37.*rx*xunit - 50.*ry*yunit - 50.*rz*zunit + 
                        1.4142135623730951*Sqrt[74498.*xunit^2 - 925.*
                        ry^2*xunit^2 - 925.*rz^2*xunit^2 - 19300.*ry*
                        xunit*yunit + 1850.*rx*ry*xunit*yunit + 19300.*
                        rx*yunit^2 - 925.*rx^2*yunit^2 - 1250.*rz^2*
                        yunit^2 - 19300.*rz*xunit*zunit + 1850.*rx*rz*
                        xunit*zunit + 2500.*ry*rz*yunit*zunit + 19300.*
                        rx*zunit^2 - 925.*rx^2*zunit^2 - 1250.*ry^2*
                        zunit^2])/(37.*xunit^2 + 50.*yunit^2 + 50.*
                        zunit^2), (37.*ry*xunit^2 + 386.*xunit*yunit - 
                        37.*rx*xunit*yunit - 50.*rz*yunit*zunit + 
                        50.*ry*zunit^2 + 1.4142135623730951*yunit*
                        Sqrt[74498.*xunit^2 - 925.*ry^2*xunit^2 - 
                        925.*rz^2*xunit^2 - 19300.*ry*xunit*yunit + 
                        1850.*rx*ry*xunit*yunit + 19300.*rx*yunit^2 - 
                        925.*rx^2*yunit^2 - 1250.*rz^2*yunit^2 - 19300.*
                        rz*xunit*zunit + 1850.*rx*rz*xunit*zunit + 
                        2500.*ry*rz*yunit*zunit + 19300.*rx*zunit^2 - 
                        925.*rx^2*zunit^2 - 1250.*ry^2*zunit^2])/
                        (37.*xunit^2 + 50.*yunit^2 + 50.*zunit^2), 
                        (37.*rz*xunit^2 + 50.*rz*yunit^2 + 386.*xunit*
                        zunit - 37.*rx*xunit*zunit - 50.*ry*yunit*
                        zunit + 1.4142135623730951*zunit*Sqrt[74498.*
                        xunit^2 - 925.*ry^2*xunit^2 - 925.*rz^2*xunit^
                        2 - 19300.*ry*xunit*yunit + 1850.*rx*ry*xunit*
                        yunit + 19300.*rx*yunit^2 - 925.*rx^2*yunit^2 - 
                        1250.*rz^2*yunit^2 - 19300.*rz*xunit*zunit + 
                        1850.*rx*rz*xunit*zunit + 2500.*ry*rz*yunit*
                        zunit + 19300.*rx*zunit^2 - 925.*rx^2*zunit^2 - 
                        1250.*ry^2*zunit^2])/(37.*xunit^2 + 50.*yunit^
                        2 + 50.*zunit^2)}}, ({LocRayL, LocSCx, LocSCy} = 
                        #1; {LocRayL, LocSCx, LocSCy} == {-1., 0., 
                        0.} || (Chop[Im[#1]] == {0, 0, 0} && 
                        N[Chop[Re[LocRayL]]] >= 0. && Abs[ry + LocRayL*
                        yunit - LocSCx] + Abs[rz + LocRayL*zunit - 
                        LocSCy] + Abs[rx + LocRayL*xunit - (25*(LocSCx^
                        2 + LocSCy^2))/(193*(1 + Sqrt[1 - (925*(LocSCx^
                        2 + LocSCy^2))/74498]))] < 1.*^-7 && 
                        Re[LocSCx]^2 + Re[LocSCy]^2 <= 39.0625)) & ]]]; 
                 AppendTo[intersections, {-1., 0., 0.}]; holeQ = False; 
                 If[ !(Chop[surfaceid - 100999.] == 0. || 
                     N[Chop[ray1]] < 0.0001) || generationnumber == 1., 
                  minresonateraylength = 0., minresonateraylength = 
                   0.0001]; Block[{LocRayL, LocSCx, LocSCy}, 
                  LocRayL = 1.; LocSCx = 1.; LocSCy = 1.; dummymatrix = 
                    Union[Select[intersections, ({LocRayL, LocSCx, 
                        LocSCy} = #1; {LocRayL, LocSCx, LocSCy} == 
                        {-1., 0., 0.} || N[Chop[LocRayL]] >= 
                        minresonateraylength) & ]]; intersections = 
                    dummymatrix]; unfilteredintersections = 
                  intersections; If[Length[intersections] > 1, 
                  dummymatrix = Take[intersections, {2}]; 
                   intersections = dummymatrix; 1., 1.]); 
                If[intersections != {{-1., 0., 0.}}, 
                 intersectionspresent = True; ({newcomponentnumber, 
                     newsurfacenumber, newsurfaceid} = {1., 13., 
                     100999.}; {componentnumber, surfacenumber, 
                     surfaceid} = {1., 13., 100999.}; {ray1, ray2, 
                     ray3} = intersections[[1]]; rsx = rex; rsy = rey; 
                   rsz = rez; rxhlp = rx + ray1*xunit; ryhlp = 
                    ry + ray1*yunit; rzhlp = rz + ray1*zunit; 
                   rex = -3.5999999999999996 + rxhlp; rey = ryhlp; 
                   rez = rzhlp; rex = Chop[rex]; rey = Chop[rey]; 
                   rez = Chop[rez]; intersectionnumber = 
                    intersectionnumber + 1.; opticallength = 
                    opticallength + ray1*index1; completedray = 
                    {rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, r5, 
                     r6, r7, r8, r9, wavelength, intensity, 
                     intensityscale, ray1, index, opticallength, 
                     phaseshift, componentnumber, surfacenumber, 
                     surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                     sno3, sno4, rayslot, generationnumber, 
                     intersectionnumber, pol1, pol2, pol3}); 
                  (reportedrayspresent = True; (surfnorm = 
                     1.*Re[{{1., (-0.0016083472422043674*ray2^3)/
                        (Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])^2) - (0.0016083472422043674*
                        ray2*ray3^2)/(Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)])^2) - 
                        (0.2590673575129534*ray2)/(1. + Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]), 
                        (-0.0016083472422043674*ray2^2*ray3)/(Sqrt[
                        1. - 0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) - (0.0016083472422043674*ray3^3)/
                        (Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]*(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])^2) - (0.2590673575129534*
                        ray3)/(1. + Sqrt[1. - 0.012416440709817716*
                        (ray2^2 + ray3^2)])}, {(0.0016083472422043674*
                        ray2*(ray2^2 + ray3^2))/(Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) + (0.2590673575129534*ray2)/(1. + 
                        Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]), 1., 0.}, {(0.0016083472422043674*ray3*
                        (ray2^2 + ray3^2))/(Sqrt[1. - 
                        0.012416440709817716*(ray2^2 + ray3^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*(ray2^2 + 
                        ray3^2)])^2) + (0.2590673575129534*ray3)/(1. + 
                        Sqrt[1. - 0.012416440709817716*(ray2^2 + ray3^
                        2)]), 0., 1.}}]; If[surfnorm[[1]] == {0., 0., 
                        0.} || surfnorm[[2]] == {0., 0., 0.} || 
                      surfnorm[[3]] == {0., 0., 0.}, surfnorm = 
                       1.*Re[{{1., (-0.0016083472422043674*(1.*^-6 + 
                        ray2)^3)/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.0016083472422043674*(1.*^-6 + ray2)*(1.*^-6 + 
                        ray3)^2)/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.2590673575129534*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 
                        (-0.0016083472422043674*(1.*^-6 + ray2)^2*
                        (1.*^-6 + ray3))/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) - 
                        (0.0016083472422043674*(1.*^-6 + ray3)^3)/
                        (Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) - (0.2590673575129534*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])}, {(0.0016083472422043674*
                        (1.*^-6 + ray2)*((1.*^-6 + ray2)^2 + (1.*^-6 + 
                        ray3)^2))/(Sqrt[1. - 0.012416440709817716*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2)]*
                        (1. + Sqrt[1. - 0.012416440709817716*((1.*^-6 + 
                        ray2)^2 + (1.*^-6 + ray3)^2)])^2) + 
                        (0.2590673575129534*(1.*^-6 + ray2))/(1. + 
                        Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]), 1., 0.}, 
                        {(0.0016083472422043674*(1.*^-6 + ray3)*
                        ((1.*^-6 + ray2)^2 + (1.*^-6 + ray3)^2))/
                        (Sqrt[1. - 0.012416440709817716*((1.*^-6 + ray2)^
                        2 + (1.*^-6 + ray3)^2)]*(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)])^2) + (0.2590673575129534*
                        (1.*^-6 + ray3))/(1. + Sqrt[1. - 
                        0.012416440709817716*((1.*^-6 + ray2)^2 + 
                        (1.*^-6 + ray3)^2)]), 0., 1.}}]; 1., 1.]; 
                    dummymatrix = (#1 & ) /@ surfnorm; surfnorm = 
                     (#1/Sqrt[#1 . #1] & ) /@ dummymatrix; 
                    surfacerotationmatrix = {{1., 0, 0}, {0, 1., 0}, 
                      {0, 0, 1.}}; surfacetranslationvector = 
                     {-3.5999999999999996, 0, 0}; activeregion = 1.; 
                    completedray = {rsx, rsy, rsz, rex, rey, rez, r1, 
                      r2, r3, r4, r5, r6, r7, r8, r9, wavelength, 
                      intensity, intensityscale, ray1, index, 
                      opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; componentnumber = newcomponentnumber; 
                    surfacenumber = newsurfacenumber; surfaceid = 
                     newsurfaceid; originalray = {rsx, rsy, rsz, rex, 
                      rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                      wavelength, intensity, intensityscale, ray1, 
                      index, opticallength, phaseshift, componentnumber, 
                      surfacenumber, surfaceid, ray2, ray3, sid, 
                      frontid, sno1, sno2, sno3, sno4, rayslot, 
                      generationnumber, intersectionnumber, pol1, pol2, 
                      pol3}; ZAxis = First[surfnorm]*Sign[First[
                        surfnorm] . {r1, r2, r3}]; raytiltz = ZAxis . 
                      {r1, r2, r3}; raytiltx = 1 - raytiltz^2; 
                    If[raytiltx < 2.220446049250313*^-16, raytiltx = 0., 
                     raytiltx = Sqrt[raytiltx]]; XAxis = {r1, r2, r3} - 
                      ZAxis*raytiltz; If[Abs[raytiltx] < 1.*^-7, 
                     XAxis = surfnorm[[2]], XAxis = XAxis/raytiltx]; 
                    YAxis = {-(ZAxis[[3]]*XAxis[[2]]) + ZAxis[[2]]*
                        XAxis[[3]], ZAxis[[3]]*XAxis[[1]] - ZAxis[[1]]*
                        XAxis[[3]], -(ZAxis[[2]]*XAxis[[1]]) + 
                       ZAxis[[1]]*XAxis[[2]]}; YAxis = YAxis/Sqrt[
                       YAxis . YAxis]; PAxis = ZAxis*{r1, r2, r3} . 
                        XAxis - XAxis*{r1, r2, r3} . ZAxis; PAxis = 
                     PAxis/Sqrt[PAxis . PAxis]; normalizedpolarization = 
                     {pol1, pol2, pol3}[[{1, 2}]]; 
                    normalizedpolarization = normalizedpolarization/
                      Sqrt[normalizedpolarization . 
                        normalizedpolarization]; allcreatedamplitudes = 
                     {{I*0., I*0., I*0.}}; amplitude = Sqrt[intensity]*
                      (normalizedpolarization[[1]]*{r4, r5, r6} + 
                       normalizedpolarization[[2]]*{r7, r8, r9}*
                        Exp[I*pol3*0.017453292519943295]); 
                    perpendicularamplitude = amplitude . YAxis; 
                    parallelamplitude = amplitude . PAxis; 
                    If[activeregion*(surfacerotationmatrix . {r1, r2, 
                        r3})[[1]] > 0, index2 = 1.5392664079781753 - 
                        0.7232199521975703*wavelength + 
                        1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; index1 = index; 
                      If[Abs[index2 - index1] < 0.01, alternateindex = 
                        Sqrt[1.0005281111748805 - 2.364805676582992*^-10*
                        wavelength^2 + 2.9781670902982902*^-6/wavelength^
                        2 + 2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]; 
                        If[Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = Sqrt[1.0005281111748805 - 
                        2.364805676582992*^-10*wavelength^2 + 
                        2.9781670902982902*^-6/wavelength^2 + 
                        2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]], 
                     index2 = Sqrt[1.0005281111748805 - 
                        2.364805676582992*^-10*wavelength^2 + 
                        2.9781670902982902*^-6/wavelength^2 + 
                        2.6004099469477187*^-8/wavelength^4 + 
                        3.7787839314048715*^-10/wavelength^6 + 
                        2.830549017940716*^-12/wavelength^8]; index1 = 
                       index; If[Abs[index2 - index1] < 0.01, 
                       alternateindex = 1.5392664079781753 - 
                        0.7232199521975703*wavelength + 
                        1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3; If[
                        Abs[alternateindex - index1] > Abs[index2 - 
                        index1], index1 = index2; index2 = 
                        alternateindex, index1 = alternateindex], 
                       index1 = 1.5392664079781753 - 0.7232199521975703*
                        wavelength + 1.0984449372238456*wavelength^2 - 
                        0.5792106404991648*wavelength^3]]; n12 = 
                     index1/index2; index = index2; If[1 - n12^2*
                        raytiltx^2 >= 0., dummyvector = n12*{r1, r2, 
                        r3} + ZAxis*(-(n12*raytiltz) + Sqrt[1 - n12^2*
                        raytiltx^2]); {r1, r2, r3} = dummyvector; 1., 
                     If[{r1, r2, r3} . surfnorm[[1]] > 0, phaseshift = 
                        phaseshift + 0.5, 1.]; index2 = index1; 
                      index = index1; dummyvector = {r1, r2, r3} - 
                        2*ZAxis*ZAxis . {r1, r2, r3}; {r1, r2, r3} = 
                       dummyvector; dummyvector = {pol1, pol2, pol3} + 
                        {0, 0, -180}; {pol1, pol2, pol3} = dummyvector; 
                      1.]; allcreatedrays = {{rsx, rsy, rsz, rex, rey, 
                       rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                       wavelength, intensity, intensityscale, ray1, 
                       index, opticallength, phaseshift, 
                       componentnumber, surfacenumber, surfaceid, ray2, 
                       ray3, sid, frontid, sno1, sno2, sno3, sno4, 
                       rayslot, generationnumber, intersectionnumber, 
                       pol1, pol2, pol3}}; originalrotation = Partition[
                      Take[originalray, {7, 15}], 3]; previoustilt = 
                     originalrotation[[1]]; transmatrix = MapIndexed[
                      ({rsx, rsy, rsz, rex, rey, rez, r1, r2, r3, r4, 
                        r5, r6, r7, r8, r9, wavelength, intensity, 
                        intensityscale, ray1, index, opticallength, 
                        phaseshift, componentnumber, surfacenumber, 
                        surfaceid, ray2, ray3, sid, frontid, sno1, sno2, 
                        sno3, sno4, rayslot, oldgenerationnumber, 
                        intersectionnumber, pol1, pol2, pol3} = #1; 
                        rotationaxis = Cross[previoustilt, {r1, r2, 
                        r3}]; axismagnitude = Sqrt[rotationaxis . 
                        rotationaxis]; If[Chop[axismagnitude] != 0., 
                        rotationaxis = rotationaxis/axismagnitude; 
                        axismatrix = (#1*rotationaxis & ) /@ 
                        rotationaxis; crossmatrix = {{0., -rotationaxis[[
                        3]], rotationaxis[[2]]}, {rotationaxis[[3]], 0., 
                        -rotationaxis[[1]]}, {-rotationaxis[[2]], 
                        rotationaxis[[1]], 0.}}; cosangle = 
                        previoustilt . {r1, r2, r3}; If[1. - cosangle < 
                        2.220446049250313*^-16, cosangle = 1.]; 
                        sinangle = 1 - cosangle^2; If[sinangle < 
                        2.220446049250313*^-16, sinangle = 0., 
                        sinangle = Sqrt[sinangle]]; axismatrix + 
                        ({{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}} - 
                        axismatrix)*cosangle + crossmatrix*sinangle, 
                        {{r1, r2, r3}, {r4, r5, r6}, {r7, r8, r9}} = 
                        If[Sign[previoustilt . {r1, r2, r3}] === 1, 
                        {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, 
                        {{-1., 0., 0.}, {0., -1., 0.}, {0., 0., 
                        -1.}}]]) & , allcreatedrays]; allcreatedrays = 
                     MapIndexed[({rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        oldgenerationnumber, intersectionnumber, pol1, 
                        pol2, pol3} = #1; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = Function[mm, (mm . #1 & ) /@ 
                        originalrotation][transmatrix[[First[#2]]]]; 
                        tiltmagnitude = {r1, r2, r3} . {r1, r2, r3}; 
                        If[Abs[tiltmagnitude - 1.] > 1.*^-6, 
                        dummyvector = {r1, r2, r3}/Sqrt[tiltmagnitude]; 
                        {r1, r2, r3} = dummyvector; dummymatrix = 
                        (#1/Sqrt[#1 . #1] & ) /@ {{r1, r2, r3}, {r4, r5, 
                        r6}, {r7, r8, r9}}; {{r1, r2, r3}, {r4, r5, r6}, 
                        {r7, r8, r9}} = dummymatrix; 1., 1.]; 
                        If[allcreatedamplitudes != {{I*0., I*0., I*0.}}, 
                        amplitude = allcreatedamplitudes[[First[#2]]]; 
                        hor = {r4, r5, r6} . amplitude; ver = {r7, r8, 
                        r9} . amplitude; If[Abs[hor] > 0. || Abs[ver] > 
                        0., {pol1, pol2, pol3} = {Abs[hor], Abs[ver], 
                        0.}; dummyvector = {pol1, pol2, pol3}/Sqrt[
                        {pol1, pol2, pol3} . {pol1, pol2, pol3}]; 
                        {pol1, pol2, pol3} = dummyvector; dummyvector = 
                        ReplacePart[{pol1, pol2, pol3}, (If[ver == 0., 
                        0., Arg[ver]] - If[hor == 0., 0., Arg[hor]])/
                        Degree, 3]; {pol1, pol2, pol3} = dummyvector]; 
                        1., 1.]; {rsx, rsy, rsz, rex, rey, rez, r1, r2, 
                        r3, r4, r5, r6, r7, r8, r9, wavelength, 
                        intensity, intensityscale, ray1, index, 
                        opticallength, phaseshift, componentnumber, 
                        surfacenumber, surfaceid, ray2, ray3, sid, 
                        frontid, sno1, sno2, sno3, sno4, rayslot, 
                        generationnumber, intersectionnumber, pol1, 
                        pol2, pol3}) & , allcreatedrays])); 
                  {First[allcreatedrays], completedray}, 
                 reporteddummyrayspresent = True; {{rsx, rsy, rsz, rex, 
                    rey, rez, r1, r2, r3, r4, r5, r6, r7, r8, r9, 
                    wavelength, intensity, intensityscale, ray1, index, 
                    opticallength, phaseshift, componentnumber, 
                    surfacenumber, surfaceid, ray2, ray3, sid, frontid, 
                    sno1, sno2, sno3, sno4, rayslot, generationnumber, 
                    intersectionnumber, pol1, pol2, pol3}, {1., 1., 1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 
                    1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                    1.}}], reporteddummyrayspresent = True; 
                deflecteddummyrayspresent = True; {{1., 1., 1., 1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  -9.87654321*^8, 1., 1., 1., 1., 0., -1., -1., -1., 1., 
                  1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}, 
                 {1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1., -9.87654321*^8, 1., 1., 1., 1., 0., -1., 
                  -1., -1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 
                  1., 1., 1.}}]) & ) /@ propagatedrays]; 
         If[deflectedrayspresent && deflecteddummyrayspresent, 
          deflectedlocalrays = Select[deflectedlocalrays, 
             #1[[23]] > 0. & ]; 1., 1.]; If[reportedrayspresent && 
           reporteddummyrayspresent, reportedlocalrays = 
            Select[reportedlocalrays, #1[[23]] > 0. & ]; 1., 1.]); 
        (If[reportedrayspresent, reportedrays = Join[reportedrays, 
             {{-9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8, 
               -9.87654321*^8, -9.87654321*^8, -9.87654321*^8}}, 
             reportedlocalrays]; 1., 1.]; propagatedrays = 
          deflectedlocalrays); raysreported = reportedrayspresent; 1.); 
       If[Length[reportedrays] > 2, reportedrays = Drop[reportedrays, 
          2], reportedrays]; ({#1[[1]], #1[[2]], #1[[3]], #1[[4]], 
          #1[[5]], #1[[6]]} & ) /@ reportedrays]]), Deployed -> False, 
 AutorunSequencing -> {2}, SynchronousInitialization -> False, 
 SynchronousUpdating -> False]

CAPTION

This eye model (based on the work of Navarro) uses a spherical retinal surface as well as a thin lens defocusing element.

Move the red locator button to position the light source and the blue one for rotation.

DETAILS

Based on I. Escudero-Sanz and R. Navarro, "Off-Axis Aberrations of a Wide-Angle Schematic Eye Model," J. Opt. Soc. Am. A, 16(8), 1999 pp. 1881-1891.

This sample optics Demonstration was created using Optica 3, an application package available for Mathematica.

In the program, the thin lens defocusing element is governed by the input defocus parameters dx and dy (in diopters). The defocus angle determines the angle of rotation (in degrees) about the pupil center for the defocus effects. The scatter parameter is used to specify the diffuseness of the retina. The pupil size parameter determines the diameter of the pupil opening. Spatial units are in millimeters.

See http://www.opticasoftware.com for details about additional ray-tracing products.

THIS NOTEBOOK IS THE SOURCE CODE FROM

"Optical Model of the Human Eye" from the Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/OpticalModelOfTheHumanEye/

Contributed by: Ann Williamson and Donald Barnhart

(Optica Software, a division of Barnhart Optical Research)

A full-function Wolfram Mathematica system (Version 6 or higher) is required to edit this notebook.
GET WOLFRAM MATHEMATICA »

© Wolfram Demonstrations Project & Contributors   |   Terms of Use   |   Make a new version of this Demonstration »