Beispiel #1
0
        public void Run()
        {
            for (int i = 1; i < Lx.Count; i++)
            {
                //get d;
                CurrentPoint = Lx[i];
                Ly           = Lx.Take(i).ToList();
                Ly           = Ly.OrderBy(e => e.Y).ToList();
                // width of Active Window
                for (int j = 0; j < Ly.Count; j++)
                {
                    if (Lx[i].X - Ly[j].X > Distance)
                    {
                        Ly.RemoveAt(j);
                    }
                }
                // height of Active Index
                var upper = CurrentPoint.Y + Distance;
                var lower = CurrentPoint.Y - Distance;
                for (int k = 0; k < Ly.Count; k++)
                {
                    if (Ly[k].Y > upper || Ly[k].Y < lower)
                    {
                        Ly.RemoveAt(k);
                    }
                }

                //get the new distance
                for (int c = 0; c < Ly.Count; c++)
                {
                    double tempDist = Math.Sqrt(
                        Math.Pow(Ly[c].X - Lx[i].X, 2) +
                        Math.Pow(Ly[c].Y - Lx[i].Y, 2)
                        );

                    if (tempDist < Distance)
                    {
                        Distance  = tempDist;
                        Result[0] = Lx[i];
                        Result[1] = Ly[c];
                        //FIRE THE STEP EVENT
                        step(this, new EventArgs());
                    }
                }
            }
        }
Beispiel #2
0
 get => new Vector3(Ly, H, Bx);