Esempio n. 1
0
    public void Execute(int index)
    {
        OutputDelays[index]     = 0;
        OutputAmplitudes[index] = 0;
        for (int i = 0; i < Array1.Length; i++)
        {
            if (Array2[index] == Array1[i])
            {
                Vector3 temp_normal  = MPC1[Array2[index]].Normal;
                Vector3 n_perp       = new Vector3(-temp_normal.z, 0, temp_normal.x);
                Vector3 rx_direction = (Rx_Point - MPC1[Array2[index]].Coordinates).normalized;
                Vector3 tx_direction = (Tx_Point - MPC1[Array2[index]].Coordinates).normalized;

                if ((Vector3.Dot(n_perp, rx_direction) * Vector3.Dot(n_perp, tx_direction)) < 0)
                {
                    // we mimic that we calculate the angles
                    double theta1 = Math.Acos(Vector3.Dot(temp_normal, rx_direction));
                    double theta2 = Math.Acos(Vector3.Dot(temp_normal, tx_direction));

                    int I1, I2, I3;
                    if (theta1 + theta2 < 0.35)
                    {
                        I1 = 0;
                    }
                    else
                    {
                        I1 = 1;
                    }
                    if (theta1 < 1.22)
                    {
                        I2 = 0;
                    }
                    else
                    {
                        I2 = 1;
                    }
                    if (theta2 < 1.22)
                    {
                        I3 = 0;
                    }
                    else
                    {
                        I3 = 1;
                    }

                    float angular_gain = (float)Math.Exp(-12 * ((theta1 + theta2 - 0.35) * I1 + (theta1 - 1.22) * I2 + (theta2 - 1.22) * I3));


                    float rx_distance = (Rx_Point - MPC1[Array2[index]].Coordinates).magnitude;
                    float tx_distance = (Tx_Point - MPC1[Array2[index]].Coordinates).magnitude;
                    float distance    = rx_distance + tx_distance;
                    Path1 temp_Path1  = new Path1(Rx_Point, MPC1[Array2[index]].Coordinates, Tx_Point, distance, angular_gain);
                    Output[index]           = temp_Path1;
                    OutputDelays[index]     = distance;// / Speed_of_Light;
                    OutputAmplitudes[index] = Array2_att[index] * Array1_att[i] * angular_gain * (1 / distance);
                }
                break;
            }
        }
    }
Esempio n. 2
0
        static void Main()
        {
            Point3D first = new Point3D()
            {
                X = 1, Y = 3, Z = 6
            };
            Point3D second = new Point3D()
            {
                X = 3, Y = 5, Z = 8
            };

            Console.WriteLine(Point3D.StartCoord);

            Console.WriteLine(first);
            Console.WriteLine(second);

            var distance = Point3DDistance.Distance(first, second);

            Console.WriteLine(distance);

            Path pathList = new Path();

            pathList.Add(first);
            pathList.Add(second);

            PathStorage.Save(pathList, @"../../PathStorage.txt");
            PathStorage.Load(@"../../PathStorage.txt");

            Console.WriteLine();

            foreach (Point3D point in PathStorage.path.ListOfPoints)
            {
                Console.WriteLine(point);
            }
            Console.WriteLine();


            var path23 = new Path1();

            for (int i = 0; i <= 10; i++)
            {
                path23.AddPoint(new Point3D()
                {
                    X = i, Y = i + 5, Z = i + 1
                });

                string pathStr = @"../../path.txt";

                PathStorage1.SavePath(path23, pathStr);

                var pathFromFIle = PathStorage1.LoadPath(@"../../path.txt");

                foreach (var loadPoint in pathFromFIle)
                {
                    Console.WriteLine(loadPoint);
                }
            }
        }
Esempio n. 3
0
        private static bool EqPoint(Path1 p1, Path1 p2)
        {
            bool flag = false;

            if (p1.endX == p2.startX && p1.endY == p2.startY)
            {
                flag = true;
            }

            return(flag);
        }
Esempio n. 4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceName.Length != 0)
            {
                hash ^= ResourceName.GetHashCode();
            }
            if (Id != 0L)
            {
                hash ^= Id.GetHashCode();
            }
            if (Campaign.Length != 0)
            {
                hash ^= Campaign.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            hash ^= finalUrls_.GetHashCode();
            hash ^= finalMobileUrls_.GetHashCode();
            if (Status != global::Google.Ads.GoogleAds.V10.Enums.AssetGroupStatusEnum.Types.AssetGroupStatus.Unspecified)
            {
                hash ^= Status.GetHashCode();
            }
            if (Path1.Length != 0)
            {
                hash ^= Path1.GetHashCode();
            }
            if (Path2.Length != 0)
            {
                hash ^= Path2.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 5
0
            private Path path()
            {
                string id = pathName();

                if (m_tokCur != HaystackToken.arrow)
                {
                    return(Path1.make(id));
                }

                List <string> segments = new List <string>();

                segments.Add(id);
                StringBuilder s = new StringBuilder().Append(id);

                while (m_tokCur == HaystackToken.arrow)
                {
                    consume(HaystackToken.arrow);
                    id = pathName();
                    segments.Add(id);
                    s.Append(HaystackToken.arrow).Append(id);
                }
                return(new PathN(s.ToString(), segments.ToArray()));
            }
Esempio n. 6
0
 CreateDescriptor(Path1, PipFragmentType.AbsolutePath, f => f.GetPathValue(), (v, p) => p.Add(v)),
Esempio n. 7
0
                protected override void Execute(CodeActivityContext context)
                {
                    colnm cBackHeaderColor = BackHeaderColor.Get(context);
                    colnm cFontHeaderColor = FontHeaderColor.Get(context);
                    colnm cBackAlt1Color   = BackAlt1Color.Get(context);
                    colnm cBackAlt2Color   = BackAlt2Color.Get(context);
                    colnm cFontAlt1Color   = FontAlt1Color.Get(context);
                    colnm cFontAlt2Color   = FontAlt2Color.Get(context);



                    if (cBackHeaderColor == colnm.Empty)
                    {
                        cBackHeaderColor = colnm.White;
                    }
                    if (cFontHeaderColor == colnm.Empty)
                    {
                        cFontHeaderColor = colnm.Black;
                    }
                    if (cBackAlt1Color == colnm.Empty)
                    {
                        cBackAlt1Color = colnm.White;
                    }
                    if (cBackAlt2Color == colnm.Empty)
                    {
                        cBackAlt2Color = colnm.White;
                    }
                    if (cFontAlt1Color == colnm.Empty)
                    {
                        cFontAlt1Color = colnm.Black;
                    }
                    if (cFontAlt2Color == colnm.Empty)
                    {
                        cFontAlt2Color = colnm.Black;
                    }


                    WriteTableInWord(dataTable.Get(context), Background.Get(context), Path1.Get(context), cBackHeaderColor, cFontHeaderColor, cBackAlt1Color, cFontAlt1Color, cBackAlt2Color, cFontAlt2Color);
                }
Esempio n. 8
0
        private void btnAddFilePath_Click(object sender, EventArgs e)
        {
            try
            {
                btnPrimaryDir.BackColor  = Color.FromName("Control");
                btnSecondDir.BackColor   = Color.FromName("Control");
                btnAddFilePath.BackColor = Color.FromName("Control");
                string Path1;
                string Path2;


                if (rbPrimaryDir.Checked)
                {
                    if (textBox2.Text == "")
                    {
                        rbSecondaryDir.BackColor = Color.Yellow;
                        btnSecondDir.BackColor   = Color.Yellow;
                    }

                    rbPrimaryDir.BackColor = Color.FromName("Control");

                    tvFilesView.SelectedNode.BackColor = Color.Blue;
                    tvFilesView.SelectedNode.ForeColor = Color.White;

                    if (tvFilesView.SelectedNode.PrevNode != null || tvFilesView.SelectedNode.PrevNode.BackColor == Color.Green ||
                        tvFilesView.SelectedNode.PrevNode.BackColor == Color.Blue)
                    {
                        tvFilesView.SelectedNode.PrevNode.BackColor = Color.White;
                        tvFilesView.SelectedNode.PrevNode.ForeColor = Color.Black;
                    }

                    Path1         = tvFilesView.SelectedNode.FullPath.ToString();
                    Path1         = Path1.Insert(1, ":");
                    textBox1.Text = Path1;
                }
                else if (rbSecondaryDir.Checked)
                {
                    if (textBox1.Text == "")
                    {
                        rbPrimaryDir.BackColor  = Color.Yellow;
                        btnPrimaryDir.BackColor = Color.Yellow;
                    }

                    rbSecondaryDir.BackColor = Color.FromName("Control");

                    rbSecondaryDir.BackColor           = Color.Transparent;
                    tvFilesView.SelectedNode.BackColor = Color.Green;
                    tvFilesView.SelectedNode.ForeColor = Color.White;

                    if (tvFilesView.SelectedNode.PrevNode != null || tvFilesView.SelectedNode.PrevNode.BackColor == Color.Blue ||
                        tvFilesView.SelectedNode.PrevNode.BackColor == Color.Green)
                    {
                        tvFilesView.SelectedNode.PrevNode.BackColor = Color.White;
                        tvFilesView.SelectedNode.PrevNode.ForeColor = Color.Black;
                    }

                    Path2         = tvFilesView.SelectedNode.FullPath.ToString();
                    Path2         = Path2.Insert(1, ":");
                    textBox2.Text = Path2;
                }
                else
                {
                    tbOutPut.Text = "Pick two Directories to begin!";
                    errorProvider.SetError(rbPrimaryDir, "Select One");
                    errorProvider.SetError(rbSecondaryDir, "Select One");
                    errorProvider.SetError(btnPrimaryDir, "Select a Directory");
                    errorProvider.SetError(btnSecondDir, "Select a Directory");
                }

                Path1 = textBox1.Text;
                Path2 = textBox2.Text;

                if (Path1 != "" && Path2 != "")
                {
                    btnCompare.BackColor = Color.Yellow;
                    tbOutPut.Text        = "Green Light to compare Files !";
                    tbOutPut.BackColor   = Color.Green;
                    tbOutPut.ForeColor   = Color.White;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 计算路劲位置所在的坐标
        /// </summary>
        /// <param name="path">路劲</param>
        /// <param name="loct">路劲上的位置</param>
        /// <param name="CurrentPx">坐标X</param>
        /// <param name="CurrentPy">坐标Y</param>
        public static void CalPoint(int path, int loct, out int CurrentPx, out int CurrentPy)
        {
            int    Px = 0, Py = 0;
            double t;
            Path1  p = null;

            //Console.WriteLine(loct);

            if (Config.PathList.Keys.Contains(path))
            {
                p = Config.PathList[path];
            }

            if (p != null)
            {
                if (loct >= p.PathLength)
                {
                    Px = p.endX;
                    Py = p.endY;
                }
                else
                {
                    switch (p.Dire)
                    {
                    case Direction.DirUp:
                        Px = p.startX;
                        Py = p.startY - loct;
                        break;

                    case Direction.DirDown:
                        Px = p.startX;
                        Py = p.startY + loct;
                        break;

                    case Direction.DirLeft:
                        Px = p.startX - loct;
                        Py = p.startY;
                        break;

                    case Direction.DirRight:
                        Px = p.startX + loct;
                        Py = p.startY;
                        break;

                    case Direction.DirTnUtL:
                        t  = Math.PI / 2 * (0) + Math.PI / 30 * (loct);
                        Px = (int)(10 * Math.Cos(t) + p.CenterX + 0.5);
                        Py = (int)(-10 * Math.Sin(t) + p.CenterY + 0.5);
                        break;

                    case Direction.DirTnUtR:
                        t  = Math.PI / 2 + Math.PI / 2 * (1) - Math.PI / 30 * (loct);
                        Px = (int)(10 * Math.Cos(t) + p.CenterX + 0.5);
                        Py = (int)(-10 * Math.Sin(t) + p.CenterY + 0.5);
                        break;

                    case Direction.DirTnDtL:
                        t  = Math.PI / 2 + Math.PI / 2 * (3) - Math.PI / 30 * (loct);
                        Px = (int)(10 * Math.Cos(t) + p.CenterX + 0.5);
                        Py = (int)(-10 * Math.Sin(t) + p.CenterY + 0.5);
                        break;

                    case Direction.DirTnDtR:
                        t  = Math.PI / 2 * (2) + Math.PI / 30 * (loct);
                        Px = (int)(10 * Math.Cos(t) + p.CenterX + 0.5);
                        Py = (int)(-10 * Math.Sin(t) + p.CenterY + 0.5);
                        break;

                    case Direction.DirTnLtU:
                        t  = Math.PI / 2 + Math.PI / 2 * (2) - Math.PI / 30 * (loct);
                        Px = (int)(10 * Math.Cos(t) + p.CenterX + 0.5);
                        Py = (int)(-10 * Math.Sin(t) + p.CenterY + 0.5);
                        break;

                    case Direction.DirTnLtD:
                        t  = Math.PI / 2 * (1) + Math.PI / 30 * (loct);
                        Px = (int)(10 * Math.Cos(t) + p.CenterX + 0.5);
                        Py = (int)(-10 * Math.Sin(t) + p.CenterY + 0.5);
                        break;

                    case Direction.DirTnRtU:
                        t  = Math.PI / 2 * (3) + Math.PI / 30 * (loct);
                        Px = (int)(10 * Math.Cos(t) + p.CenterX + 0.5);
                        Py = (int)(-10 * Math.Sin(t) + p.CenterY + 0.5);
                        break;

                    case Direction.DirTnRtD:
                        t  = Math.PI / 2 + Math.PI / 2 * (4) - Math.PI / 30 * (loct);
                        Px = (int)(10 * Math.Cos(t) + p.CenterX + 0.5);
                        Py = (int)(-10 * Math.Sin(t) + p.CenterY + 0.5);
                        break;

                    default:
                        break;
                    }
                }
            }
            else
            {
                Px = 0;
                Py = 0;
            }

            CurrentPx = Px;
            CurrentPy = Py;
        }
Esempio n. 10
0
        /// <summary>
        /// 计算AGV下一个路径位置(路径链表)
        /// </summary>
        /// <param name="AGVIndex">AGV编号</param>
        public static void UpdataPath(int AGVNum)
        {
            if (Config.PathList[Config.AGVPath1[AGVNum]] != null)                                   ///开始路径不为空
            {
                if (Config.AGVLoct1[AGVNum] >= Config.PathList[Config.AGVPath1[AGVNum]].PathLength) ////走完了一条路径
                {
                    Config.AGVLoct1[AGVNum] = 1;                                                    ///
                    switch (Config.AGVPath1[AGVNum])
                    {
                    case 11:
                        if (Config.AGVTar1[AGVNum] == 1)
                        {
                            Config.AGVPath1[AGVNum] = 12;
                        }
                        else
                        {
                            Config.AGVPath1[AGVNum] = 21;
                        }

                        break;

                    case 21:

                        if (Config.AGVTar1[AGVNum] == 2)
                        {
                            Config.AGVPath1[AGVNum] = 22;
                        }
                        else
                        {
                            Config.AGVPath1[AGVNum] = 31;
                        }
                        break;

                    case 31:

                        if (Config.AGVTar1[AGVNum] == 3)
                        {
                            Config.AGVPath1[AGVNum] = 32;
                        }
                        else
                        {
                            Config.AGVPath1[AGVNum] = 41;
                        }
                        break;

                    default:
                        Path1 pPrev = Config.PathList[Config.AGVPath1[AGVNum]];
                        foreach (int i in Config.PathList.Keys)                 /**/
                        {
                            Path1 pNext = Config.PathList[i];
                            if (pNext != null && pNext != pPrev)    ///下一路径不为空且不是本身
                            {
                                if (EqPoint(pPrev, pNext))
                                {
                                    Config.AGVPath1[AGVNum] = i;      ///确定下一路径
                                    break;
                                }
                            }
                        }
                        break;
                    }
                }
                else
                {
                    Config.AGVLoct1[AGVNum]++;
                }
            }
        }