/// <summary> /// Provides a ray from the source. (Stochastic only) /// </summary> /// <param name="index"></param> /// <param name="thread"></param> /// <param name="random"></param> /// <returns></returns> public override BroadRay Directions(int index, int thread, ref Random random) { X_Event X = new X_Event(); double[] RayPower = new double[8]; Hare.Geometry.Point Pt = T.Polys[base.rayct % T.Polygon_Count].GetRandomPoint(random.NextDouble(), random.NextDouble(), 0); Hare.Geometry.Vector P = new Vector(Pt.x, Pt.y, Pt.z); P.Normalize(); for (int oct = 0; oct < 8; oct++) { if (base.SPL[oct] == 0) { RayPower[oct] = 0; } else { Balloon.Shoot(new Ray(new Hare.Geometry.Point(0, 0, 0), P, thread, random.Next()), oct, out X); RayPower[oct] = 1E-12 * Math.Pow(10, .1 * X.t); } } base.rayct++; return(new BroadRay(H_Center, P, random.Next(), thread, RayPower, 0, Source_ID())); }
/// <summary> /// Provides a ray from the source. (Stochastic only) /// </summary> /// <param name="index"></param> /// <param name="thread"></param> /// <param name="random"></param> /// <returns></returns> public override BroadRay Directions(int index, int thread, ref Random random) { X_Event X = new X_Event(); double[] RayPower = new double[8]; Hare.Geometry.Point Pt = T.Polys[base.rayct % T.Polygon_Count].GetRandomPoint(random.NextDouble(), random.NextDouble(), 0); Hare.Geometry.Vector P = new Vector(Pt.x, Pt.y, Pt.z); P.Normalize(); for (int oct = 0; oct < 8; oct++) { if (base.SPL[oct] == 0) { RayPower[oct] = 0; } else { Balloon.Shoot(new Ray(new Hare.Geometry.Point(0, 0, 0), P, thread, random.Next()), oct, out X); RayPower[oct] = 1E-12 * Math.Pow(10, .1 * X.t); } } double[] phtemp = new double[8]; if (ph == Phase_Regime.Random) { for (int o = 0; o < 8; o++) { phtemp[o] = random.Next() * 2 * Math.PI; } } else { for (int o = 0; o < 8; o++) { phtemp[o] = 0 - Delay * Utilities.Numerics.angularFrequency[o]; } } base.rayct++; return(new BroadRay(H_Center, P, random.Next(), thread, RayPower, phase, delay, Source_ID())); }