public override bool shoot(Hare.Geometry.Ray R, int top_id, out Hare.Geometry.X_Event X)
 {
     if (SP.Shoot(R, top_id, out X))
     {
         return(true);
     }
     return(false);
 }
            public override bool shoot(Hare.Geometry.Ray R, out double u, out double v, out int Poly_ID, out List <Hare.Geometry.Point> X_PT, out List <double> t, out List <int> code)
            {
                ///////////////////////
                //double L2 = (R.direction.x * R.direction.x + R.direction.y * R.direction.y + R.direction.z *R.direction.z);
                //if (L2 > 1.05 || L2 < 0.95)
                //{
                //    Rhino.RhinoApp.Write("Vectors have lost normalization...");
                //}
                ///////////////////////
                //R.direction.Normalize();
                ///////////////////////
                Hare.Geometry.X_Event X = new Hare.Geometry.X_Event();
                if (SP.Shoot(R, 0, out X))
                {
                    Poly_ID = X.Poly_id;
                    X_Event_NH XNH = X as X_Event_NH;
                    if (XNH != null)
                    {
                        X_PT = XNH.P_Points;
                        t    = XNH.t_trav;
                        code = XNH.SPCode;
                    }
                    else
                    {
                        X_PT = new List <Hare.Geometry.Point> {
                            X.X_Point
                        };
                        t = new List <double> {
                            X.t
                        };
                        code = new List <int> {
                            0
                        };
                    }

                    u = 0;
                    v = 0;
                    return(true);
                }
                Poly_ID = 0;
                X_PT    = new List <Hare.Geometry.Point>();
                //Rhino.RhinoDoc.ActiveDoc.Objects.Add(new Rhino.Geometry.LineCurve(Utilities.PachTools.HPttoRPt(R.origin), Utilities.PachTools.HPttoRPt(R.origin + R.direction)));
                t    = new List <double>();
                u    = 0;
                v    = 0;
                code = new List <int>()
                {
                    0
                };
                return(false);
            }
 public override bool shoot(Hare.Geometry.Ray R, out double u, out double v, out int Poly_ID, out Hare.Geometry.Point X_PT, out double t)
 {
     Hare.Geometry.X_Event X = new Hare.Geometry.X_Event();
     if (SP.Shoot(R, 0, out X))
     {
         Poly_ID = X.Poly_id;
         X_PT    = X.X_Point;
         t       = X.t;
         u       = 0;
         v       = 0;
         return(true);
     }
     Poly_ID = 0;
     X_PT    = new Hare.Geometry.Point();
     //Rhino.RhinoDoc.ActiveDoc.Objects.Add(new Rhino.Geometry.LineCurve(Utilities.PachTools.HPttoRPt(R.origin), Utilities.PachTools.HPttoRPt(R.origin + R.direction)));
     t = 0;
     u = 0;
     v = 0;
     return(false);
 }
            public override bool shoot(Hare.Geometry.Ray R, out double u, out double v, out int Poly_ID, out List<Hare.Geometry.Point> X_PT, out List<double> t, out List<int> code)
            {
                ///////////////////////
                //double L2 = (R.direction.x * R.direction.x + R.direction.y * R.direction.y + R.direction.z *R.direction.z);
                //if (L2 > 1.05 || L2 < 0.95)
                //{
                //    Rhino.RhinoApp.Write("Vectors have lost normalization...");
                //}
                ///////////////////////
                //R.direction.Normalize();
                ///////////////////////
                Hare.Geometry.X_Event X = new Hare.Geometry.X_Event();
                if (SP.Shoot(R, 0, out X))
                {
                    Poly_ID = X.Poly_id;
                    X_Event_NH XNH = X as X_Event_NH;
                    if (XNH != null)
                    {
                        X_PT = XNH.P_Points;
                        t = XNH.t_trav;
                        code = XNH.SPCode;
                    }
                    else
                    {
                        X_PT = new List<Hare.Geometry.Point>{X.X_Point};
                        t = new List<double>{X.t};
                        code = new List<int>{0};
                    }

                    u = 0;
                    v = 0;
                    return true;
                }
                Poly_ID = 0;
                X_PT = new List<Hare.Geometry.Point>();
                //Rhino.RhinoDoc.ActiveDoc.Objects.Add(new Rhino.Geometry.LineCurve(Utilities.PachTools.HPttoRPt(R.origin), Utilities.PachTools.HPttoRPt(R.origin + R.direction)));
                t = new List<double>();
                u = 0;
                v = 0;
                code = new List<int>() { 0 };
                return false;
            }
 public override bool shoot(Hare.Geometry.Ray R, out double u, out double v, out int Poly_ID, out Hare.Geometry.Point X_PT, out double t)
 {
     Hare.Geometry.X_Event X = new Hare.Geometry.X_Event();
     if (SP.Shoot(R, 0, out X))
     {
         Poly_ID = X.Poly_id;
         X_PT = X.X_Point;
         t = X.t;
         u = 0;
         v = 0;
         return true;
     }
     Poly_ID = 0;
     X_PT = new Hare.Geometry.Point();
     //Rhino.RhinoDoc.ActiveDoc.Objects.Add(new Rhino.Geometry.LineCurve(Utilities.PachTools.HPttoRPt(R.origin), Utilities.PachTools.HPttoRPt(R.origin + R.direction)));
     t = 0;
     u = 0;
     v = 0;
     return false;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Checks a path for occlusions in the model.
        /// </summary>
        /// <param name="Origin"></param>
        /// <param name="EndPt"></param>
        /// <param name="Poly_X"></param>
        /// <param name="X_Point"></param>
        /// <param name="Thread_Id">The id of the calling thread.</param>
        /// <returns></returns>
        private bool OcclusionIntersectED(Hare.Geometry.Point Origin, Hare.Geometry.Point EndPt, int Poly_X, ref double[] Trans_Mod, ref Hare.Geometry.Point X_Point, int Thread_Id)//ref double[] Trans_Mod
        {
            Hare.Geometry.Vector D = (EndPt - Origin);
            double L = D.Length();
            D /= L;
            Ray R = new Ray(Origin, D, Thread_Id, Rnd[Thread_Id].Next());
            Hare.Geometry.X_Event X = new Hare.Geometry.X_Event();

            do
            {
                if (Room.shoot(R, 0, out X) && Room.IsTransmissive[X.Poly_id])// && Poly_X != Room.PlaneID(X.Poly_id))
                {
                    double[] Absorption = Room.AbsorptionValue[X.Poly_id].Coefficient_A_Broad();
                    for (int oct = 0; oct < 8; oct++) Trans_Mod[oct] *= (1 - Absorption[oct]) * Room.TransmissionValue[X.Poly_id][oct];
                    R.origin = X.X_Point;
                    R.Ray_ID = Rnd[Thread_Id].Next();
                    continue;
                }
                break;
            } while (true);

            if (X.t < L - 0.0001 && X.t != 0) return false;
            //if (Poly_X != Room.PlaneID(X.Poly_id))
            //{
            //    //Guid G1 = Rhino.RhinoDoc.ActiveDoc.Objects.Add(new Rhino.Geometry.LineCurve(Utilities.PachTools.HPttoRPt(X.X_Point), Utilities.PachTools.HPttoRPt(EndPt)));
            //    //Guid G2 = Rhino.RhinoDoc.ActiveDoc.Objects.Add(new TextDot(Room.PlaneID(X.Poly_id).ToString(), Utilities.PachTools.HPttoRPt(EndPt)));
            //    //Rhino.RhinoDoc.ActiveDoc.Groups.Add(new Guid[2] { G1, G2 });
            //    return false;
            //}
            //Poly_Seq = X.Poly_id;
            //X_Point = X.X_Point;
            X_Point = EndPt;
            return true;
        }